From 52895fd991e2fdb826778f4405fa57a765ce08ef Mon Sep 17 00:00:00 2001 From: nocci Date: Tue, 30 Dec 2025 16:15:14 +0000 Subject: [PATCH] Fix eslint no-unused-vars in async handlers --- epic-games.js | 18 +++++++++--------- gog.js | 4 ++-- unrealengine.js | 26 +++++++++++++------------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/epic-games.js b/epic-games.js index 22a9113..bbf000c 100644 --- a/epic-games.js +++ b/epic-games.js @@ -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; } })(); diff --git a/gog.js b/gog.js index 2f83d6b..5f0abad 100644 --- a/gog.js +++ b/gog.js @@ -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; } })(); diff --git a/unrealengine.js b/unrealengine.js index fe93460..ad6ed68 100644 --- a/unrealengine.js +++ b/unrealengine.js @@ -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