Further clean Sonar: merge base RUN, strip comments, node imports
All checks were successful
build-and-push / lint (push) Successful in 4s
build-and-push / sonar (push) Successful in 12s
build-and-push / docker (push) Successful in 1m13s

This commit is contained in:
nocci 2025-12-30 15:47:28 +00:00
parent 405e801851
commit 397871b012
4 changed files with 2 additions and 17 deletions

View file

@ -23,8 +23,6 @@ RUN apt-get update \
novnc websockify \
dos2unix \
python3-pip \
# && npx playwright install-deps firefox \
&& apt-get install --no-install-recommends -y \
libgtk-3-0 \
libasound2 \
libxcomposite1 \
@ -43,12 +41,8 @@ RUN apt-get update \
/usr/share/doc/* \
/var/cache/* \
/var/lib/apt/lists/* \
/var/tmp/*
# RUN node --version
# RUN npm --version
RUN useradd -ms /bin/bash fgc \
/var/tmp/* \
&& useradd -ms /bin/bash fgc \
&& ln -s /usr/share/novnc/vnc_auto.html /usr/share/novnc/index.html \
&& pip install apprise

5
gog.js
View file

@ -32,7 +32,6 @@ if (!cfg.debug) context.setDefaultTimeout(cfg.timeout);
const page = context.pages().length ? context.pages()[0] : await context.newPage(); // should always exist
await page.setViewportSize({ width: cfg.width, height: cfg.height }); // TODO workaround for https://github.com/vogler/free-games-claimer/issues/277 until Playwright fixes it
// console.debug('userAgent:', await page.evaluate(() => navigator.userAgent));
const notify_games = [];
let user;
@ -42,7 +41,6 @@ try {
await page.goto(URL_CLAIM, { waitUntil: 'domcontentloaded' }); // default 'load' takes forever
// page.click('#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowAll').catch(_ => { }); // does not work reliably, solved by setting CookieConsent above
const signIn = page.locator('a:has-text("Sign in")').first();
await Promise.any([signIn.waitFor(), page.waitForSelector('#menuUsername')]);
while (await signIn.isVisible()) {
@ -71,12 +69,9 @@ try {
await iframe.locator('#second_step_authentication_send').click();
await page.waitForTimeout(1000); // TODO still needed with wait for username below?
}).catch(_ => { });
// iframe.locator('iframe[title=reCAPTCHA]').waitFor().then(() => {
// iframe.locator('.g-recaptcha').waitFor().then(() => {
iframe.locator('text=Invalid captcha').waitFor().then(() => {
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.');
// TODO solve reCAPTCHA?
}).catch(_ => { });
await page.waitForSelector('#menuUsername');
} else {

View file

@ -6,7 +6,6 @@ const gitBin = process.env.GIT_BIN || '/usr/bin/git';
const runGit = (...args) => new Promise((resolve, reject) => {
execFile(gitBin, args, { cwd: process.cwd() }, (error, stdout, stderr) => {
if (stderr) console.error(`stderr: ${stderr}`);
// if (stdout) console.log(`stdout: ${stdout}`);
if (error) {
console.log(`error: ${error.message}`);
if (error.code === 'ENOENT' || error.message.includes('command not found')) {

View file

@ -18,7 +18,6 @@ const { fingerprint, headers } = new FingerprintGenerator().getFingerprint({
const context = await firefox.launchPersistentContext(cfg.dir.browser, {
headless: cfg.headless,
// viewport: { width: cfg.width, height: cfg.height },
locale: 'en-US', // ignore OS locale to be sure to have english text for locators -> done via /en in URL
userAgent: fingerprint.navigator.userAgent,
viewport: {
@ -29,7 +28,6 @@ const context = await firefox.launchPersistentContext(cfg.dir.browser, {
'accept-language': headers['accept-language'],
},
});
// await stealth(context);
await new FingerprintInjector().attachFingerprintToPlaywright(context, { fingerprint, headers });
context.setDefaultTimeout(cfg.debug ? 0 : cfg.timeout);
@ -61,7 +59,6 @@ try {
db.data[title] = stat;
}
// await page.pause();
} catch (error) {
process.exitCode ||= 1;
console.error('--- Exception:');