Fix eslint no-unused-vars in async handlers
Some checks failed
build-and-push / lint (push) Failing after 4s
build-and-push / sonar (push) Has been skipped
build-and-push / docker (push) Has been skipped

This commit is contained in:
nocci 2025-12-30 16:15:14 +00:00
parent 3fd861f134
commit 52895fd991
3 changed files with 24 additions and 24 deletions

View file

@ -97,7 +97,7 @@ try {
await page.waitForSelector('.h_captcha_challenge iframe', { timeout: 15000 });
console.error('Got a captcha during login (likely due to too many attempts)! You may solve it in the browser, get a new IP or try again in a few hours.');
await notify('epic-games: got captcha during login. Please check.');
} catch (e) {
} catch {
return;
}
})();
@ -105,7 +105,7 @@ try {
try {
await page.waitForSelector('p:has-text("Incorrect response.")', { timeout: 15000 });
console.error('Incorrect response for captcha!');
} catch (e) {
} catch {
return;
}
})();
@ -122,7 +122,7 @@ try {
await error.waitFor({ timeout: 15000 });
console.error('Login error:', await error.innerText());
console.log('Please login in the browser!');
} catch (e) {
} catch {
return;
}
})();
@ -133,7 +133,7 @@ try {
const otp = cfg.eg_otpkey && authenticator.generate(cfg.eg_otpkey) || await prompt({ type: 'text', message: 'Enter two-factor sign in code', validate: n => n.toString().length == 6 || 'The code must be 6 digits!' }); // can't use type: 'number' since it strips away leading zeros and codes sometimes have them
await page.locator('input[name="code-input-0"]').pressSequentially(otp.toString());
await page.click('button[type="submit"]');
} catch (e) {
} catch {
return;
}
})();
@ -236,7 +236,7 @@ try {
console.log(' Accept End User License Agreement (only needed once)');
await page.locator('input#agree').check();
await page.locator('button:has-text("Accept")').click();
} catch (e) {
} catch {
return;
}
})();
@ -261,7 +261,7 @@ try {
}
await iframe.locator('input.payment-pin-code__input').first().pressSequentially(cfg.eg_parentalpin);
await iframe.locator('button:has-text("Continue")').click({ delay: 11 });
} catch (e) {
} catch {
return;
}
})();
@ -283,7 +283,7 @@ try {
try {
await btnAgree.waitFor({ timeout: 10000 });
await btnAgree.click();
} catch (e) {
} catch {
return;
}
})(); // EU: wait for and click 'I Agree'
@ -295,7 +295,7 @@ try {
await captcha.waitFor({ timeout: 10000 });
console.error(' Got hcaptcha challenge! Lost trust due to too many login attempts? You can solve the captcha in the browser or get a new IP address.');
await notify(`epic-games: got captcha challenge for.\nGame link: ${url}`);
} catch (e) {
} catch {
return;
}
})(); // may time out if not shown
@ -304,7 +304,7 @@ try {
await iframe.locator('.payment__errors:has-text("Failed to challenge captcha, please try again later.")').waitFor({ timeout: 10000 });
console.error(' Failed to challenge captcha, please try again later.');
await notify('epic-games: failed to challenge captcha. Please check.');
} catch (e) {
} catch {
return;
}
})();

4
gog.js
View file

@ -69,7 +69,7 @@ try {
await iframe.locator('#second_step_authentication_token_letter_1').pressSequentially(otp.toString(), { delay: 10 });
await iframe.locator('#second_step_authentication_send').click();
await page.waitForTimeout(1000);
} catch (e) {
} catch {
return;
}
})();
@ -78,7 +78,7 @@ try {
await iframe.locator('text=Invalid captcha').waitFor({ timeout: 15000 });
console.error('Got a captcha during login (likely due to too many attempts)! You may solve it in the browser, get a new IP or try again in a few hours.');
notify('gog: got captcha during login. Please check.');
} catch (e) {
} catch {
return;
}
})();

View file

@ -64,7 +64,7 @@ try {
await page.waitForSelector('#h_captcha_challenge_login_prod iframe', { timeout: 15000 });
console.error('Got a captcha during login (likely due to too many attempts)! You may solve it in the browser, get a new IP or try again in a few hours.');
notify('unrealengine: got captcha during login. Please check.');
} catch (e) {
} catch {
return;
}
})();
@ -75,7 +75,7 @@ try {
const otp = cfg.eg_otpkey && authenticator.generate(cfg.eg_otpkey) || await prompt({ type: 'text', message: 'Enter two-factor sign in code', validate: n => n.toString().length == 6 || 'The code must be 6 digits!' }); // can't use type: 'number' since it strips away leading zeros and codes sometimes have them
await page.locator('input[name="code-input-0"]').pressSequentially(otp.toString());
await page.click('button[type="submit"]');
} catch (e) {
} catch {
return;
}
})();
@ -142,15 +142,15 @@ try {
await page.locator('button.checkout').click();
console.log('Click checkout');
// maybe: Accept End User License Agreement
void (async () => {
try {
await page.locator('[name=accept-label]').check({ timeout: 10000 });
console.log('Accept End User License Agreement');
await page.locator('span:text-is("Accept")').click(); // otherwise matches 'Accept All Cookies'
} catch (e) {
return;
}
})();
void (async () => {
try {
await page.locator('[name=accept-label]').check({ timeout: 10000 });
console.log('Accept End User License Agreement');
await page.locator('span:text-is("Accept")').click(); // otherwise matches 'Accept All Cookies'
} catch {
return;
}
})();
await page.waitForSelector('#webPurchaseContainer iframe');
const iframe = page.frameLocator('#webPurchaseContainer iframe');
@ -170,7 +170,7 @@ try {
try {
await btnAgree.waitFor({ timeout: 10000 });
await btnAgree.click();
} catch (e) {
} catch {
return;
}
})(); // EU: wait for and click 'I Agree'
@ -181,7 +181,7 @@ try {
try {
await captcha.waitFor({ timeout: 10000 });
console.error(' Got hcaptcha challenge! Lost trust due to too many login attempts? You can solve the captcha in the browser or get a new IP address.');
} catch (e) {
} catch {
return;
}
})(); // may time out if not shown