Skip to content

Commit 7f82e0e

Browse files
committed
Merge branch 'master' of https://github.com/librespeed/speedtest
2 parents a8bcc10 + 5cd7ce2 commit 7f82e0e

68 files changed

Lines changed: 3965 additions & 626 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@
2727
"addEventListener": "readonly"
2828
},
2929
"rules": {
30-
"no-unused-vars": ["warn", { "args": "none" }],
30+
"no-unused-vars": [
31+
"warn",
32+
{
33+
"args": "none"
34+
}
35+
],
3136
"no-console": "off",
3237
"no-empty": "warn",
3338
"no-undef": "warn",
3439
"no-const-assign": "error"
3540
}
36-
}
41+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
# Fill in the fields below to create a basic custom agent for your repository.
3+
# The Copilot CLI can be used for local testing: https://gh.io/customagents/cli
4+
# To make this agent available, merge this file into the default repository branch.
5+
# For format details, see: https://gh.io/customagents/config
6+
7+
name: Release Agent
8+
description: prepares releases, updates release tags in code, commits release changes, and creates the release tag
9+
---
10+
11+
# My Agent
12+
13+
You are a release automation agent for this repository.
14+
15+
## Purpose
16+
17+
Prepare and finalize releases by analyzing repository state, updating release tags in the codebase, committing those changes, and creating the corresponding Git tag for the release.
18+
19+
## Responsibilities
20+
21+
- Inspect recent changes relevant to the next release
22+
- Summarize user-facing changes, fixes, and breaking changes
23+
- Draft release notes in clear markdown
24+
- Propose a semantic version bump with justification
25+
- Identify and update version or release tag references in the repository
26+
- Commit the release-tag changes
27+
- Create the release Git tag
28+
- Identify release risks, missing checks, and follow-up items
29+
- Verify that release artifacts and documentation appear consistent
30+
31+
## Workflow
32+
33+
1. Determine the likely release scope from recent commits, merged pull requests, and changed files
34+
2. Group changes into:
35+
- Features
36+
- Fixes
37+
- Documentation
38+
- Maintenance
39+
- Breaking changes
40+
3. Recommend the next version:
41+
- patch for fixes or internal changes
42+
- minor for backward-compatible features
43+
- major for breaking changes
44+
4. Identify files that contain the current version or release tag
45+
5. Update those files to the new release version
46+
6. Create a commit for the release changes
47+
7. Create the Git tag for the release
48+
8. Draft release notes with:
49+
- title
50+
- summary
51+
- highlights
52+
- breaking changes, if any
53+
- migration notes, if any
54+
- acknowledgments, if available
55+
9. Flag anything that should block or delay the release:
56+
- failing or missing tests
57+
- missing changelog entries
58+
- undocumented breaking changes
59+
- version inconsistencies
60+
- incomplete release artifacts
61+
62+
## Output Format
63+
64+
When asked to prepare a release, respond with these sections:
65+
66+
### Proposed Version
67+
`<version>` with a brief justification
68+
69+
### Files Updated
70+
List of changed files and the version changes made
71+
72+
### Release Summary
73+
A short paragraph describing the release
74+
75+
### Release Notes
76+
Markdown-ready notes suitable for a GitHub release
77+
78+
### Commit Message
79+
Proposed or created commit message
80+
81+
### Release Tag
82+
Proposed or created tag name
83+
84+
### Risks / Blockers
85+
Bullet list of anything that needs attention before release
86+
87+
### Recommended Next Actions
88+
Short, concrete next steps
89+
90+
### Result
91+
State whether the release changes were prepared only, committed, or fully tagged
92+
93+
## Constraints
94+
95+
- Prefer evidence from the repository over assumptions
96+
- Be precise and concise
97+
- Do not invent changes that are not supported by repository history
98+
- Clearly label uncertain conclusions
99+
- Only change files directly related to versioning or release tagging unless explicitly instructed otherwise
100+
- Keep version updates consistent across all affected files
101+
- Use semantic versioning unless the repository clearly uses a different scheme
102+
- Do not guess hidden release rules; infer them from the repository
103+
- If required files are missing or version locations are ambiguous, explain the issue clearly
104+
- Ask for explicit confirmation before any action that would publish or mutate release state

.github/workflows/docker-publish.yml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,32 @@ env:
2424
IMAGE_NAME: ${{ github.repository }}
2525

2626
jobs:
27+
# Keep e2e in this workflow so Docker image build/push is hard-gated by test success.
28+
# Do not move automatic e2e back to playwright.yml, otherwise master pushes run duplicate e2e jobs.
29+
e2e:
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 45
32+
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v6
36+
37+
- name: Setup Node
38+
uses: actions/setup-node@v6
39+
with:
40+
node-version: 20
41+
42+
- name: Install dependencies
43+
run: npm install
44+
45+
- name: Install Playwright Chromium
46+
run: npx playwright install --with-deps chromium
47+
48+
- name: Run Playwright tests
49+
run: npm run test:e2e
50+
2751
build:
52+
needs: e2e
2853
runs-on: ubuntu-latest
2954
strategy:
3055
fail-fast: false
@@ -59,19 +84,19 @@ jobs:
5984
6085
# Set up QEMU for multi-arch builds
6186
- name: Set up QEMU
62-
uses: docker/setup-qemu-action@v3
87+
uses: docker/setup-qemu-action@v4
6388

6489
# Set up BuildKit Docker container builder to be able to build
6590
# multi-platform images and export cache
6691
# https://github.com/docker/setup-buildx-action
6792
- name: Set up Docker Buildx
68-
uses: docker/setup-buildx-action@v3
93+
uses: docker/setup-buildx-action@v4
6994

7095
# Login against a Docker registry except on PR
7196
# https://github.com/docker/login-action
7297
- name: Log into registry ${{ env.REGISTRY }}
7398
if: github.event_name != 'pull_request'
74-
uses: docker/login-action@v3
99+
uses: docker/login-action@v4
75100
with:
76101
registry: ${{ env.REGISTRY }}
77102
username: ${{ github.actor }}
@@ -81,7 +106,7 @@ jobs:
81106
# https://github.com/docker/metadata-action
82107
- name: Extract Docker metadata
83108
id: meta
84-
uses: docker/metadata-action@v5
109+
uses: docker/metadata-action@v6
85110
with:
86111
images: ${{ matrix.image }}
87112
tags: |
@@ -98,7 +123,7 @@ jobs:
98123
# https://github.com/docker/build-push-action
99124
- name: Build and push Docker image
100125
id: build-and-push
101-
uses: docker/build-push-action@v6
126+
uses: docker/build-push-action@v7
102127
with:
103128
context: .
104129
file: ${{ matrix.dockerfile }}

.github/workflows/playwright.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Playwright E2E
2+
3+
# Manual-only by design:
4+
# - Automatic e2e runs that gate Docker image builds live in docker-publish.yml.
5+
# - Keeping this workflow manual avoids running the same e2e suite twice on master pushes.
6+
on:
7+
workflow_dispatch:
8+
9+
jobs:
10+
e2e:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 45
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v6
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v6
20+
with:
21+
node-version: 20
22+
23+
- name: Install dependencies
24+
run: npm install
25+
26+
- name: Install Playwright Chromium
27+
run: npx playwright install --with-deps chromium
28+
29+
- name: Run Playwright tests
30+
run: npm run test:e2e

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ db-dir/
44
.vscode/
55
node_modules/
66
package-lock.json
7+
playwright-report/
8+
test-results/
79
results/speedtest_telemetry.db
810
results/speedtest_telemetry.db-shm
911
results/speedtest_telemetry.db-wal

.prettierrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
"arrowParens": "avoid",
1010
"endOfLine": "lf",
1111
"htmlWhitespaceSensitivity": "ignore"
12-
}
12+
}

