fix: reduce size, fix signin redirect

* correct freegames url
* skip downloading browsers in docker
* remove fluxbox
* remove stdout for vnc & xvfb
This commit is contained in:
Trung Le 2022-04-01 01:47:48 +07:00
parent a8c578bd93
commit dbf4804dc7
5 changed files with 830 additions and 1316 deletions

View file

@ -3,16 +3,18 @@ import path from 'path';
import { __dirname, stealth } from './util.js';
const debug = process.env.PWDEBUG == '1'; // runs non-headless and opens https://playwright.dev/docs/inspector
const URL_CLAIM = 'https://store.epicgames.com/store/en-US/free-games';
const URL_CLAIM = 'https://store.epicgames.com/en-US/free-games';
const URL_LOGIN = 'https://www.epicgames.com/id/login?lang=en-US&noHostRedirect=true&redirectUrl=' + URL_CLAIM;
const TIMEOUT = 20 * 1000; // 20s, default is 30s
const SCREEN_WIDTH = Number(process.env.SCREEN_WIDTH) || 1280;
const SCREEN_HEIGHT = Number(process.env.SCREEN_HEIGHT) || 1280;
// https://playwright.dev/docs/auth#multi-factor-authentication
const context = await chromium.launchPersistentContext(path.resolve(__dirname, 'userDataDir'), {
// chrome will not work in linux arm64, only chromium
// channel: 'chrome', // https://playwright.dev/docs/browsers#google-chrome--microsoft-edge
headless: false,
viewport: { width: 1280, height: 1280 },
viewport: { width: SCREEN_WIDTH, height: SCREEN_HEIGHT },
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36', // see replace of Headless in util.newStealthContext. TODO update if browser is updated!
locale: "en-US", // ignore OS locale to be sure to have english text for locators
args: [ // don't want to see bubble 'Restore pages? Chrome didn't shut down correctly.', but flags below don't work.