Fix GrampsWeb: patch service worker to respect subpath (STI-90)
The GrampsWeb service worker was serving index.html for ALL navigation requests (including Django app routes), hijacking the entire domain. Patched sw.js at startup to: - Use subpath-prefixed index.html in createHandlerBoundToURL - Update denylist regex to match subpath API routes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -232,6 +232,12 @@ services:
|
||||
echo "[grampsweb] patched JS paths: $$f"
|
||||
fi
|
||||
done
|
||||
if [ -f /app/static/sw.js ]; then
|
||||
sed -i "s|createHandlerBoundToURL(\"/index.html\")|createHandlerBoundToURL(\"$${SUBPATH}index.html\")|g" /app/static/sw.js
|
||||
SUBPATH_BS=$$(echo "$$SUBPATH" | sed "s|/|\\\\\\\\/|g")
|
||||
sed -i "s|\\^\\\\/api|\\^$${SUBPATH_BS}api|g" /app/static/sw.js
|
||||
echo "[grampsweb] patched sw.js navigation routes"
|
||||
fi
|
||||
find /app/static -name '*.css' 2>/dev/null | while read f; do
|
||||
if grep -q '\.\./fonts/' "$$f" 2>/dev/null; then
|
||||
sed -i "s|'../fonts/|'fonts/|g" "$$f"
|
||||
|
||||
@@ -158,6 +158,12 @@ services:
|
||||
echo "[grampsweb] patched JS paths: $$f"
|
||||
fi
|
||||
done
|
||||
if [ -f /app/static/sw.js ]; then
|
||||
sed -i "s|createHandlerBoundToURL(\"/index.html\")|createHandlerBoundToURL(\"$${SUBPATH}index.html\")|g" /app/static/sw.js
|
||||
SUBPATH_BS=$$(echo "$$SUBPATH" | sed "s|/|\\\\\\\\/|g")
|
||||
sed -i "s|\\^\\\\/api|\\^$${SUBPATH_BS}api|g" /app/static/sw.js
|
||||
echo "[grampsweb] patched sw.js navigation routes"
|
||||
fi
|
||||
find /app/static -name '*.css' 2>/dev/null | while read f; do
|
||||
if grep -q '\.\./fonts/' "$$f" 2>/dev/null; then
|
||||
sed -i "s|'../fonts/|'fonts/|g" "$$f"
|
||||
|
||||
Reference in New Issue
Block a user