Fix 404s: serve UI templates/static from configurable ui-root, not CWD

The web UI 404'd in production because templates/static were loaded
via relative paths ("internal/ui/templates", "internal/ui/static"),
which only resolved when running from the repo checkout. systemd sets
WorkingDirectory=/var/lib/wireguard-ui-multi, so those paths never
existed there.

Add a -ui-root flag (default /usr/local/share/wireguard-ui-multi/ui),
have install.sh copy internal/ui there, and resolve templates/static
paths through it instead of hardcoded relative strings.

Also add release-binary fast path to bootstrap.sh (falls back to
source build with CGO_ENABLED=0/-trimpath if no release exists yet),
and document real hardware/build-RAM requirements in the README.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
sysops
2026-07-10 18:18:48 +02:00
co-authored by Claude Sonnet 5
parent b2b6b82f58
commit 41894e67c6
8 changed files with 91 additions and 38 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ fi
echo "Rebuilding..."
cd "$SRC_DIR"
go mod tidy
go build -o wireguard-ui-multi ./cmd/wireguard-ui-multi
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o wireguard-ui-multi ./cmd/wireguard-ui-multi
echo "Reinstalling..."
bash scripts/install.sh