Clean up Sonar issues and lint warnings
Some checks failed
build-and-push / lint (push) Failing after 5s
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:45:17 +00:00
parent b9aa6e0073
commit 7ffc454e47
6 changed files with 124 additions and 89 deletions

13
gog.js
View file

@ -60,7 +60,7 @@ try {
await iframe.locator('#login_username').fill(email);
await iframe.locator('#login_password').fill(password);
await iframe.locator('#login_login').click();
void (async () => {
const handleTwoFactor = async () => {
try {
await iframe.locator('form[name=second_step_authentication]').waitFor({ timeout: 15000 });
console.log('Two-Step Verification - Enter security code');
@ -72,8 +72,8 @@ try {
} catch {
return;
}
})();
void (async () => {
};
const watchInvalidCaptcha = async () => {
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.');
@ -81,7 +81,9 @@ try {
} catch {
return;
}
})();
};
handleTwoFactor();
watchInvalidCaptcha();
await page.waitForSelector('#menuUsername');
} else {
console.log('Waiting for you to login in the browser.');
@ -100,7 +102,8 @@ try {
db.data[user] ||= {};
const banner = page.locator('#giveaway');
if (!await banner.count()) {
const hasGiveaway = await banner.count();
if (!hasGiveaway) {
console.log('Currently no free giveaway!');
} else {
const text = await page.locator('.giveaway__content-header').innerText();