Files
claudeandClaude Opus 5.5 f9c7a7468b Fix black text in Firefox ESR (no CSS @scope)
Funkwhale 2.x defines --color-foreground-* and --color-background-* only
inside two @scope blocks in fw.css. Firefox ESR 140 has no @scope, so
every color: var(--color-foreground-N) was invalid and text fell back to
black on the Mocha background. files/compat.js marks such browsers with
html.no-css-scope, and catppuccin.css supplies the same positive and
negative mappings as plain selectors there. Chromium is unaffected.

The API pod now also restarts when the theme changes, because it caches
the front's index.html for 15 minutes for the pages it renders itself.
Destructive buttons and the old teal count badges get exact Catppuccin
colours.

Checked with headless Firefox ESR 140 and Chromium against a local copy
with test content: nothing below 4.5:1 in dark mode on the home,
library, album, artist, profile, search, settings, notifications and
admin pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 16:15:20 -05:00

27 lines
1.4 KiB
Bash

#!/bin/sh
# SPDX-License-Identifier: MIT-0
# Front image hook (/docker-entrypoint.d/99-eom-theme.sh, after the
# funkwhale-oidc hook at 98-): link the eom.dev
# Catppuccin stylesheet from index.html, so it applies on first paint rather
# than after the instance settings load. The query string busts caches when
# the stylesheet changes.
set -eu
index=/usr/share/nginx/html/index.html
if ! grep -q '/eom/catppuccin.css' "$index"; then
v=$(md5sum /usr/share/nginx/html/eom/catppuccin.css | cut -c1-12)
c=$(md5sum /usr/share/nginx/html/eom/compat.js | cut -c1-12)
# compat.js is a blocking script so the class is set before first paint.
sed -i "s|</head>|<script src=\"/eom/compat.js?v=$c\"></script><link rel=\"stylesheet\" href=\"/eom/catppuccin.css?v=$v\"></head>|" "$index"
echo "eom.dev: Catppuccin stylesheet linked from $index"
fi
# The web app's service worker precaches index.html by the revision in its
# manifest; without a new revision, returning visitors keep the old page.
# This hook runs after the funkwhale-oidc one (98-), so it covers both edits.
sw=/usr/share/nginx/html/serviceWorker.js
if [ -f "$sw" ]; then
rev=$(md5sum "$index" | cut -c1-32)
sed -i "s|\"revision\":\"[0-9a-f]*\",\"url\":\"index.html\"|\"revision\":\"$rev\",\"url\":\"index.html\"|" "$sw"
grep -q "\"revision\":\"$rev\",\"url\":\"index.html\"" "$sw" && echo "eom.dev: service worker revision for index.html set to $rev"
fi