Merge branch 'dev' into patchright
This commit is contained in:
commit
6ce17f667e
31 changed files with 1383 additions and 1837 deletions
|
|
@ -4,7 +4,7 @@ import { authenticator } from 'otplib';
|
|||
import chalk from 'chalk';
|
||||
import path from 'path';
|
||||
import { existsSync, writeFileSync, appendFileSync } from 'fs';
|
||||
import { resolve, jsonDb, datetime, filenamify, prompt, notify, html_game_list, handleSIGINT } from './src/util.js';
|
||||
import { resolve, jsonDb, datetime, filenamify, prompt, confirm, notify, html_game_list, handleSIGINT } from './src/util.js';
|
||||
import { cfg } from './src/config.js';
|
||||
|
||||
const screenshot = (...a) => resolve(cfg.dir.screenshots, 'epic-games', ...a);
|
||||
|
|
@ -45,7 +45,6 @@ const page = context.pages().length ? context.pages()[0] : await context.newPage
|
|||
await page.setViewportSize({ width: cfg.width, height: cfg.height }); // TODO workaround for https://github.com/vogler/free-games-claimer/issues/277 until Playwright fixes it
|
||||
|
||||
// some debug info about the page (screen dimensions, user agent, platform)
|
||||
// eslint-disable-next-line no-undef
|
||||
if (cfg.debug) console.debug(await page.evaluate(() => [(({ width, height, availWidth, availHeight }) => ({ width, height, availWidth, availHeight }))(window.screen), navigator.userAgent, navigator.platform, navigator.vendor])); // deconstruct screen needed since `window.screen` prints {}, `window.screen.toString()` '[object Screen]', and can't use some pick function without defining it on `page`
|
||||
if (cfg.debug_network) {
|
||||
// const filter = _ => true;
|
||||
|
|
@ -72,6 +71,7 @@ try {
|
|||
|
||||
while (await page.locator('egs-navigation').getAttribute('isloggedin') != 'true') {
|
||||
console.error('Not signed in anymore. Please login in the browser or here in the terminal.');
|
||||
if (cfg.nowait) process.exit(1);
|
||||
if (cfg.novnc_port) console.info(`Open http://localhost:${cfg.novnc_port} to login inside the docker container.`);
|
||||
if (!cfg.debug) context.setDefaultTimeout(cfg.login_timeout); // give user some extra time to log in
|
||||
console.info(`Login timeout is ${cfg.login_timeout / 1000} seconds!`);
|
||||
|
|
@ -253,6 +253,7 @@ try {
|
|||
if (cfg.time) console.timeEnd('claim game');
|
||||
continue;
|
||||
}
|
||||
if (cfg.interactive && !await confirm()) continue;
|
||||
|
||||
// Playwright clicked before button was ready to handle event, https://github.com/vogler/free-games-claimer/issues/84#issuecomment-1474346591
|
||||
await iframe.locator('button:has-text("Place Order"):not(:has(.payment-loading--loading))').click({ delay: 11 });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue