info about escaping prompts only if needed

This commit is contained in:
Ralf Vogler 2023-01-29 19:52:18 +01:00
parent d4bf4a7af0
commit 0393a3998b
3 changed files with 6 additions and 3 deletions

View file

@ -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) {

3
gog.js
View file

@ -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) {

View file

@ -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) {