chore: make version banner configurable and speed up login waits
This commit is contained in:
parent
34e8d92b05
commit
133502ff94
4 changed files with 13 additions and 4 deletions
|
|
@ -2,8 +2,13 @@
|
||||||
|
|
||||||
set -eo pipefail # exit on error, error on any fail in pipe (not just last cmd); add -x to print each cmd; see gist bash_strict_mode.md
|
set -eo pipefail # exit on error, error on any fail in pipe (not just last cmd); add -x to print each cmd; see gist bash_strict_mode.md
|
||||||
|
|
||||||
echo "Version: https://github.com/vogler/free-games-claimer/tree/${COMMIT}"
|
REPO_URL=${REPO_URL:-https://git.sky-net.it/nocci/free-games-claimer}
|
||||||
[ ! -z $BRANCH ] && [ $BRANCH != "main" ] && echo "Branch: ${BRANCH}"
|
if [ -n "$COMMIT" ]; then
|
||||||
|
echo "Version: ${REPO_URL}/tree/${COMMIT}"
|
||||||
|
else
|
||||||
|
echo "Version: ${REPO_URL}"
|
||||||
|
fi
|
||||||
|
[ -n "$BRANCH" ] && [ "$BRANCH" != "main" ] && echo "Branch: ${BRANCH}"
|
||||||
echo "Build: $NOW"
|
echo "Build: $NOW"
|
||||||
|
|
||||||
# Ensure writable data dir for fgc when host bind-mount is owned by root.
|
# Ensure writable data dir for fgc when host bind-mount is owned by root.
|
||||||
|
|
|
||||||
5
gog.js
5
gog.js
|
|
@ -42,7 +42,10 @@ try {
|
||||||
await page.goto(URL_CLAIM, { waitUntil: 'domcontentloaded' }); // default 'load' takes forever
|
await page.goto(URL_CLAIM, { waitUntil: 'domcontentloaded' }); // default 'load' takes forever
|
||||||
|
|
||||||
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({ timeout: cfg.login_visible_timeout }),
|
||||||
|
page.waitForSelector('#menuUsername', { timeout: cfg.login_visible_timeout }),
|
||||||
|
]).catch(() => {});
|
||||||
while (await signIn.isVisible()) {
|
while (await signIn.isVisible()) {
|
||||||
console.error('Not signed in anymore.');
|
console.error('Not signed in anymore.');
|
||||||
await signIn.click();
|
await signIn.click();
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ try {
|
||||||
'button:has-text("Anmelden")',
|
'button:has-text("Anmelden")',
|
||||||
'[data-a-target="user-dropdown-first-name-text"]',
|
'[data-a-target="user-dropdown-first-name-text"]',
|
||||||
'[data-testid="user-dropdown-first-name-text"]',
|
'[data-testid="user-dropdown-first-name-text"]',
|
||||||
].map(s => page.waitForSelector(s)));
|
].map(s => page.waitForSelector(s, { timeout: cfg.login_visible_timeout }))).catch(() => {});
|
||||||
try {
|
try {
|
||||||
await page.click('[aria-label="Cookies usage disclaimer banner"] button:has-text("Accept Cookies")'); // to not waste screen space when non-headless; could be flaky
|
await page.click('[aria-label="Cookies usage disclaimer banner"] button:has-text("Accept Cookies")'); // to not waste screen space when non-headless; could be flaky
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ export const cfg = {
|
||||||
height: Number(process.env.HEIGHT) || 1080, // height of the opened browser
|
height: Number(process.env.HEIGHT) || 1080, // height of the opened browser
|
||||||
timeout: (Number(process.env.TIMEOUT) || 60) * 1000, // default timeout for playwright is 30s
|
timeout: (Number(process.env.TIMEOUT) || 60) * 1000, // default timeout for playwright is 30s
|
||||||
login_timeout: (Number(process.env.LOGIN_TIMEOUT) || 180) * 1000, // higher timeout for login, will wait twice: prompt + wait for manual login
|
login_timeout: (Number(process.env.LOGIN_TIMEOUT) || 180) * 1000, // higher timeout for login, will wait twice: prompt + wait for manual login
|
||||||
|
login_visible_timeout: (Number(process.env.LOGIN_VISIBLE_TIMEOUT) || 20) * 1000, // how long to wait for login button/user indicator to appear
|
||||||
novnc_port: process.env.NOVNC_PORT, // running in docker if set
|
novnc_port: process.env.NOVNC_PORT, // running in docker if set
|
||||||
notify: process.env.NOTIFY, // apprise notification services
|
notify: process.env.NOTIFY, // apprise notification services
|
||||||
notify_title: process.env.NOTIFY_TITLE, // apprise notification title
|
notify_title: process.env.NOTIFY_TITLE, // apprise notification title
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue