Fix lint: guard browser globals and normalize indentation
This commit is contained in:
parent
7ffc454e47
commit
a477bb3327
2 changed files with 9 additions and 9 deletions
|
|
@ -50,7 +50,7 @@ await page.setViewportSize({ width: cfg.width, height: cfg.height }); // workaro
|
||||||
|
|
||||||
// some debug info about the page (screen dimensions, user agent)
|
// some debug info about the page (screen dimensions, user agent)
|
||||||
if (cfg.debug) {
|
if (cfg.debug) {
|
||||||
// eslint-disable-next-line no-undef
|
/* global window, navigator */
|
||||||
const debugInfo = await page.evaluate(() => {
|
const debugInfo = await page.evaluate(() => {
|
||||||
const { width, height, availWidth, availHeight } = window.screen;
|
const { width, height, availWidth, availHeight } = window.screen;
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -527,12 +527,12 @@ try {
|
||||||
} else if (reason == 'code_not_found') {
|
} else if (reason == 'code_not_found') {
|
||||||
redeem_action = 'redeem (not found)';
|
redeem_action = 'redeem (not found)';
|
||||||
console.error(' Code was not found!');
|
console.error(' Code was not found!');
|
||||||
} else { // unknown state; keep info log for later analysis
|
} else { // unknown state; keep info log for later analysis
|
||||||
redeem_action = 'redeemed?';
|
redeem_action = 'redeemed?';
|
||||||
console.debug(` Response 1: ${r1t}`);
|
console.debug(` Response 1: ${r1t}`);
|
||||||
const r2 = page2.waitForResponse(r => r.request().method() == 'POST' && r.url().startsWith('https://redeem.gog.com/'));
|
const r2 = page2.waitForResponse(r => r.request().method() == 'POST' && r.url().startsWith('https://redeem.gog.com/'));
|
||||||
await page2.click('[type="submit"]'); // click Redeem
|
await page2.click('[type="submit"]'); // click Redeem
|
||||||
const r2t = await (await r2).text();
|
const r2t = await (await r2).text();
|
||||||
const reason2 = JSON.parse(r2t).reason;
|
const reason2 = JSON.parse(r2t).reason;
|
||||||
if (r2t == '{}') {
|
if (r2t == '{}') {
|
||||||
redeem_action = 'redeemed';
|
redeem_action = 'redeemed';
|
||||||
|
|
@ -609,8 +609,8 @@ try {
|
||||||
} else {
|
} else {
|
||||||
notify_game.status = `claimed on ${store}`;
|
notify_game.status = `claimed on ${store}`;
|
||||||
db.data[user][title].status = 'claimed';
|
db.data[user][title].status = 'claimed';
|
||||||
}
|
}
|
||||||
await page.screenshot({ path: screenshot('external', `${filenamify(title)}.png`), fullPage: true });
|
await page.screenshot({ path: screenshot('external', `${filenamify(title)}.png`), fullPage: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await page.goto(URL_CLAIM, { waitUntil: 'domcontentloaded' });
|
await page.goto(URL_CLAIM, { waitUntil: 'domcontentloaded' });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue