diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 183905e..f18201d 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -17,9 +17,8 @@ rm -f /fgc/data/browser/SingletonLock 2>/dev/null || true mkdir -p /fgc/data/browser # fix for 'Incorrect response' after solving a captcha correctly - https://github.com/vogler/free-games-claimer/issues/261#issuecomment-1868385830 # Only write the prefs file when the volume is writable (container runs as non-root). -if touch /fgc/data/browser/.write-test 2>/dev/null; then - rm -f /fgc/data/browser/.write-test 2>/dev/null || true - cat << 'EOT' > /fgc/data/browser/user.js 2>/dev/null || echo "Warning: failed to write /fgc/data/browser/user.js (permission issue?)." >&2 +if [ -w /fgc/data/browser ] && { [ ! -e /fgc/data/browser/user.js ] || [ -w /fgc/data/browser/user.js ] || rm -f /fgc/data/browser/user.js 2>/dev/null; }; then + cat << 'EOT' > /fgc/data/browser/user.js user_pref("privacy.resistFingerprinting", true); // user_pref("privacy.resistFingerprinting.letterboxing", true); // user_pref("browser.contentblocking.category", "strict"); @@ -57,4 +56,11 @@ echo "VNC is running on port $VNC_PORT ($pwt)" websockify -D --web "/usr/share/novnc/" $NOVNC_PORT "localhost:$VNC_PORT" 2>/dev/null 1>&2 & echo "noVNC (VNC via browser) is running on http://localhost:$NOVNC_PORT" echo + +# Ensure Playwright browsers are available (chromium + firefox). +if [ ! -x /home/fgc/.cache/ms-playwright/firefox-1482/firefox/firefox ] || ! ls /home/fgc/.cache/ms-playwright/chromium-*/*/chrome >/dev/null 2>&1; then + echo "Playwright browsers missing; installing..." + npx playwright install chromium firefox || echo "Warning: failed to install Playwright browsers" >&2 +fi + exec tini -g -- "$@" # https://github.com/krallin/tini/issues/8 node/playwright respond to signals like ctrl-c, but unsure about zombie processes