From 82d64bff9692bc0ee13a43d1ff6253440fd5ac55 Mon Sep 17 00:00:00 2001 From: JoKneeMo <421625+JoKneeMo@users.noreply.github.com> Date: Sun, 11 Dec 2022 22:57:06 -0500 Subject: [PATCH 1/5] Set content-type before sending image data for a valid response --- results/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/results/index.php b/results/index.php index ad6beca..2505058 100755 --- a/results/index.php +++ b/results/index.php @@ -212,7 +212,6 @@ function drawImage($speedtest) imagefttext($im, $FONT_WATERMARK_SIZE, 0, $POSITION_X_WATERMARK, $POSITION_Y_WATERMARK, $TEXT_COLOR_WATERMARK, $FONT_WATERMARK, $WATERMARK_TEXT); // send the image to the browser - header('Content-Type: image/png'); imagepng($im); } @@ -221,4 +220,5 @@ if (!is_array($speedtest)) { exit(1); } +header('Content-Type: image/png'); drawImage($speedtest); From 20f1f46d1fc5fd300ad86da2717929bfb7d8ae2f Mon Sep 17 00:00:00 2001 From: JoKneeMo <421625+JoKneeMo@users.noreply.github.com> Date: Sun, 11 Dec 2022 23:08:46 -0500 Subject: [PATCH 2/5] Docker support for a server that behaves as a standalone frontend AND a backend for another server. --- doc_docker.md | 7 +++++++ docker/entrypoint.sh | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc_docker.md b/doc_docker.md index 753fe02..53eabb0 100755 --- a/doc_docker.md +++ b/doc_docker.md @@ -104,3 +104,10 @@ This command starts LibreSpeed in frontend mode, with a given `servers.json` fil ``` docker run -e MODE=frontend -e TELEMETRY=true -e ENABLE_ID_OBFUSCATION=true -e PASSWORD="yourPasswordHere" -v $(pwd)/servers.json:/servers.json -p 80:80 -it adolfintel/speedtest ``` + +### Dual mode +In dual mode, LibreSpeed operates as a standalone server that can also connect to other test points. +To do this: +* Set the `MODE` environment variable to `dual` +* Follow the `servers.json` instructions for the frontend mode +* The first server entry should be the local server, using the server endpoint address that a client can access. \ No newline at end of file diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index d08ff05..92ea473 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -13,7 +13,7 @@ cp /speedtest/*.js /var/www/html/ cp /speedtest/favicon.ico /var/www/html/ # Set up backend side for standlone modes -if [ "$MODE" == "standalone" ]; then +if [[ "$MODE" == "standalone" || "$MODE" == "dual" ]]; then cp -r /speedtest/backend/ /var/www/html/backend if [ ! -z "$IPINFO_APIKEY" ]; then sed -i s/\$IPINFO_APIKEY\ =\ \'\'/\$IPINFO_APIKEY\ =\ \'$IPINFO_APIKEY\'/g /var/www/html/backend/getIP_ipInfo_apikey.php @@ -28,14 +28,14 @@ if [ "$MODE" == "backend" ]; then fi # Set up index.php for frontend-only or standalone modes -if [ "$MODE" == "frontend" ]; then +if [[ "$MODE" == "frontend" || "$MODE" == "dual" ]]; then cp /speedtest/frontend.php /var/www/html/index.php elif [ "$MODE" == "standalone" ]; then cp /speedtest/standalone.php /var/www/html/index.php fi # Apply Telemetry settings when running in standalone or frontend mode and telemetry is enabled -if [[ "$TELEMETRY" == "true" && ( "$MODE" == "frontend" || "$MODE" == "standalone" ) ]]; then +if [[ "$TELEMETRY" == "true" && ( "$MODE" == "frontend" || "$MODE" == "standalone" || "$MODE" == "dual" ) ]]; then cp -r /speedtest/results /var/www/html/results if [ "$MODE" == "frontend" ]; then From 11f698b376969c59d9d1e7f29eb86f1d1759ee29 Mon Sep 17 00:00:00 2001 From: JoKneeMo <421625+JoKneeMo@users.noreply.github.com> Date: Wed, 8 Nov 2023 11:05:47 -0500 Subject: [PATCH 3/5] Revert "Set content-type before sending image data for a valid response" This reverts commit 82d64bff9692bc0ee13a43d1ff6253440fd5ac55. --- results/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/results/index.php b/results/index.php index 2505058..ad6beca 100755 --- a/results/index.php +++ b/results/index.php @@ -212,6 +212,7 @@ function drawImage($speedtest) imagefttext($im, $FONT_WATERMARK_SIZE, 0, $POSITION_X_WATERMARK, $POSITION_Y_WATERMARK, $TEXT_COLOR_WATERMARK, $FONT_WATERMARK, $WATERMARK_TEXT); // send the image to the browser + header('Content-Type: image/png'); imagepng($im); } @@ -220,5 +221,4 @@ if (!is_array($speedtest)) { exit(1); } -header('Content-Type: image/png'); drawImage($speedtest); From a6ae760279c42e37e0c50e78bdebe1634e384b8b Mon Sep 17 00:00:00 2001 From: Thore Goebel Date: Wed, 31 Jan 2024 22:46:46 +0100 Subject: [PATCH 4/5] Mention CLI client in Readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index eba9e0b..8ede444 100755 --- a/README.md +++ b/README.md @@ -51,6 +51,9 @@ There is a more in-depth installation video here: ## Android app A template to build an Android client for your LibreSpeed installation is available [here](https://github.com/librespeed/speedtest-android). +## CLI client +A command line client is available [here](https://github.com/librespeed/speedtest-cli). + ## Docker 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. From c1974d5a532c56897b4b44048529902cd9c8a49e Mon Sep 17 00:00:00 2001 From: sstidl Date: Fri, 2 Feb 2024 15:56:48 +0100 Subject: [PATCH 5/5] fix #598 --- README.md | 4 ++-- doc.md | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index eba9e0b..23fdf5b 100755 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Works with mobile versions too. ## Server requirements * A reasonably fast web server with Apache 2 (nginx, IIS also supported) -* PHP 5.4 (other backends also available) +* PHP 5.4 or newer (other backends also available) * MySQL database to store test results (optional, Microsoft SQL Server, PostgreSQL and SQLite also supported) * A fast! internet connection @@ -37,7 +37,7 @@ Assuming you have PHP installed, the installation steps are quite simple. I set this up on a QNAP. For this example, I am using a folder called **speedtest** in my web share area. -1. Choose one of the example-xxx.html files as your new index.html in your speedtest folder. I used: example-singleServer-full.html +1. Choose one of the example-xxx.html files in `examples` folder as your index.html if the default index.html does not fit. 2. Add: speedtest.js, speedtest_worker.js, and favicon.ico to your speedtest folder. 3. Download all of the backend folder into speedtest/backend. 4. Download all of the results folder into speedtest/results. diff --git a/doc.md b/doc.md index b30a01a..236c1cf 100755 --- a/doc.md +++ b/doc.md @@ -109,8 +109,7 @@ A basic front-end for visualizing and searching tests by ID is available in `res A login is required to access the interface. __Important__: change the default password in `results/telemetry_settings.php`. #### The end -Now that the test is installed, rename one of the examples to `index.html` and delete the other examples. -The best starting point for most people is `example-singleServer-gauges.html`. If you want to use telemetry and results sharing, use `example-singleServer-full.html` instead. +Now that the test is installed, the default page uses telemetry and results sharing. If you want another index page, rename one of the examples to `index.html` and delete the other examples. The best starting point for most people is `example-singleServer-gauges.html`. If you're not using telemetry and results sharing, you can delete the `results` folder too. @@ -119,7 +118,7 @@ Details about the examples and how to make custom UIs will be discussed later. I #### Privacy Telemetry contains personal information (according to GDPR definition), therefore it is important to treat this data respectfully of national and international laws, especially if you plan to offer the service in the European Union. -`example-singleServer-full.html` and `example-multipleServers-full.html` both contain a privacy policy for the service: you MUST read it, change it if necessary, and add your email address for data deletion requests. __Failure to comply with GDPR regulations can get you in serious trouble.__ +Default `index.html` and `example-multipleServers-full.html` both contain a privacy policy for the service: you MUST read it, change it if necessary, and add your email address for data deletion requests. __Failure to comply with GDPR regulations can get you in serious trouble.__ ### Multiple servers, PHP The speed test can automatically choose between multiple test points and use the one with the lowest ping in a list. @@ -240,11 +239,11 @@ __Single server:__ * `example-singleServer-customSettings.html`: Same as `example-singleServer-pretty.html` but configures the test so that it only performs download and upload tests, and with a fixed length instead of automatic * `example-singleServer-gauges.html`: The most sophisticated example, with the same functionality as `example-singleServer-pretty.html` but adds gauges. This is also a good starting point, but the gauges may slow down underpowered devices * `example-singleServer-chart.html`: Shows how to use the test with the Chart.js library -* `example-singleServer-full.html`: The most complete example. Based on `example-singleServer-gauges.html`, also enables telemetry and results sharing +* default `index.html`: The most complete example. Based on `example-singleServer-gauges.html`, also enables telemetry and results sharing __Multiple servers:__ * `example-multipleServers-pretty.html`: Same as `example-singleServer-pretty.html` but with multiple test points. Server selection is fully automatic -* `example-multipleServers-full.html`: Same as `example-singleServer-full.html` but with multiple test points. Server selection is automatic but the server can be changed afterwards by the user +* `example-multipleServers-full.html`: Same as default `index.html` but with multiple test points. Server selection is automatic but the server can be changed afterwards by the user ### Initialization To use the speed test in your page, first you need to load it: