fix: fallback writable firefox profile
This commit is contained in:
parent
488a050f00
commit
e6c43c8de6
1 changed files with 15 additions and 6 deletions
|
|
@ -17,23 +17,32 @@ fi
|
||||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=367048
|
# https://bugs.chromium.org/p/chromium/issues/detail?id=367048
|
||||||
rm -f /fgc/data/browser/SingletonLock 2>/dev/null || true
|
rm -f /fgc/data/browser/SingletonLock 2>/dev/null || true
|
||||||
|
|
||||||
|
# Firefox profile directory (persistent if writable; fallback to cache when bind-mount is read-only).
|
||||||
|
BROWSER_DIR=/fgc/data/browser
|
||||||
|
if [ ! -w "$BROWSER_DIR" ]; then
|
||||||
|
echo "Warning: $BROWSER_DIR not writable; using fallback profile at /home/fgc/.cache/browser"
|
||||||
|
BROWSER_DIR=/home/fgc/.cache/browser
|
||||||
|
mkdir -p "$BROWSER_DIR"
|
||||||
|
chown 1000:1000 "$BROWSER_DIR" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
mkdir -p "$BROWSER_DIR"
|
||||||
|
# clean up stale firefox locks that can trigger "already running"
|
||||||
|
rm -f "$BROWSER_DIR"/parent.lock "$BROWSER_DIR"/lock "$BROWSER_DIR"/.parentlock 2>/dev/null || true
|
||||||
# Firefox preferences are stored in $BROWSER_DIR/pref.js and can be overridden by a file user.js
|
# Firefox preferences are stored in $BROWSER_DIR/pref.js and can be overridden by a file user.js
|
||||||
# Since this file has to be in the volume (data/browser), we can't do this in Dockerfile.
|
# Since this file has to be in the volume (data/browser), we can't do this in Dockerfile.
|
||||||
mkdir -p /fgc/data/browser
|
|
||||||
# clean up stale firefox locks that can trigger "already running"
|
|
||||||
rm -f /fgc/data/browser/parent.lock /fgc/data/browser/lock /fgc/data/browser/.parentlock 2>/dev/null || true
|
|
||||||
# fix for 'Incorrect response' after solving a captcha correctly - https://github.com/vogler/free-games-claimer/issues/261#issuecomment-1868385830
|
# 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).
|
# Only write the prefs file when the volume is writable (container runs as non-root).
|
||||||
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
|
if [ -w "$BROWSER_DIR" ] && { [ ! -e "$BROWSER_DIR/user.js" ] || [ -w "$BROWSER_DIR/user.js" ] || rm -f "$BROWSER_DIR/user.js" 2>/dev/null; }; then
|
||||||
cat << 'EOT' > /fgc/data/browser/user.js
|
cat << 'EOT' > "$BROWSER_DIR/user.js"
|
||||||
user_pref("privacy.resistFingerprinting", true);
|
user_pref("privacy.resistFingerprinting", true);
|
||||||
// user_pref("privacy.resistFingerprinting.letterboxing", true);
|
// user_pref("privacy.resistFingerprinting.letterboxing", true);
|
||||||
// user_pref("browser.contentblocking.category", "strict");
|
// user_pref("browser.contentblocking.category", "strict");
|
||||||
// user_pref("webgl.disabled", true);
|
// user_pref("webgl.disabled", true);
|
||||||
EOT
|
EOT
|
||||||
else
|
else
|
||||||
echo "Warning: /fgc/data/browser not writable; skipping user.js creation."
|
echo "Warning: $BROWSER_DIR not writable; skipping user.js creation."
|
||||||
fi
|
fi
|
||||||
|
export BROWSER_DIR
|
||||||
# TODO disable session restore message?
|
# TODO disable session restore message?
|
||||||
|
|
||||||
# Remove X server display lock, fix for `docker compose up` which reuses container which made it fail after initial run, https://github.com/vogler/free-games-claimer/issues/31
|
# Remove X server display lock, fix for `docker compose up` which reuses container which made it fail after initial run, https://github.com/vogler/free-games-claimer/issues/31
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue