From 0393a3998b2d877be15992dca948913ab00bfac8 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Sun, 29 Jan 2023 19:52:18 +0100 Subject: [PATCH] info about escaping prompts only if needed --- epic-games.js | 3 ++- gog.js | 3 ++- prime-gaming.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/epic-games.js b/epic-games.js index 113632b..2e26078 100644 --- a/epic-games.js +++ b/epic-games.js @@ -74,7 +74,8 @@ try { context.setDefaultTimeout(0); // give user time to log in without timeout await page.goto(URL_LOGIN, { waitUntil: 'domcontentloaded' }); - console.info('Press ESC to skip if you want to login in the browser.'); + if (cfg.eg_email && cfg.eg_password) console.info('Using email and password from environment.'); + else console.info('Press ESC to skip if you want to login in the browser.'); const email = cfg.eg_email || await prompt({message: 'Enter email'}); const password = cfg.eg_password || await prompt({type: 'password', message: 'Enter password'}); if (email && password) { diff --git a/gog.js b/gog.js index 6093f15..01049c5 100644 --- a/gog.js +++ b/gog.js @@ -46,7 +46,8 @@ try { await page.waitForSelector('#GalaxyAccountsFrameContainer iframe'); // TODO needed? const iframe = page.frameLocator('#GalaxyAccountsFrameContainer iframe'); context.setDefaultTimeout(0); // give user time to log in without timeout - console.info('Press ESC to skip if you want to login in the browser (not possible in headless mode).'); + if (cfg.gog_email && cfg.gog_password) console.info('Using email and password from environment.'); + else console.info('Press ESC to skip if you want to login in the browser (not possible in headless mode).'); const email = cfg.gog_email || await prompt({message: 'Enter email'}); const password = cfg.gog_password || await prompt({type: 'password', message: 'Enter password'}); if (email && password) { diff --git a/prime-gaming.js b/prime-gaming.js index 21d68e3..5a5297e 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -52,7 +52,8 @@ try { console.error('Not signed in anymore.'); await page.click('button:has-text("Sign in")'); if (!cfg.debug) context.setDefaultTimeout(0); // give user time to log in without timeout - console.info('Press ESC to skip if you want to login in the browser (not possible in default headless mode).'); + if (cfg.pg_email && cfg.pg_password) console.info('Using email and password from environment.'); + else console.info('Press ESC to skip if you want to login in the browser (not possible in default headless mode).'); const email = cfg.pg_email || await prompt({message: 'Enter email'}); const password = cfg.pg_password || await prompt({type: 'password', message: 'Enter password'}); if (email && password) {