eg: ignore SHOW=0 since it leads to captcha

This commit is contained in:
Ralf Vogler 2025-05-26 01:01:15 +02:00
parent 34b24f3eb7
commit ce5bac6a03

View file

@ -3,7 +3,7 @@ import { chromium } from 'patchright';
import { authenticator } from 'otplib';
import chalk from 'chalk';
import path from 'path';
import { existsSync, writeFileSync, appendFileSync } from 'fs';
import { existsSync, writeFileSync } from 'fs';
import { resolve, jsonDb, datetime, filenamify, prompt, confirm, notify, html_game_list, handleSIGINT } from './src/util.js';
import { cfg } from './src/config.js';
@ -21,7 +21,7 @@ if (cfg.time) console.time('startup');
// https://playwright.dev/docs/auth#multi-factor-authentication
const context = await chromium.launchPersistentContext(cfg.dir.browser, {
// channel: 'chrome', // recommended, but `npx patchright install chrome` clashes with system Chrome - https://github.com/Kaliiiiiiiiii-Vinyzu/patchright-nodejs#best-practice----use-chrome-without-fingerprint-injection
headless: cfg.headless,
headless: false, // don't use cfg.headless headless here since SHOW=0 will lead to captcha
viewport: { width: cfg.width, height: cfg.height },
// locale: 'en-US', // ignore OS locale to be sure to have english text for locators
recordVideo: cfg.record ? { dir: 'data/record/', size: { width: cfg.width, height: cfg.height } } : undefined, // will record a .webm video for each page navigated; without size, video would be scaled down to fit 800x800