Skip to content

Commit 33421e5

Browse files
authored
Merge branch 'librespeed:master' into master
2 parents 7f82e0e + 23b7780 commit 33421e5

12 files changed

Lines changed: 1401 additions & 13 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ COPY index.html /speedtest/
2525
COPY index-classic.html /speedtest/
2626
COPY index-modern.html /speedtest/
2727
COPY config.json /speedtest/
28+
COPY stability.html /speedtest/
2829
COPY favicon.ico /speedtest/
2930

30-
COPY docker/*.php /speedtest/
3131
COPY docker/entrypoint.sh /
3232

3333
# Prepare default environment variables

Dockerfile.alpine

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ COPY index.html /speedtest/
3535
COPY index-classic.html /speedtest/
3636
COPY index-modern.html /speedtest/
3737
COPY config.json /speedtest/
38+
COPY stability.html /speedtest/
3839
COPY favicon.ico /speedtest/
3940

40-
COPY docker/*.php /speedtest/
4141
COPY docker/entrypoint.sh /
4242

4343
# Prepare default environment variables

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Works with mobile versions too.
2525
* Telemetry (optional)
2626
* Results sharing (optional)
2727
* Multiple Points of Test (optional)
28+
* Connection stability test with latency charting, loss tracking, threshold alerts, and CSV export
2829

2930
![Screenrecording of a running Speedtest](https://speedtest.fdossena.com/mpot_v7.gif)
3031

@@ -40,7 +41,7 @@ Works with mobile versions too.
4041
Assuming you have PHP and a web server installed, the installation steps are quite simple.
4142

4243
1. Download the source code and extract it
43-
1. Copy the project files to your web server's shared folder (ie. `/var/www/html/speedtest` for Apache). For the current layout, the web root should contain `index.html`, `index-classic.html`, `index-modern.html`, `design-switch.js`, `config.json`, `speedtest.js`, `speedtest_worker.js`, `favicon.ico`, and the `backend` folder.
44+
1. Copy the project files to your web server's shared folder (ie. `/var/www/html/speedtest` for Apache). For the current layout, the web root should contain `index.html`, `index-classic.html`, `index-modern.html`, `stability.html`, `design-switch.js`, `config.json`, `speedtest.js`, `speedtest_worker.js`, `stability_worker.js`, `favicon.ico`, and the `backend` folder.
4445
1. Also copy the contents of `frontend/` into the same web root so the modern UI assets end up in `styling/`, `javascript/`, `images/`, and `fonts/` next to the HTML files.
4546
1. Optionally, copy the results folder too, and set up the database using the config file in it.
4647
1. Be sure your permissions allow read and execute access where needed.
@@ -72,6 +73,12 @@ If you want to contribute or develop with LibreSpeed, see [DEVELOPMENT.md](DEVEL
7273

7374
LibreSpeed supports both the classic and modern UI. The root `index.html` acts as a lightweight switcher and redirects to `index-classic.html` or `index-modern.html` based on `config.json` (`useNewDesign`) or URL overrides (`?design=new` / `?design=old`). For architecture and deployment details (including Docker behavior), see [DESIGN_SWITCH.md](DESIGN_SWITCH.md).
7475

76+
## Stability test
77+
78+
LibreSpeed includes a standalone connection stability test at `stability.html`, linked from both the classic and modern interfaces. It repeatedly measures ping over a selected duration and reports current, average, minimum, maximum, jitter, and failed request percentage values with a live chart.
79+
80+
The stability test can target the local LibreSpeed backend, one of the configured multiple points of test, or built-in external targets such as Google, Cloudflare, and Apple. It also supports optional latency threshold alerts and CSV export of the collected samples. Docker deployments copy `stability.html` and `stability_worker.js` into the web root and reuse the same server list configuration as the main UI.
81+
7582
## Docker
7683

7784
A docker image is available on [GitHub](https://github.com/librespeed/speedtest/pkgs/container/speedtest), check our [docker documentation](doc_docker.md) for more info about it.

docker/entrypoint.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ rm -rf /var/www/html/*
3535

3636
# Copy frontend files
3737
cp /speedtest/*.js /var/www/html/
38+
cp /speedtest/stability.html /var/www/html/
3839

3940
# Copy design switch files
4041
cp /speedtest/config.json /var/www/html/
@@ -52,6 +53,11 @@ else
5253
fi
5354

5455

56+
# Copy servers.json for stability page (frontend/dual modes)
57+
if [[ "$MODE" == "frontend" || "$MODE" == "dual" ]]; then
58+
cp /servers.json /var/www/html/servers.json
59+
fi
60+
5561
# Set up backend side for standlone modes
5662
if [[ "$MODE" == "standalone" || "$MODE" == "dual" ]]; then
5763
cp -r /speedtest/backend/ /var/www/html/backend
@@ -73,14 +79,14 @@ if [[ "$MODE" == "frontend" || "$MODE" == "dual" || "$MODE" == "standalone" ]];
7379
cp /speedtest/index.html /var/www/html/
7480
cp /speedtest/index-classic.html /var/www/html/
7581
cp /speedtest/index-modern.html /var/www/html/
76-
82+
cp /speedtest/stability.html /var/www/html/
7783
# Copy frontend assets directly to root-level subdirectories (no frontend/ parent dir)
7884
mkdir -p /var/www/html/styling /var/www/html/javascript /var/www/html/images /var/www/html/fonts
7985
cp -a /speedtest/frontend/styling/* /var/www/html/styling/
8086
cp -a /speedtest/frontend/javascript/* /var/www/html/javascript/
8187
cp -a /speedtest/frontend/images/* /var/www/html/images/
8288
cp -a /speedtest/frontend/fonts/* /var/www/html/fonts/ 2>/dev/null || true
83-
89+
8490
# Copy frontend config files
8591
cp /speedtest/frontend/settings.json /var/www/html/settings.json 2>/dev/null || true
8692
if [ -f /servers.json ]; then
@@ -96,6 +102,12 @@ if [[ "$MODE" == "frontend" || "$MODE" == "dual" || "$MODE" == "standalone" ]];
96102
SERVER_LIST_URL_ESCAPED=$(printf '%s\n' "$SERVER_LIST_URL" | sed 's/[&/\\]/\\&/g; s/\$/\\$/g')
97103
sed -i "s/var SPEEDTEST_SERVERS = \"server-list.json\";/var SPEEDTEST_SERVERS = \"$SERVER_LIST_URL_ESCAPED\";/" /var/www/html/index-modern.html
98104
sed -i "s/var SPEEDTEST_SERVERS = \\[/var SPEEDTEST_SERVERS = \"$SERVER_LIST_URL_ESCAPED\";\\n\\t\\t\\/\\*/" /var/www/html/index-classic.html
105+
sed -i "s/var SPEEDTEST_SERVERS = \"server-list.json\";/var SPEEDTEST_SERVERS = \"$SERVER_LIST_URL_ESCAPED\";/" /var/www/html/stability.html
106+
fi
107+
108+
# The stability page reads the same local server list as the main UI when present.
109+
if [ -f /var/www/html/server-list.json ]; then
110+
cp /var/www/html/server-list.json /var/www/html/servers.json
99111
fi
100112

101113
# Replace title placeholders if TITLE is set
@@ -117,7 +129,7 @@ if [[ "$MODE" == "frontend" || "$MODE" == "dual" || "$MODE" == "standalone" ]];
117129
TAGLINE_ESCAPED=$(sed_escape "$TAGLINE_HTML_ESCAPED")
118130
sed -i "s/<p class=\"tagline\">No Flash, No Java, No Websockets, No Bullsh\\*t<\\/p>/<p class=\"tagline\">$TAGLINE_ESCAPED<\\/p>/g" /var/www/html/index-modern.html
119131
fi
120-
132+
121133
# Support legacy EMAIL env var as fallback for GDPR_EMAIL
122134
if [ -z "$GDPR_EMAIL" ] && [ ! -z "$EMAIL" ]; then
123135
echo "WARNING: EMAIL env var is deprecated, please use GDPR_EMAIL instead" >&2
@@ -129,7 +141,7 @@ if [[ "$MODE" == "frontend" || "$MODE" == "dual" || "$MODE" == "standalone" ]];
129141
if [ ! -z "$GDPR_EMAIL" ]; then
130142
# Escape special sed characters: & (replacement), / (delimiter), \ (escape), $ (variable)
131143
GDPR_EMAIL_ESCAPED=$(printf '%s\n' "$GDPR_EMAIL" | sed 's/[&/\\]/\\&/g; s/\$/\\$/g')
132-
144+
133145
for html_file in /var/www/html/index-modern.html /var/www/html/index-classic.html; do
134146
if [ -f "$html_file" ]; then
135147
sed -i "s/TO BE FILLED BY DEVELOPER/$GDPR_EMAIL_ESCAPED/g; s/PUT@YOUR_EMAIL.HERE/$GDPR_EMAIL_ESCAPED/g" "$html_file"

frontend/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ <h2>Upload</h2>
7575
</main>
7676
<footer>
7777
<p class="source">
78+
<a href="stability.html">stability test</a> |
7879
<a href="https://github.com/librespeed/speedtest">source code</a>
7980
</p>
8081
</footer>

index-classic.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ <h3>Share results</h3>
567567
</div>
568568
</div>
569569
<a href="index.html?design=new">Try the modern design</a><br>
570-
<a href="https://github.com/librespeed/speedtest">Source code</a>
570+
<a href="stability.html">Stability Test</a> | <a href="https://github.com/librespeed/speedtest">Source code</a>
571571
</div>
572572
<div id="privacyPolicy" style="display:none">
573573
<h2>Privacy Policy</h2>

index-modern.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ <h2>Upload</h2>
7575
</main>
7676
<footer>
7777
<p class="source">
78-
<a href="https://github.com/librespeed/speedtest">source code</a>
78+
<a href="stability.html">stability test</a> | <a href="https://github.com/librespeed/speedtest">source code</a>
7979
</p>
8080
</footer>
8181

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"test": "echo \"No automated tests configured yet\" && exit 0",
88
"test:e2e": "playwright test",
99
"test:e2e:headed": "playwright test --headed",
10-
"lint": "eslint speedtest.js speedtest_worker.js",
11-
"lint:fix": "eslint --fix speedtest.js speedtest_worker.js",
10+
"lint": "eslint speedtest.js speedtest_worker.js stability_worker.js",
11+
"lint:fix": "eslint --fix speedtest.js speedtest_worker.js stability_worker.js",
1212
"format": "prettier --write \"*.js\"",
1313
"format:check": "prettier --check \"*.js\"",
1414
"validate": "npm run format:check && npm run lint",
@@ -46,6 +46,8 @@
4646
"files": [
4747
"speedtest.js",
4848
"speedtest_worker.js",
49+
"stability_worker.js",
50+
"stability.html",
4951
"index.html",
5052
"favicon.ico",
5153
"backend/",

0 commit comments

Comments
 (0)