Skip to content

Point classic UI at mounted /servers.json in Docker entrypoint - #870

Merged
sstidl merged 5 commits into
masterfrom
copilot/fix-index-classic-html-server-list
Oct 22, 2026
Merged

sstidl merged 5 commits into
masterfrom
copilot/fix-index-classic-html-server-list

Conversation

Copilot AI commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

In Docker, mounting /servers.json without setting SERVER_LIST_URL produced a server dropdown in the modern UI but not in index-classic.html. The classic page ships with an empty SPEEDTEST_SERVERS array, so it ran as a standalone install and never loaded the list.

  • Cause: docker/entrypoint.sh only rewrote index-classic.html inside the SERVER_LIST_URL branch. The mounted-file branch copied /servers.json to server-list.json, which the modern page loads by default, but left classic untouched.
  • Fix: In the /servers.json branch, when SERVER_LIST_URL is empty, run the same range sed used for SERVER_LIST_URL to replace the array with "server-list.json":
if [ -z "$SERVER_LIST_URL" ]; then
  sed -i "/var SPEEDTEST_SERVERS = \\[/,/^[[:space:]]*];/c\\\t\tvar SPEEDTEST_SERVERS = \"server-list.json\";" /var/www/html/index-classic.html
fi
  • Behavior:
    • SERVER_LIST_URL still takes precedence. Its existing sed runs later and overwrites this value.
    • Standalone installs with no mounted file are unchanged. The server-list.json generated for the local backend is not wired into classic, so the standalone classic regression test is unaffected.

No test is included. The existing Playwright tests use the Docker stack, so this likely needs an E2E case that mounts servers.json without SERVER_LIST_URL and asserts that the classic page shows the server dropdown. I only checked the sed against GNU sed. The Alpine image uses busybox sed, so the c\ handling there should be confirmed.

Copilot AI linked an issue Oct 21, 2026 that may be closed by this pull request
Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix index-classic.html to recognize defined server list Point classic UI at mounted /servers.json in Docker entrypoint Oct 21, 2026
Copilot AI requested a review from sstidl October 21, 2026 22:18
Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>

@sstidl sstidl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SERVER_LIST_URL must be used

Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
Comment thread tests/e2e/classic-server-list.spec.js
@sstidl
sstidl marked this pull request as ready for review October 21, 2026 23:04
Copilot AI balanced review requested due to automatic review settings October 21, 2026 23:04
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Load mounted Docker server lists in the classic UI

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Default the classic UI to the mounted server list when no URL is configured.
• Preserve explicit SERVER_LIST_URL overrides and standalone behavior without a mount.
• Add a Docker-backed browser test for list loading and server selection.
Diagram

graph TD
  mount["Mounted servers.json"] --> entry["Docker entrypoint"] --> classic["Classic HTML"] --> browser["Classic browser"] --> list["Served server list"] --> selector["Server dropdown"]
  entry --> list
Loading
High-Level Assessment

Reusing the existing SERVER_LIST_URL rewrite keeps mounted-file and explicit-URL handling in one path. A separate rewrite in the mounted-file branch would duplicate that logic without changing the intended behavior.

Files changed (2) +31 / -0

Bug fix (1) +2 / -0
entrypoint.shDefault mounted lists into the frontend URL setting +2/-0

Default mounted lists into the frontend URL setting

• After copying a mounted /servers.json to server-list.json, defaults SERVER_LIST_URL to that local file only when the variable is unset. The existing rewrite then configures the classic page, while an explicit URL retains precedence.

docker/entrypoint.sh

Tests (1) +29 / -0
classic-server-list.spec.jsCover classic server selection from a mounted list +29/-0

Cover classic server selection from a mounted list

• Adds a Playwright test against the Docker frontend fixture that checks the rewritten HTML, successful list fetch, populated selector, and absence of page errors. It intercepts the backend ping to make server selection deterministic.

tests/e2e/classic-server-list.spec.js

@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can start a comment with 'qodo' or '@qodo' to chat about any finding

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fallback preserves explicit URL precedence and unmounted standalone behavior, with regression coverage and no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes #841 by making the classic Docker UI load a mounted /servers.json through the existing server-list URL handling.

Changes:

  • Defaults SERVER_LIST_URL to server-list.json when a mounted list exists, preserving explicit URL overrides.
  • Adds a regression test that verifies the classic page fetches the list and populates its server selector.
File Description
tests/​e2e/​classic-server-list.spec.js Tests mounted-list loading and classic server selection.
docker/​entrypoint.sh Routes mounted server lists through existing URL configuration.

Review effort: Balanced

@sstidl
sstidl merged commit 4cf44ad into master Oct 22, 2026
4 checks passed
@sstidl
sstidl deleted the copilot/fix-index-classic-html-server-list branch October 22, 2026 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

index-classic.html ignores defined server list

3 participants