DESIGN_SWITCH.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Design Feature Switch
2+
3+
LibreSpeed now supports switching between the classic design and the new modern design.
4+
5+
## Default Behavior
6+
7+
By default, LibreSpeed uses the **classic design** (located in `index-classic.html`).
8+
9+
## Architecture
10+
11+
### File Structure (Non-Docker)
12+
- **`index.html`** - Entry point (lightweight switcher)
13+
- **`index-classic.html`** - Classic design at root
14+
- **`index-modern.html`** - Modern design at root (references assets in subdirectories)
15+
- **`frontend/`** - Directory containing modern design assets (CSS, JS, images, fonts) - kept for non-Docker deployments
16+
17+
### File Structure (Docker)
18+
In Docker deployments, the frontend assets are flattened to root-level subdirectories:
19+
- **`index.html`** - Entry point (lightweight switcher)
20+
- **`index-classic.html`** - Classic design
21+
- **`index-modern.html`** - Modern design
22+
- **`styling/`** - CSS files for modern design
23+
- **`javascript/`** - JS files for modern design
24+
- **`images/`** - Images for modern design
25+
- **`fonts/`** - Fonts for modern design
26+
- **No `frontend/` directory** - Assets are copied directly to root subdirectories
27+
28+
### Benefits of Root-Level Design Files
29+
✅ Both designs at same level - no path confusion
30+
`results/` accessible from both designs with same relative path
31+
`backend/` accessible from both designs with same relative path
32+
✅ No subdirectory nesting issues
33+
✅ Clean separation of concerns
34+
✅ Docker containers have no `frontend/` parent directory
35+
36+
## Browser Compatibility
37+
38+
The feature switch uses modern JavaScript features (URLSearchParams, XMLHttpRequest). It is compatible with all modern browsers. The new design itself requires modern browser features and has no backwards compatibility with older browsers (see `frontend/README.md`).
39+
40+
## Enabling the New Design
41+
42+
There are two ways to enable the new design:
43+
44+
### Method 1: Configuration File (Persistent)
45+
46+
Edit the `config.json` file in the root directory and set `useNewDesign` to `true`:
47+
48+
```json
49+
{
50+
"useNewDesign": true
51+
}
52+
```
53+
54+
This will make the new design the default for all users visiting your site.
55+
56+
### Method 2: URL Parameter (Temporary Override)
57+
58+
You can override the configuration by adding a URL parameter:
59+
60+
- To use the new design: `http://yoursite.com/?design=new`
61+
- To use the classic design: `http://yoursite.com/?design=classic` or ?design=old
62+
63+
URL parameters take precedence over the configuration file, making them useful for testing or allowing users to choose their preferred design.
64+
65+
## Design Locations
66+
67+
### Non-Docker Deployments
68+
- **Entry Point**: Root `index.html` file (lightweight redirect page)
69+
- **Old Design**: `index-classic.html` at root
70+
- **New Design**: `index-modern.html` at root (references assets in `frontend/` subdirectory)
71+
- **Assets**: Frontend assets (CSS, JS, images, fonts) in `frontend/` subdirectory
72+
73+
### Docker Deployments
74+
- **Entry Point**: Root `index.html` file (lightweight redirect page)
75+
- **Old Design**: `index-classic.html` at root
76+
- **New Design**: `index-modern.html` at root (references assets in root subdirectories)
77+
- **Assets**: Frontend assets copied directly to root subdirectories (`styling/`, `javascript/`, `images/`, `fonts/`)
78+
- **No `frontend/` directory** - Assets are flattened to root level
79+
80+
Both designs are at the same directory level, ensuring that relative paths to shared resources like `backend/` and `results/` work correctly for both.
81+
82+
## Technical Details
83+
84+
The feature switch is implemented in `design-switch.js`, which is loaded by the root `index.html`. It checks:
85+
86+
1. First, URL parameters (`?design=new` or `?design=old`)
87+
2. Then, the `config.json` configuration file
88+
3. Redirects to either `index-classic.html` or `index-modern.html`
89+
90+
Both design HTML files are at the root level, eliminating path issues.
91+
92+
### Non-Docker
93+
The modern design references assets from the `frontend/` subdirectory (e.g., `frontend/styling/index.css`), while both designs can access shared resources like `backend/` and `results/` using the same relative paths.
94+
95+
### Docker
96+
In Docker deployments, the `frontend/` directory is flattened during container startup. Assets are copied directly to root-level subdirectories (`styling/`, `javascript/`, `images/`, `fonts/`), and `index-modern.html` references these root-level paths. This eliminates the `frontend/` parent directory in the container.

Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,31 @@ RUN mkdir -p /speedtest/
1515

1616
# Copy sources
1717
COPY backend/ /speedtest/backend
18+
COPY frontend/ /speedtest/frontend
1819

1920
COPY results/*.php /speedtest/results/
2021
COPY results/*.ttf /speedtest/results/
2122

2223
COPY *.js /speedtest/
24+
COPY index.html /speedtest/
25+
COPY index-classic.html /speedtest/
26+
COPY index-modern.html /speedtest/
27+
COPY config.json /speedtest/
2328
COPY favicon.ico /speedtest/
2429

25-
COPY docker/servers.json /servers.json
26-
2730
COPY docker/*.php /speedtest/
2831
COPY docker/entrypoint.sh /
2932

3033
# Prepare default environment variables
3134
ENV TITLE=LibreSpeed
35+
ENV TAGLINE="No Flash, No Java, No Websockets, No Bullsh*t"
3236
ENV MODE=standalone
3337
ENV PASSWORD=password
3438
ENV TELEMETRY=false
3539
ENV ENABLE_ID_OBFUSCATION=false
3640
ENV REDACT_IP_ADDRESSES=false
3741
ENV WEBPORT=8080
42+
ENV USE_NEW_DESIGN=false
3843

3944
# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
4045
STOPSIGNAL SIGWINCH

0 commit comments

Comments
 (0)