Skip to content

Add feature switch for new design via config file, URL parameters, and Docker#742

Merged
sstidl merged 10 commits intonewdesignfrom
copilot/add-feature-switch-for-design
Dec 29, 2025
Merged

Add feature switch for new design via config file, URL parameters, and Docker#742
sstidl merged 10 commits intonewdesignfrom
copilot/add-feature-switch-for-design

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 28, 2025

User description

Implements a toggle mechanism to enable the new frontend design while keeping the classic design as default. Supports both standalone deployments and Docker containers.

Both designs are placed at root level to ensure correct relative paths to shared resources like backend/ and results/. In Docker containers, frontend assets are flattened to eliminate the frontend/ parent directory.

Changes

  • config.json: Site-wide setting (useNewDesign: false by default)
  • design-switch.js: Client-side redirect logic with priority: URL params → config → default (old design)
  • DESIGN_SWITCH.md: Usage documentation
  • index.html: Lightweight entry point that loads design switcher
  • index-classic.html: Classic design at root level
  • index-modern.html: Modern design at root level (references assets from subdirectories)
  • frontend/index.html: Unchanged for non-Docker deployments
  • Dockerfile & Dockerfile.alpine: Copy design switch files and both design HTML files
  • docker/entrypoint.sh: Handle design switch setup, USE_NEW_DESIGN environment variable, and flatten frontend assets to root subdirectories in Docker
  • doc_docker.md: Document new USE_NEW_DESIGN environment variable

Architecture

Non-Docker Deployments

  • Both index-classic.html and index-modern.html at root
  • Modern design references assets from frontend/ subdirectory
  • Both designs access backend/ and results/ with same relative paths

Docker Deployments

  • Both index-classic.html and index-modern.html at root
  • Frontend assets flattened to root subdirectories: styling/, javascript/, images/, fonts/
  • No frontend/ parent directory in containers
  • Both designs access backend/ and results/ with same relative paths

Usage

Non-Docker Deployments

// config.json - enable new design site-wide
{
  "useNewDesign": true
}
// URL override (takes precedence over config)
?design=new   // force new design
?design=old   // force classic design

Docker Deployments

# Enable new design via environment variable
docker run -e USE_NEW_DESIGN=true -p 80:8080 ghcr.io/librespeed/speedtest

Or in docker-compose.yml:

environment:
  MODE: standalone
  USE_NEW_DESIGN: "true"

Error Handling

  • Malformed JSON falls back to old design
  • Path detection prevents redirect loops
  • Config fetch failures default to old design

Screenshots

Classic Design (Default)

New Design


PR Type

Enhancement


Description

  • Implements feature switch for new design with multiple configuration methods

  • Supports URL parameters, config file, and Docker environment variables

  • Includes client-side redirect logic with infinite loop prevention

  • Adds comprehensive documentation and Docker integration

Copilot AI and others added 2 commits December 28, 2025 22:21
Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
@sstidl
Copy link
Copy Markdown
Collaborator

sstidl commented Dec 28, 2025

@copilot look into the Dockerfiles and adjust entrypoint logic

Copilot AI changed the title [WIP] Add feature switch for enabling new design Add feature switch for new design via config file and URL parameters Dec 28, 2025
Copilot AI requested a review from sstidl December 28, 2025 22:27
Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 28, 2025

@copilot look into the Dockerfiles and adjust entrypoint logic

Updated Dockerfiles and entrypoint.sh to support the design feature switch (commit 90cf3e5).

Changes:

  • Both Dockerfile and Dockerfile.alpine now copy config.json, root index.html, and design-switch.js
  • entrypoint.sh copies these files to /var/www/html/ and supports the new USE_NEW_DESIGN environment variable
  • In standalone mode, the root index.html (with feature switch) is used by default, with the frontend directory available for the new design
  • Added documentation to doc_docker.md for the USE_NEW_DESIGN environment variable

Docker Usage:

# Default (old design)
docker run -p 80:8080 ghcr.io/librespeed/speedtest

# Enable new design
docker run -e USE_NEW_DESIGN=true -p 80:8080 ghcr.io/librespeed/speedtest

Tested successfully with Docker build and runtime.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • pecl.php.net
    • Triggering command: /usr/local/bin/php /usr/local/bin/php -C -q -d include_path=/usr/local/lib/php -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv=On /usr/local/lib/php/peclcmd.php channel-update pecl.php.net (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Add feature switch for new design via config file and URL parameters Add feature switch for new design via config file, URL parameters, and Docker Dec 28, 2025
@sstidl sstidl marked this pull request as ready for review December 28, 2025 22:41
sstidl and others added 2 commits December 28, 2025 23:54
Co-authored-by: qodo-free-for-open-source-projects[bot] <189517486+qodo-free-for-open-source-projects[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@sstidl sstidl left a comment

Choose a reason for hiding this comment

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

@copilot the solution has a big flaw. the frontend now lives in two places.
with old design it is in the root of the server, with new design it is in subdir frontend.
this has the effect that the results/ folder isnt found in new design mode.
a better solution would be to put old and new design side by side into the docker container, both at the same level. no additional paths needed.

Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 29, 2025

@copilot the solution has a big flaw. the frontend now lives in two places.
with old design it is in the root of the server, with new design it is in subdir frontend.
this has the effect that the resu...

Fixed in commit 9de1131. Both designs are now at root level side by side.

Architecture:

  • index.html - Entry point (lightweight switcher)
  • index-classic.html - Classic design at root
  • index-modern.html - Modern design at root (references frontend/ for assets)
  • Both designs can access results/ and backend/ with same relative paths

Screenshots:

Classic Design (Default):
Classic

Modern Design:
Modern

The path issue is resolved - both designs are at the same directory level, so relative paths to shared resources work correctly.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • pecl.php.net
    • Triggering command: /usr/local/bin/php /usr/local/bin/php -C -q -d include_path=/usr/local/lib/php -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv=On /usr/local/lib/php/peclcmd.php channel-update pecl.php.net (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
Copilot AI requested a review from sstidl December 29, 2025 21:58
@sstidl sstidl merged commit 235fa63 into newdesign Dec 29, 2025
@sstidl sstidl deleted the copilot/add-feature-switch-for-design branch December 29, 2025 22:39
sstidl added a commit that referenced this pull request Apr 11, 2026
* Implement fromScratch design

* Add some documentation

* enable new design in docker (no alpine yet)

* merge fixed docker images

* alpine docker added new design

* fix #685

* Implement fromScratch design

* Add some documentation

* enable new design in docker (no alpine yet)

* alpine docker added new design

* fix #685

* fix database permissions alpine, remove baby

* hide serverselector on only one server

* Update frontend/styling/server-selector.css

Co-authored-by: qodo-merge-pro-for-open-source[bot] <189517486+qodo-merge-pro-for-open-source[bot]@users.noreply.github.com>

* fix alpine image again

* adjust settings.json in entrypoint

so env vars are honored

* Update frontend/javascript/index.js

Co-authored-by: qodo-merge-for-open-source[bot] <189517486+qodo-merge-for-open-source[bot]@users.noreply.github.com>

* Add feature switch for new design via config file, URL parameters, and Docker (#742)

* Initial plan

* Add feature switch for new design with config and URL parameter support

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

* Improve error handling and prevent infinite redirect loops

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

* Update Dockerfiles and entrypoint to support design feature switch

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

* Update design-switch.js

Co-authored-by: qodo-free-for-open-source-projects[bot] <189517486+qodo-free-for-open-source-projects[bot]@users.noreply.github.com>

* fix: copy actions in entrypoint

* Restructure design switch to place both designs at root level

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

* Flatten frontend assets in Docker to eliminate frontend directory

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

* fix: entrypoint settings & server-list

disable entrypoint bash debug

* add link to modern design

---------

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: sstidl <sstidl@users.noreply.github.com>
Co-authored-by: qodo-free-for-open-source-projects[bot] <189517486+qodo-free-for-open-source-projects[bot]@users.noreply.github.com>

* add armv7

* reformat

* Add GDPR_EMAIL environment variable for Docker deployments (#743)

* Initial plan

* Add GDPR_EMAIL environment variable for Docker deployments

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

* Improve GDPR_EMAIL handling with proper escaping and loop

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

* Refine GDPR_EMAIL processing - skip index.html and improve escaping

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

* Optimize GDPR_EMAIL sed commands and improve escaping

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

* Clarify sed escaping comment for GDPR_EMAIL

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

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>

* cleanup old EMAIL ENV Var

* fix: line break in html prevented sed replacement

* version 6.0.0pre1

* test: add mssql docker compose tests

* Update Speedtest screen recording link in README

* Filter unreachable servers from selector (newdesign UI) (#769)

* Filter unreachable servers from selector (newdesign UI)

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* keep // servers in list

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix misleading comment

---------

Co-authored-by: Lumi <lumi@openclaw.local>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Stefan Stidl <sti-github@stidl.com>

* fix: server.json handling

* Use server-list.json in classic frontend by default

* Add configurable server list URLs to frontend and Docker

---------

Co-authored-by: Timendus <mail@timendus.com>
Co-authored-by: Stefan Stidl <stefan.stidl@ffg.at>
Co-authored-by: qodo-merge-pro-for-open-source[bot] <189517486+qodo-merge-pro-for-open-source[bot]@users.noreply.github.com>
Co-authored-by: qodo-merge-for-open-source[bot] <189517486+qodo-merge-for-open-source[bot]@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
Co-authored-by: qodo-free-for-open-source-projects[bot] <189517486+qodo-free-for-open-source-projects[bot]@users.noreply.github.com>
Co-authored-by: Stefan Stidl <sti-github@stidl.com>
Co-authored-by: Lumi <lumi@openclaw.local>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants