Improve GrampsWeb base href patching: find all index.html copies (STI-90)
The previous sed only patched two known paths. Now uses find to discover and patch all index.html files containing <base href="/"> across the entire container, with logging to show which files were patched. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
13
compose.yml
13
compose.yml
@@ -209,12 +209,15 @@ services:
|
|||||||
- |
|
- |
|
||||||
if [ -n "$$GRAMPSWEB_SUBPATH" ] && [ "$$GRAMPSWEB_SUBPATH" != "/" ]; then
|
if [ -n "$$GRAMPSWEB_SUBPATH" ] && [ "$$GRAMPSWEB_SUBPATH" != "/" ]; then
|
||||||
SUBPATH="$$GRAMPSWEB_SUBPATH"
|
SUBPATH="$$GRAMPSWEB_SUBPATH"
|
||||||
# Ensure trailing slash for base href
|
|
||||||
case "$$SUBPATH" in */) ;; *) SUBPATH="$${SUBPATH}/" ;; esac
|
case "$$SUBPATH" in */) ;; *) SUBPATH="$${SUBPATH}/" ;; esac
|
||||||
sed -i "s|<base href=\"/\">|<base href=\"$$SUBPATH\">|g" \
|
echo "[grampsweb] Patching <base href> to $$SUBPATH ..."
|
||||||
/app/src/gramps_webapi/static/index.html \
|
find / -name index.html -path "*/gramps*" -o -name index.html -path "*/static/*" 2>/dev/null | while read f; do
|
||||||
/app/static/index.html 2>/dev/null || true
|
if grep -q '<base href="/">' "$$f" 2>/dev/null; then
|
||||||
echo "Patched <base href> to $$SUBPATH"
|
sed -i "s|<base href=\"/\">|<base href=\"$$SUBPATH\">|g" "$$f"
|
||||||
|
echo "[grampsweb] patched: $$f"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "[grampsweb] Done."
|
||||||
fi
|
fi
|
||||||
exec gunicorn -w $${GUNICORN_NUM_WORKERS:-8} -b 0.0.0.0:5000 \
|
exec gunicorn -w $${GUNICORN_NUM_WORKERS:-8} -b 0.0.0.0:5000 \
|
||||||
gramps_webapi.wsgi:app --timeout $${GUNICORN_TIMEOUT:-120} \
|
gramps_webapi.wsgi:app --timeout $${GUNICORN_TIMEOUT:-120} \
|
||||||
|
|||||||
@@ -136,10 +136,14 @@ services:
|
|||||||
if [ -n "$$GRAMPSWEB_SUBPATH" ] && [ "$$GRAMPSWEB_SUBPATH" != "/" ]; then
|
if [ -n "$$GRAMPSWEB_SUBPATH" ] && [ "$$GRAMPSWEB_SUBPATH" != "/" ]; then
|
||||||
SUBPATH="$$GRAMPSWEB_SUBPATH"
|
SUBPATH="$$GRAMPSWEB_SUBPATH"
|
||||||
case "$$SUBPATH" in */) ;; *) SUBPATH="$${SUBPATH}/" ;; esac
|
case "$$SUBPATH" in */) ;; *) SUBPATH="$${SUBPATH}/" ;; esac
|
||||||
sed -i "s|<base href=\"/\">|<base href=\"$$SUBPATH\">|g" \
|
echo "[grampsweb] Patching <base href> to $$SUBPATH ..."
|
||||||
/app/src/gramps_webapi/static/index.html \
|
find / -name index.html -path "*/gramps*" -o -name index.html -path "*/static/*" 2>/dev/null | while read f; do
|
||||||
/app/static/index.html 2>/dev/null || true
|
if grep -q '<base href="/">' "$$f" 2>/dev/null; then
|
||||||
echo "Patched <base href> to $$SUBPATH"
|
sed -i "s|<base href=\"/\">|<base href=\"$$SUBPATH\">|g" "$$f"
|
||||||
|
echo "[grampsweb] patched: $$f"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "[grampsweb] Done."
|
||||||
fi
|
fi
|
||||||
exec gunicorn -w $${GUNICORN_NUM_WORKERS:-8} -b 0.0.0.0:5000 \
|
exec gunicorn -w $${GUNICORN_NUM_WORKERS:-8} -b 0.0.0.0:5000 \
|
||||||
gramps_webapi.wsgi:app --timeout $${GUNICORN_TIMEOUT:-120} \
|
gramps_webapi.wsgi:app --timeout $${GUNICORN_TIMEOUT:-120} \
|
||||||
|
|||||||
Reference in New Issue
Block a user