Skip to content

Commit

Permalink
eg: disable webgl since it leaks running virtualized, #183
Browse files Browse the repository at this point in the history
  • Loading branch information
vogler committed Jun 27, 2024
1 parent 00275d8 commit aee7232
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion epic-games.js
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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,
Expand Down

0 comments on commit aee7232

Please sign in to comment.