fix: detect cloudflare challenge and wait for manual solve in new epic claimer
This commit is contained in:
parent
1a34d8f0e4
commit
1c34648112
1 changed files with 13 additions and 0 deletions
|
|
@ -148,6 +148,12 @@ const ensureLoggedIn = async (page, context) => {
|
|||
}
|
||||
};
|
||||
|
||||
const isChallenge = async () => {
|
||||
const cfFrame = page.locator('iframe[title*="Cloudflare"], iframe[src*="challenges"]');
|
||||
const cfText = page.locator('text=Verify you are human');
|
||||
return (await cfFrame.count()) > 0 || (await cfText.count()) > 0;
|
||||
};
|
||||
|
||||
while (!await isLoggedIn()) {
|
||||
console.error('Not signed in anymore. Trying automatic login, otherwise please login in the browser.');
|
||||
if (cfg.novnc_port) console.info(`Open http://localhost:${cfg.novnc_port} to login inside the docker container.`);
|
||||
|
|
@ -155,6 +161,13 @@ const ensureLoggedIn = async (page, context) => {
|
|||
console.info(`Login timeout is ${cfg.login_timeout / 1000} seconds!`);
|
||||
await page.goto(URL_CLAIM, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
if (await isChallenge()) {
|
||||
console.warn('Cloudflare challenge detected. Solve the captcha in the browser (no automation).');
|
||||
await notify('epic-games (new): Cloudflare challenge, please solve manually in browser.');
|
||||
await page.waitForTimeout(cfg.login_timeout);
|
||||
continue;
|
||||
}
|
||||
|
||||
const logged = await attemptAutoLogin();
|
||||
if (logged) break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue