diff --git a/epic-games.js b/epic-games.js index 603bc33..675a432 100644 --- a/epic-games.js +++ b/epic-games.js @@ -79,6 +79,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!`); diff --git a/gog.js b/gog.js index 11fcfec..d6c3ad4 100644 --- a/gog.js +++ b/gog.js @@ -47,6 +47,7 @@ try { await Promise.any([signIn.waitFor(), page.waitForSelector('#menuUsername')]); while (await signIn.isVisible()) { console.error('Not signed in anymore.'); + if (cfg.nowait) process.exit(1); await signIn.click(); // it then creates an iframe for the login await page.waitForSelector('#GalaxyAccountsFrameContainer iframe'); // TODO needed? diff --git a/prime-gaming.js b/prime-gaming.js index 4e1c7aa..23eb2bf 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -44,6 +44,7 @@ try { page.click('[aria-label="Cookies usage disclaimer banner"] button:has-text("Accept Cookies")').catch(_ => { }); // to not waste screen space when non-headless, TODO does not work reliably, need to wait for something else first? while (await page.locator('button:has-text("Sign in")').count() > 0) { console.error('Not signed in anymore.'); + if (cfg.nowait) process.exit(1); await page.click('button:has-text("Sign in")'); 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!`); diff --git a/src/config.js b/src/config.js index a8b1817..a9522e9 100644 --- a/src/config.js +++ b/src/config.js @@ -9,8 +9,9 @@ export const cfg = { debug_network: process.env.DEBUG_NETWORK == '1', // log network requests and responses record: process.env.RECORD == '1', // `recordHar` (network) + `recordVideo` time: process.env.TIME == '1', // log duration of each step + interactive: process.env.INTERACTIVE == '1', // confirm to claim, enter to skip dryrun: process.env.DRYRUN == '1', // don't claim anything - interactive: process.env.INTERACTIVE == '1', // confirm to claim, default skip + nowait: process.env.NOWAIT == '1', // fail fast instead of waiting for user input show: process.env.SHOW == '1', // run non-headless get headless() { return !this.debug && !this.show;