NOWAIT=1 to fail fast instead of waiting for user input
hitting ctrl-c 3x to abort is annoying...
This commit is contained in:
parent
9285b52017
commit
82d39d30b6
4 changed files with 5 additions and 1 deletions
|
|
@ -79,6 +79,7 @@ try {
|
||||||
|
|
||||||
while (await page.locator('egs-navigation').getAttribute('isloggedin') != 'true') {
|
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.');
|
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.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
|
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!`);
|
console.info(`Login timeout is ${cfg.login_timeout / 1000} seconds!`);
|
||||||
|
|
|
||||||
1
gog.js
1
gog.js
|
|
@ -47,6 +47,7 @@ try {
|
||||||
await Promise.any([signIn.waitFor(), page.waitForSelector('#menuUsername')]);
|
await Promise.any([signIn.waitFor(), page.waitForSelector('#menuUsername')]);
|
||||||
while (await signIn.isVisible()) {
|
while (await signIn.isVisible()) {
|
||||||
console.error('Not signed in anymore.');
|
console.error('Not signed in anymore.');
|
||||||
|
if (cfg.nowait) process.exit(1);
|
||||||
await signIn.click();
|
await signIn.click();
|
||||||
// it then creates an iframe for the login
|
// it then creates an iframe for the login
|
||||||
await page.waitForSelector('#GalaxyAccountsFrameContainer iframe'); // TODO needed?
|
await page.waitForSelector('#GalaxyAccountsFrameContainer iframe'); // TODO needed?
|
||||||
|
|
|
||||||
|
|
@ -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?
|
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) {
|
while (await page.locator('button:has-text("Sign in")').count() > 0) {
|
||||||
console.error('Not signed in anymore.');
|
console.error('Not signed in anymore.');
|
||||||
|
if (cfg.nowait) process.exit(1);
|
||||||
await page.click('button:has-text("Sign in")');
|
await page.click('button:has-text("Sign in")');
|
||||||
if (!cfg.debug) context.setDefaultTimeout(cfg.login_timeout); // give user some extra time to log 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!`);
|
console.info(`Login timeout is ${cfg.login_timeout / 1000} seconds!`);
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,9 @@ export const cfg = {
|
||||||
debug_network: process.env.DEBUG_NETWORK == '1', // log network requests and responses
|
debug_network: process.env.DEBUG_NETWORK == '1', // log network requests and responses
|
||||||
record: process.env.RECORD == '1', // `recordHar` (network) + `recordVideo`
|
record: process.env.RECORD == '1', // `recordHar` (network) + `recordVideo`
|
||||||
time: process.env.TIME == '1', // log duration of each step
|
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
|
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
|
show: process.env.SHOW == '1', // run non-headless
|
||||||
get headless() {
|
get headless() {
|
||||||
return !this.debug && !this.show;
|
return !this.debug && !this.show;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue