respect INTERACTIVE=1 in gog and eg, not just pg
This commit is contained in:
parent
f7a584c415
commit
9285b52017
2 changed files with 4 additions and 2 deletions
|
|
@ -3,7 +3,7 @@ import { authenticator } from 'otplib';
|
|||
import chalk from 'chalk';
|
||||
import path from 'path';
|
||||
import { existsSync, writeFileSync, appendFileSync } from 'fs';
|
||||
import { resolve, jsonDb, datetime, stealth, filenamify, prompt, notify, html_game_list, handleSIGINT } from './src/util.js';
|
||||
import { resolve, jsonDb, datetime, stealth, 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);
|
||||
|
|
@ -260,6 +260,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 });
|
||||
|
|
|
|||
3
gog.js
3
gog.js
|
|
@ -1,6 +1,6 @@
|
|||
import { firefox } from 'playwright-firefox'; // stealth plugin needs no outdated playwright-extra
|
||||
import chalk from 'chalk';
|
||||
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, 'gog', ...a);
|
||||
|
|
@ -106,6 +106,7 @@ try {
|
|||
console.log(`Current free game: ${chalk.blue(title)} - ${url}`);
|
||||
db.data[user][title] ||= { title, time: datetime(), url };
|
||||
if (cfg.dryrun) process.exit(1);
|
||||
if (cfg.interactive && !await confirm()) process.exit(0);
|
||||
// await page.locator('#giveaway:not(.is-loading)').waitFor(); // otherwise screenshot is sometimes with loading indicator instead of game title; #TODO fix, skipped due to timeout, see #240
|
||||
await banner.screenshot({ path: screenshot(`${filenamify(title)}.png`) }); // overwrites every time - only keep first?
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue