Allow frontend Docker mode to use SERVER_LIST_URL without a mounted /servers.json (#849)
Some checks are pending
Docker / e2e (push) Waiting to run
Docker / build (./Dockerfile, , ghcr.io/${{ github.repository }}) (push) Blocked by required conditions
Docker / build (./Dockerfile.alpine, -alpine, ghcr.io/${{ github.repository }}) (push) Blocked by required conditions

* Initial plan

* Fix SERVER_LIST_URL frontend startup

Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>

* test(e2e): serve remote server-list fixture with CORS

* test(e2e): reject malformed static-server paths

* fix: support SERVER_LIST_URL in classic frontend

* test: preserve existing mode test formatting

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
Co-authored-by: Stefan Stidl <sti-github@stidl.com>
This commit is contained in:
Copilot 2026-09-12 00:30:17 +02:00 • committed by GitHub
parent b8d47b24cd
commit bd8501ad13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 129 additions and 4 deletions

View file

@ -56,7 +56,7 @@ fi
# Copy servers.json for stability page (frontend/dual modes)
if [[ "$MODE" == "frontend" || "$MODE" == "dual" ]]; then
if [[ "$MODE" == "frontend" || "$MODE" == "dual" ]] && [ -f /servers.json ]; then
cp /servers.json /var/www/html/servers.json
fi
@ -91,6 +91,11 @@ if [[ "$MODE" == "frontend" || "$MODE" == "dual" || "$MODE" == "standalone" ]];
if [ -f /servers.json ]; then
echo "using mounted /servers.json for server-list.json"
cp /servers.json /var/www/html/server-list.json
elif [ -n "$SERVER_LIST_URL" ]; then
echo "no /servers.json found, relying on SERVER_LIST_URL"
elif [ "$MODE" == "frontend" ]; then
echo "ERROR: /servers.json not found and SERVER_LIST_URL is not set" >&2
exit 1
else
echo "no /servers.json found, create one for local host"
# generate config for just the local server
@ -100,7 +105,7 @@ if [[ "$MODE" == "frontend" || "$MODE" == "dual" || "$MODE" == "standalone" ]];
echo "using SERVER_LIST_URL for frontend server list"
SERVER_LIST_URL_ESCAPED=$(printf '%s\n' "$SERVER_LIST_URL" | sed 's/[&/\\]/\\&/g; s/\$/\\$/g')
sed -i "s/var SPEEDTEST_SERVERS = \"server-list.json\";/var SPEEDTEST_SERVERS = \"$SERVER_LIST_URL_ESCAPED\";/" /var/www/html/index-modern.html
sed -i "s/var SPEEDTEST_SERVERS = \\[/var SPEEDTEST_SERVERS = \"$SERVER_LIST_URL_ESCAPED\";\\n\\t\\t\\/\\*/" /var/www/html/index-classic.html
sed -i "/var SPEEDTEST_SERVERS = \\[/,/^[[:space:]]*];/c\\\t\tvar SPEEDTEST_SERVERS = \"$SERVER_LIST_URL_ESCAPED\";" /var/www/html/index-classic.html
sed -i "s/var SPEEDTEST_SERVERS = \"server-list.json\";/var SPEEDTEST_SERVERS = \"$SERVER_LIST_URL_ESCAPED\";/" /var/www/html/stability.html
fi