eg: disable webgl since it leaks running virtualized, #183
This commit is contained in:
parent
00275d825b
commit
aee72327ea
1 changed files with 9 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue