sonarcloud fixes
This commit is contained in:
parent
b5ef699f4f
commit
e5935faa13
4 changed files with 2 additions and 20 deletions
|
|
@ -64,7 +64,7 @@ RUN npm install
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Shell scripts need Linux line endings. On Windows, git might be configured to check out dos/CRLF line endings, so we convert them for those people in case they want to build the image. They could also use --config core.autocrlf=input
|
# Shell scripts need Linux line endings. On Windows, git might be configured to check out dos/CRLF line endings, so we convert them for those people in case they want to build the image. They could also use --config core.autocrlf=input
|
||||||
RUN dos2unix *.sh && chmod +x *.sh
|
RUN dos2unix ./*.sh && chmod +x ./*.sh
|
||||||
COPY docker-entrypoint.sh /usr/local/bin/
|
COPY docker-entrypoint.sh /usr/local/bin/
|
||||||
|
|
||||||
ARG COMMIT=""
|
ARG COMMIT=""
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ try {
|
||||||
// {"reason":"Invalid or no captcha"}
|
// {"reason":"Invalid or no captcha"}
|
||||||
// {"reason":"code_used"}
|
// {"reason":"code_used"}
|
||||||
// {"reason":"code_not_found"}
|
// {"reason":"code_not_found"}
|
||||||
if (reason && reason.includes('captcha')) {
|
if (reason?.includes('captcha')) {
|
||||||
redeem_action = 'redeem (got captcha)';
|
redeem_action = 'redeem (got captcha)';
|
||||||
console.error(' Got captcha; could not redeem!');
|
console.error(' Got captcha; could not redeem!');
|
||||||
} else if (reason == 'code_used') {
|
} else if (reason == 'code_used') {
|
||||||
|
|
@ -228,7 +228,6 @@ try {
|
||||||
console.log(' Redeemed successfully.');
|
console.log(' Redeemed successfully.');
|
||||||
db.data[user][title].status = 'claimed and redeemed';
|
db.data[user][title].status = 'claimed and redeemed';
|
||||||
} else {
|
} else {
|
||||||
redeem_action = 'redeemed?';
|
|
||||||
console.debug(` Response 2: ${r2t}`);
|
console.debug(` Response 2: ${r2t}`);
|
||||||
console.log(' Unknown Response 2 - please report in https://github.com/vogler/free-games-claimer/issues/5');
|
console.log(' Unknown Response 2 - please report in https://github.com/vogler/free-games-claimer/issues/5');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
15
util.js
15
util.js
|
|
@ -27,21 +27,6 @@ export const handleSIGINT = (context = null) => process.on('SIGINT', async () =>
|
||||||
if (context) await context.close(); // in order to save recordings also on SIGINT, we need to disable Playwright's handleSIGINT and close the context ourselves
|
if (context) await context.close(); // in order to save recordings also on SIGINT, we need to disable Playwright's handleSIGINT and close the context ourselves
|
||||||
});
|
});
|
||||||
|
|
||||||
// stealth with playwright: https://github.com/berstend/puppeteer-extra/issues/454#issuecomment-917437212
|
|
||||||
// gets userAgent and then removes "Headless" from it
|
|
||||||
const newStealthContext = async (browser, contextOptions = {}, debug = false) => {
|
|
||||||
if (!debug) { // only need to fix userAgent in headless mode
|
|
||||||
const dummyContext = await browser.newContext();
|
|
||||||
const originalUserAgent = await (await dummyContext.newPage()).evaluate(() => navigator.userAgent);
|
|
||||||
await dummyContext.close();
|
|
||||||
// console.log('originalUserAgent:', originalUserAgent); // Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/96.0.4664.110 Safari/537.36
|
|
||||||
contextOptions = {
|
|
||||||
...contextOptions,
|
|
||||||
userAgent: originalUserAgent.replace("Headless", ""), // HeadlessChrome -> Chrome, TODO needed?
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const stealth = async (context) => {
|
export const stealth = async (context) => {
|
||||||
// stealth with playwright: https://github.com/berstend/puppeteer-extra/issues/454#issuecomment-917437212
|
// stealth with playwright: https://github.com/berstend/puppeteer-extra/issues/454#issuecomment-917437212
|
||||||
// https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth/evasions
|
// https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth/evasions
|
||||||
|
|
|
||||||
2
xbox.js
2
xbox.js
|
|
@ -8,8 +8,6 @@ import {
|
||||||
notify,
|
notify,
|
||||||
prompt,
|
prompt,
|
||||||
} from "./util.js";
|
} from "./util.js";
|
||||||
import path from "path";
|
|
||||||
import { existsSync, writeFileSync } from "fs";
|
|
||||||
import { cfg } from "./config.js";
|
import { cfg } from "./config.js";
|
||||||
|
|
||||||
// ### SETUP
|
// ### SETUP
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue