diff --git a/epic-games.js b/epic-games.js index 04a091e..d0b9a03 100644 --- a/epic-games.js +++ b/epic-games.js @@ -1,7 +1,7 @@ import { firefox } from 'playwright-firefox'; // stealth plugin needs no outdated playwright-extra import { authenticator } from 'otplib'; import path from 'path'; -import { existsSync, writeFileSync } from 'fs'; +import { existsSync, writeFileSync, appendFileSync } from 'fs'; import { resolve, jsonDb, datetime, stealth, filenamify, prompt, notify, html_game_list, handleSIGINT } from './src/util.js'; import { cfg } from './src/config.js'; @@ -16,6 +16,14 @@ const db = await jsonDb('epic-games.json', {}); if (cfg.time) console.time('startup'); +const browserPrefs = path.join(cfg.dir.browser, 'prefs.js'); +if (existsSync(browserPrefs)) { + console.log('Adding webgl.disabled to', browserPrefs); + appendFileSync(browserPrefs, 'user_pref("webgl.disabled", true);'); // apparently Firefox removes duplicates (and sorts), so no problem appending every time +} else { + console.log(browserPrefs, 'does not exist yet, will patch it on next run. Restart the script if you get a captcha.'); +} + // https://playwright.dev/docs/auth#multi-factor-authentication const context = await firefox.launchPersistentContext(cfg.dir.browser, { headless: cfg.headless,