Read Gitea's base theme over HTTP, not from its filesystem
The install script read /app/gitea/public/assets/css/theme-gitea-light.css out of the container. The official image compiles its static assets into the gitea binary, so that path does not exist and the script could never have worked — it would have failed on its own "could not read Gitea's own theme" check, which at least pointed somewhere, but at the wrong thing entirely. Fetching the file from the running server instead works whether the assets are embedded or on disk, and has the better property besides: what the server serves is by definition the version that is running, which is the whole reason the base is not kept in this repository. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
This commit is contained in:
parent
724dada3f4
commit
acf3f745ff
@ -18,6 +18,8 @@ set -euo pipefail
|
|||||||
GITEA_DIR="${GITEA_DIR:-/srv/gitea}"
|
GITEA_DIR="${GITEA_DIR:-/srv/gitea}"
|
||||||
REPO_DIR="${REPO_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
|
REPO_DIR="${REPO_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
|
||||||
SERVICE="${SERVICE:-gitea}"
|
SERVICE="${SERVICE:-gitea}"
|
||||||
|
# Gitea is published on localhost by infra/gitea/docker-compose.yml.
|
||||||
|
GITEA_LOCAL="${GITEA_LOCAL:-http://127.0.0.1:3000}"
|
||||||
|
|
||||||
OVERRIDES="$REPO_DIR/infra/gitea/theme-vienalatina.overrides.css"
|
OVERRIDES="$REPO_DIR/infra/gitea/theme-vienalatina.overrides.css"
|
||||||
LOGO="$REPO_DIR/infra/gitea/assets/logo.svg"
|
LOGO="$REPO_DIR/infra/gitea/assets/logo.svg"
|
||||||
@ -32,12 +34,17 @@ done
|
|||||||
|
|
||||||
echo "== reading the installed Gitea's light theme"
|
echo "== reading the installed Gitea's light theme"
|
||||||
cd "$GITEA_DIR"
|
cd "$GITEA_DIR"
|
||||||
BASE="$(docker compose exec -T "$SERVICE" \
|
|
||||||
cat /app/gitea/public/assets/css/theme-gitea-light.css)"
|
# Over HTTP rather than out of the container's filesystem. The official image
|
||||||
|
# compiles its static assets into the gitea binary, so there is no
|
||||||
|
# /app/gitea/public/assets/css to read — but the server still serves the file,
|
||||||
|
# and what it serves is by definition the version that is running.
|
||||||
|
BASE="$(curl -fsS "$GITEA_LOCAL/assets/css/theme-gitea-light.css" || true)"
|
||||||
|
|
||||||
if [ -z "$BASE" ]; then
|
if [ -z "$BASE" ]; then
|
||||||
echo "Could not read Gitea's own theme — is the container running?" >&2
|
echo "Could not read Gitea's own theme from $GITEA_LOCAL." >&2
|
||||||
echo "Check with: cd $GITEA_DIR && docker compose ps" >&2
|
echo "Is the container up? cd $GITEA_DIR && docker compose ps" >&2
|
||||||
|
echo "Different port? GITEA_LOCAL=http://127.0.0.1:PORT bash \$0" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user