Further clean Sonar: merge base RUN, strip comments, node imports
This commit is contained in:
parent
405e801851
commit
397871b012
4 changed files with 2 additions and 17 deletions
10
Dockerfile
10
Dockerfile
|
|
@ -23,8 +23,6 @@ RUN apt-get update \
|
||||||
novnc websockify \
|
novnc websockify \
|
||||||
dos2unix \
|
dos2unix \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
# && npx playwright install-deps firefox \
|
|
||||||
&& apt-get install --no-install-recommends -y \
|
|
||||||
libgtk-3-0 \
|
libgtk-3-0 \
|
||||||
libasound2 \
|
libasound2 \
|
||||||
libxcomposite1 \
|
libxcomposite1 \
|
||||||
|
|
@ -43,12 +41,8 @@ RUN apt-get update \
|
||||||
/usr/share/doc/* \
|
/usr/share/doc/* \
|
||||||
/var/cache/* \
|
/var/cache/* \
|
||||||
/var/lib/apt/lists/* \
|
/var/lib/apt/lists/* \
|
||||||
/var/tmp/*
|
/var/tmp/* \
|
||||||
|
&& useradd -ms /bin/bash fgc \
|
||||||
# RUN node --version
|
|
||||||
# RUN npm --version
|
|
||||||
|
|
||||||
RUN useradd -ms /bin/bash fgc \
|
|
||||||
&& ln -s /usr/share/novnc/vnc_auto.html /usr/share/novnc/index.html \
|
&& ln -s /usr/share/novnc/vnc_auto.html /usr/share/novnc/index.html \
|
||||||
&& pip install apprise
|
&& pip install apprise
|
||||||
|
|
||||||
|
|
|
||||||
5
gog.js
5
gog.js
|
|
@ -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
|
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
|
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 = [];
|
const notify_games = [];
|
||||||
let user;
|
let user;
|
||||||
|
|
@ -42,7 +41,6 @@ try {
|
||||||
|
|
||||||
await page.goto(URL_CLAIM, { waitUntil: 'domcontentloaded' }); // default 'load' takes forever
|
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();
|
const signIn = page.locator('a:has-text("Sign in")').first();
|
||||||
await Promise.any([signIn.waitFor(), page.waitForSelector('#menuUsername')]);
|
await Promise.any([signIn.waitFor(), page.waitForSelector('#menuUsername')]);
|
||||||
while (await signIn.isVisible()) {
|
while (await signIn.isVisible()) {
|
||||||
|
|
@ -71,12 +69,9 @@ try {
|
||||||
await iframe.locator('#second_step_authentication_send').click();
|
await iframe.locator('#second_step_authentication_send').click();
|
||||||
await page.waitForTimeout(1000); // TODO still needed with wait for username below?
|
await page.waitForTimeout(1000); // TODO still needed with wait for username below?
|
||||||
}).catch(_ => { });
|
}).catch(_ => { });
|
||||||
// iframe.locator('iframe[title=reCAPTCHA]').waitFor().then(() => {
|
|
||||||
// iframe.locator('.g-recaptcha').waitFor().then(() => {
|
|
||||||
iframe.locator('text=Invalid captcha').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.');
|
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.');
|
notify('gog: got captcha during login. Please check.');
|
||||||
// TODO solve reCAPTCHA?
|
|
||||||
}).catch(_ => { });
|
}).catch(_ => { });
|
||||||
await page.waitForSelector('#menuUsername');
|
await page.waitForSelector('#menuUsername');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ const gitBin = process.env.GIT_BIN || '/usr/bin/git';
|
||||||
const runGit = (...args) => new Promise((resolve, reject) => {
|
const runGit = (...args) => new Promise((resolve, reject) => {
|
||||||
execFile(gitBin, args, { cwd: process.cwd() }, (error, stdout, stderr) => {
|
execFile(gitBin, args, { cwd: process.cwd() }, (error, stdout, stderr) => {
|
||||||
if (stderr) console.error(`stderr: ${stderr}`);
|
if (stderr) console.error(`stderr: ${stderr}`);
|
||||||
// if (stdout) console.log(`stdout: ${stdout}`);
|
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log(`error: ${error.message}`);
|
console.log(`error: ${error.message}`);
|
||||||
if (error.code === 'ENOENT' || error.message.includes('command not found')) {
|
if (error.code === 'ENOENT' || error.message.includes('command not found')) {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ const { fingerprint, headers } = new FingerprintGenerator().getFingerprint({
|
||||||
|
|
||||||
const context = await firefox.launchPersistentContext(cfg.dir.browser, {
|
const context = await firefox.launchPersistentContext(cfg.dir.browser, {
|
||||||
headless: cfg.headless,
|
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
|
locale: 'en-US', // ignore OS locale to be sure to have english text for locators -> done via /en in URL
|
||||||
userAgent: fingerprint.navigator.userAgent,
|
userAgent: fingerprint.navigator.userAgent,
|
||||||
viewport: {
|
viewport: {
|
||||||
|
|
@ -29,7 +28,6 @@ const context = await firefox.launchPersistentContext(cfg.dir.browser, {
|
||||||
'accept-language': headers['accept-language'],
|
'accept-language': headers['accept-language'],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// await stealth(context);
|
|
||||||
await new FingerprintInjector().attachFingerprintToPlaywright(context, { fingerprint, headers });
|
await new FingerprintInjector().attachFingerprintToPlaywright(context, { fingerprint, headers });
|
||||||
|
|
||||||
context.setDefaultTimeout(cfg.debug ? 0 : cfg.timeout);
|
context.setDefaultTimeout(cfg.debug ? 0 : cfg.timeout);
|
||||||
|
|
@ -61,7 +59,6 @@ try {
|
||||||
db.data[title] = stat;
|
db.data[title] = stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
// await page.pause();
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
process.exitCode ||= 1;
|
process.exitCode ||= 1;
|
||||||
console.error('--- Exception:');
|
console.error('--- Exception:');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue