removed trailing whitespaces
This commit is contained in:
parent
21fb3c53aa
commit
2662491132
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
@ -24,5 +24,5 @@ Browser, OS, type of connection, unusual software, ...
|
|||
What should have happened
|
||||
|
||||
## Screenshots
|
||||
If necessary, add screenshots of the test.
|
||||
If necessary, add screenshots of the test.
|
||||
F12 > Network screenshots can be particularly useful
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
results/idObfuscation_salt.php
|
||||
backend/getIP_serverLocation.php
|
||||
db-dir/
|
||||
|
|
|
@ -29,7 +29,7 @@ COPY docker/servers.json /servers.json
|
|||
COPY docker/*.php /speedtest/
|
||||
COPY docker/entrypoint.sh /
|
||||
|
||||
# Prepare default environment variables
|
||||
# Prepare default environment variables
|
||||
ENV TITLE=LibreSpeed
|
||||
ENV MODE=standalone
|
||||
ENV PASSWORD=password
|
||||
|
|
|
@ -10,7 +10,7 @@ This is a very lightweight speed test implemented in Javascript, using XMLHttpRe
|
|||
[Take a speed test](https://librespeed.org)
|
||||
|
||||
## Compatibility
|
||||
All modern browsers are supported: IE11, latest Edge, latest Chrome, latest Firefox, latest Safari.
|
||||
All modern browsers are supported: IE11, latest Edge, latest Chrome, latest Firefox, latest Safari.
|
||||
Works with mobile versions too.
|
||||
|
||||
## Features
|
||||
|
@ -61,8 +61,8 @@ A Go implementation is available in the [`speedtest-go`](https://github.com/libr
|
|||
A partial Node.js implementation is available in the `node` branch, developed by [dunklesToast](https://github.com/dunklesToast). It's not recommended to use at the moment.
|
||||
|
||||
## Donate
|
||||
[![Donate with Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/fdossena/donate)
|
||||
[Donate with PayPal](https://www.paypal.me/sineisochronic)
|
||||
[![Donate with Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/fdossena/donate)
|
||||
[Donate with PayPal](https://www.paypal.me/sineisochronic)
|
||||
|
||||
## License
|
||||
Copyright (C) 2016-2022 Federico Dossena
|
||||
|
|
|
@ -108,7 +108,7 @@ function getIsp($rawIspInfo)
|
|||
{
|
||||
if (is_array($rawIspInfo)) {
|
||||
/* variant with no token
|
||||
has json like:
|
||||
has json like:
|
||||
{
|
||||
"ip": "xxx.xxx.xxx.xxx",
|
||||
"hostname": "example.com",
|
||||
|
@ -173,7 +173,7 @@ function getIsp($rawIspInfo)
|
|||
"domains": {
|
||||
"total": 0,
|
||||
"domains": [
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
50
doc.md
50
doc.md
|
@ -1,6 +1,6 @@
|
|||
# LibreSpeed
|
||||
|
||||
> by Federico Dossena
|
||||
> by Federico Dossena
|
||||
> Version 5.2.4
|
||||
> [https://github.com/librespeed/speedtest/](https://github.com/librespeed/speedtest/)
|
||||
|
||||
|
@ -109,7 +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.
|
||||
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.
|
||||
|
||||
If you're not using telemetry and results sharing, you can delete the `results` folder too.
|
||||
|
@ -459,7 +459,7 @@ s.selectServer(function(server){
|
|||
//do something
|
||||
})
|
||||
```
|
||||
The `selectServer` function is asynchronous in order to avoid freeing the UI, and it will run a callback function when it is done choosing the server with the lowest ping.
|
||||
The `selectServer` function is asynchronous in order to avoid freeing the UI, and it will run a callback function when it is done choosing the server with the lowest ping.
|
||||
The `server` argument is the selected server, and you can display it in the UI if you want. __You cannot start the test until the selection is done!__
|
||||
|
||||
You can also set the test point manually (for instance, from a combobox in the UI):
|
||||
|
@ -483,7 +483,7 @@ s.abort();
|
|||
When the test is finished, you can run it again if you want, or you can just destroy `s`.
|
||||
|
||||
## Implementation details
|
||||
The purpose of this section is to help developers who want to make changes to the inner workings of the speed test.
|
||||
The purpose of this section is to help developers who want to make changes to the inner workings of the speed test.
|
||||
It will be divided into 4 sections: `speedtest.js`, `speedtest_worker.js`, the `backend` files and the `results` files.
|
||||
|
||||
### `speedtest.js`
|
||||
|
@ -515,7 +515,7 @@ You can think of this as a finite state machine. These are the states (use getSt
|
|||
- `ulProgress`: progress of the upload test as a float 0-1
|
||||
- `pingProgress`: progress of the ping/jitter test as a float 0-1
|
||||
- `testState`: state of the test (-1=not started, 0=starting, 1=download test, 2=ping+jitter test, 3=upload test, 4=finished, 5=aborted)
|
||||
- `clientIp`: IP address of the client performing the test (and optionally ISP and distance)
|
||||
- `clientIp`: IP address of the client performing the test (and optionally ISP and distance)
|
||||
At the end of the test, the `onend` function will be called, with a boolean specifying whether the test was aborted or if it ended normally.
|
||||
The test can be aborted at any time with `abort()`.
|
||||
At the end of the test, it will move to state 4
|
||||
|
@ -575,7 +575,7 @@ Starts the test.
|
|||
|
||||
Note (multiple points of test): the selected server will be added to the `telemetry_extra` string. If this string was already set, then `telemetry_extra` will be a JSON string containing both the server and the original string
|
||||
|
||||
During the test, the `onupdate(data)` callback function will be called periodically with data from the worker.
|
||||
During the test, the `onupdate(data)` callback function will be called periodically with data from the worker.
|
||||
At the end of the test, the `onend(aborted)` function will be called with a boolean telling you if the test was aborted or if it ended normally.
|
||||
|
||||
##### abort()
|
||||
|
@ -747,8 +747,8 @@ This will point to our static files and set the test to only do ping/jitter, dow
|
|||
These are the most common issues reported by users, and how to fix them. If you still need help, contact me at [info@fdossena.com](mailto:info@fdossena.com).
|
||||
|
||||
#### Download test gives very low result
|
||||
Are garbage.php and empty.php (or your replacements) reachable?
|
||||
Press F12, select network and start the test. Do you see errors? (cancelled requests are not errors)
|
||||
Are garbage.php and empty.php (or your replacements) reachable?
|
||||
Press F12, select network and start the test. Do you see errors? (cancelled requests are not errors)
|
||||
If a small download starts, open it in a text editor. Does it say it's missing openssl_random_pseudo_bytes()? In this case, install OpenSSL (this is usually included when you install Apache and PHP on most distros).
|
||||
|
||||
#### Upload test is inaccurate, and/or I see lag spikes
|
||||
|
@ -764,15 +764,15 @@ You're running the test on localhost, therefore it is trying to measure the spee
|
|||
Make sure your server is sending the `Connection:keep-alive` header
|
||||
|
||||
#### The server is behind a load balancer, proxy, etc. and I get the wrong IP address
|
||||
Edit getIP.php and replace lines 14-23 with what is more appropriate in your scenario.
|
||||
Edit getIP.php and replace lines 14-23 with what is more appropriate in your scenario.
|
||||
Example: `$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];`
|
||||
|
||||
#### The results sharing just generates a blank image
|
||||
If the image doesn't display and the browser displays a broken image icon, FreeType2 is not installed or configured properly.
|
||||
If the image doesn't display and the browser displays a broken image icon, FreeType2 is not installed or configured properly.
|
||||
If the image is blank, this usually happens because PHP can't find the font files inside the `results` folder. You can fix your PHP config or edit `results/index.php` and use absolute paths for the fonts. This is a [known issue with PHP](http://php.net/manual/en/function.imagefttext.php) and no real solution is known.
|
||||
|
||||
#### My server is behind Cloudflare and I can't reach full speed on some of the tests
|
||||
This is not a speed test related issue, as it can be replicated in virtually any HTTP file upload/download.
|
||||
This is not a speed test related issue, as it can be replicated in virtually any HTTP file upload/download.
|
||||
Go to your domain's DNS settings and change "DNS and HTTP proxy (CDN)" to "DNS only", and wait for the settings to be applied (can take a few minutes).
|
||||
|
||||
#### On Windows Server, using IIS, the upload test doesn't work, CORS errors are visible in the console
|
||||
|
@ -781,26 +781,26 @@ This is a configuration issue. Make a file called web.config in wwwroot and adap
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<system.webServer>
|
||||
<cors enabled="true" failUnlistedOrigins="false">
|
||||
<add origin="*">
|
||||
<cors enabled="true" failUnlistedOrigins="false">
|
||||
<add origin="*">
|
||||
<allowHeaders allowAllRequestedHeaders="true" />
|
||||
<allowMethods>
|
||||
<add method="GET" />
|
||||
<add method="POST" />
|
||||
<add method="PUT" />
|
||||
<add method="DELETE" />
|
||||
<add method="OPTIONS" />
|
||||
</allowMethods>
|
||||
<allowMethods>
|
||||
<add method="GET" />
|
||||
<add method="POST" />
|
||||
<add method="PUT" />
|
||||
<add method="DELETE" />
|
||||
<add method="OPTIONS" />
|
||||
</allowMethods>
|
||||
<exposeHeaders>
|
||||
</exposeHeaders>
|
||||
</exposeHeaders>
|
||||
</add>
|
||||
</cors>
|
||||
</system.webServer>
|
||||
</cors>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
```
|
||||
|
||||
#### ID obfuscation doesn't work (incorrect output, blank results image)
|
||||
ID obfuscation only works on 64-bit PHP (requires PHP_INT_SIZE to be 8).
|
||||
ID obfuscation only works on 64-bit PHP (requires PHP_INT_SIZE to be 8).
|
||||
Note that older versions of PHP 5 on Windows use PHP_INT_SIZE of 4, even if they're 64 bit. If you're in this situation, update your PHP install.
|
||||
|
||||
Also, make sure that the web server has write permission on the `results` folder.
|
||||
|
@ -818,7 +818,7 @@ Also, make sure that the web server has write permission on the `results` folder
|
|||
## Contributing
|
||||
Since this is an open source project, you can modify it.
|
||||
|
||||
If you made some changes that you think should make it into the main project, send a Pull Request on GitHub, or contact me at [info@fdossena.com](mailto:info@fdossena.com).
|
||||
If you made some changes that you think should make it into the main project, send a Pull Request on GitHub, or contact me at [info@fdossena.com](mailto:info@fdossena.com).
|
||||
We don't require you to use a specific coding convention, write the code however you want and we'll change the formatting if necessary.
|
||||
|
||||
Donations are also appreciated: you can donate with [PayPal](https://www.paypal.me/sineisochronic) or [Liberapay](https://liberapay.com/fdossena/donate).
|
||||
|
|
|
@ -120,7 +120,7 @@ In frontend mode, LibreSpeed serves clients the Web UI and a list of servers. To
|
|||
```
|
||||
Note: if a server only supports HTTP or HTTPS, specify the protocol in the server field. If it supports both, just use `//`.
|
||||
* Mount this file to `/servers.json` in the container (example at the end of this file)
|
||||
|
||||
|
||||
The test can be accessed on port 80.
|
||||
|
||||
Here's a list of additional environment variables available in this mode:
|
||||
|
|
|
@ -37,7 +37,7 @@ fi
|
|||
# Apply Telemetry settings when running in standalone or frontend mode and telemetry is enabled
|
||||
if [[ "$TELEMETRY" == "true" && ( "$MODE" == "frontend" || "$MODE" == "standalone" ) ]]; then
|
||||
cp -r /speedtest/results /var/www/html/results
|
||||
|
||||
|
||||
if [ "$MODE" == "frontend" ]; then
|
||||
mkdir /var/www/html/backend
|
||||
cp /speedtest/backend/getIP_util.php /var/www/html/backend
|
||||
|
@ -82,7 +82,7 @@ chown -R www-data /var/www/html/*
|
|||
# Allow selection of Apache port for network_mode: host
|
||||
if [ "$WEBPORT" != "80" ]; then
|
||||
sed -i "s/^Listen 80\$/Listen $WEBPORT/g" /etc/apache2/ports.conf
|
||||
sed -i "s/*:80>/*:$WEBPORT>/g" /etc/apache2/sites-available/000-default.conf
|
||||
sed -i "s/*:80>/*:$WEBPORT>/g" /etc/apache2/sites-available/000-default.conf
|
||||
fi
|
||||
|
||||
echo "Done, Starting APACHE"
|
||||
|
|
|
@ -70,7 +70,7 @@ function loadServers(){ //called when the page is fully loaded
|
|||
s.addTestPoints(SPEEDTEST_SERVERS);
|
||||
selectServer();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -55,5 +55,5 @@ if (!is_array($speedtest)) {
|
|||
echo '{}';
|
||||
}
|
||||
$speedtest = formatSpeedtestData($speedtest);
|
||||
|
||||
|
||||
echo json_encode(array('timestamp'=>$speedtest['timestamp'],'download'=>$speedtest['dl'],'upload'=>$speedtest['ul'],'ping'=>$speedtest['ping'],'jitter'=>$speedtest['jitter'],'ispinfo'=>$speedtest['ispinfo']));
|
||||
|
|
|
@ -171,7 +171,7 @@ echo ' ';
|
|||
print_r($pdo);
|
||||
if(!isset($pdo)){
|
||||
echo 'got nothing';
|
||||
}
|
||||
}
|
||||
if($pdo == false){
|
||||
echo 'got a false';
|
||||
}
|
||||
|
@ -186,4 +186,4 @@ if (($pdo instanceof PDO)) {
|
|||
$speedtest = getSpeedtestUserById(1);
|
||||
print_r ($speedtest);
|
||||
*/
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -15,7 +15,7 @@ function getPdo($returnErrorMessage = false)
|
|||
) {
|
||||
if($returnErrorMessage){
|
||||
return 'missing TELEMETRY_SETTINGS_FILE';
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ function getPdo($returnErrorMessage = false)
|
|||
if (!isset($db_type)) {
|
||||
if($returnErrorMessage){
|
||||
return "db_type not set in '" . TELEMETRY_SETTINGS_FILE . "'";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ function getPdo($returnErrorMessage = false)
|
|||
)) {
|
||||
if($returnErrorMessage){
|
||||
return "Required MSSQL database settings missing in '" . TELEMETRY_SETTINGS_FILE . "'";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ function getPdo($returnErrorMessage = false)
|
|||
) {
|
||||
if($returnErrorMessage){
|
||||
return "Required MSSQL database settings missing in '" . TELEMETRY_SETTINGS_FILE . "'";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
$dsn = 'sqlsrv:'
|
||||
|
@ -84,7 +84,7 @@ function getPdo($returnErrorMessage = false)
|
|||
)) {
|
||||
if($returnErrorMessage){
|
||||
return "Required mysql database settings missing in '" . TELEMETRY_SETTINGS_FILE . "'";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ function getPdo($returnErrorMessage = false)
|
|||
if (!isset($Sqlite_db_file)) {
|
||||
if($returnErrorMessage){
|
||||
return "Required sqlite database settings missing in '" . TELEMETRY_SETTINGS_FILE . "'";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ function getPdo($returnErrorMessage = false)
|
|||
)) {
|
||||
if($returnErrorMessage){
|
||||
return "Required postgresql database settings missing in '" . TELEMETRY_SETTINGS_FILE . "'";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -148,13 +148,13 @@ function getPdo($returnErrorMessage = false)
|
|||
} catch (Exception $e) {
|
||||
if($returnErrorMessage){
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if($returnErrorMessage){
|
||||
return "db_type '" . $db_type . "' not supported";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ function insertSpeedtestUser($ip, $ispinfo, $extra, $ua, $lang, $dl, $ul, $ping,
|
|||
if (!($pdo instanceof PDO)) {
|
||||
if($returnExceptionOnError){
|
||||
return new Exception("Failed to get database connection object");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ function insertSpeedtestUser($ip, $ispinfo, $extra, $ua, $lang, $dl, $ul, $ping,
|
|||
} catch (Exception $e) {
|
||||
if($returnExceptionOnError){
|
||||
return $e;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ function getSpeedtestUserById($id,$returnExceptionOnError = false)
|
|||
if (!($pdo instanceof PDO)) {
|
||||
if($returnExceptionOnError){
|
||||
return new Exception("Failed to get database connection object");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ function getSpeedtestUserById($id,$returnExceptionOnError = false)
|
|||
} catch (Exception $e) {
|
||||
if($returnExceptionOnError){
|
||||
return $e;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ CREATE TABLE [dbo].[speedtest_users](
|
|||
[ping] [nvarchar](max) NULL,
|
||||
[jitter] [nvarchar](max) NULL,
|
||||
[log] [nvarchar](max) NULL,
|
||||
CONSTRAINT [PK_speedtest_users] PRIMARY KEY CLUSTERED
|
||||
CONSTRAINT [PK_speedtest_users] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[id] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
|
|
|
@ -15,14 +15,14 @@ SET client_min_messages = warning;
|
|||
SET row_security = off;
|
||||
|
||||
--
|
||||
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
|
||||
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
|
||||
--
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
||||
|
||||
|
||||
--
|
||||
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
|
||||
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
|
||||
--
|
||||
|
||||
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
||||
|
@ -68,7 +68,7 @@ CREATE SEQUENCE speedtest_users_id_seq
|
|||
CACHE 1;
|
||||
|
||||
-- Commented out the following line because it assumes the user of the speedtest server, @bplower
|
||||
-- ALTER TABLE speedtest_users_id_seq OWNER TO speedtest;
|
||||
-- ALTER TABLE speedtest_users_id_seq OWNER TO speedtest;
|
||||
|
||||
--
|
||||
-- Name: speedtest_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: speedtest
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
/*
|
||||
This is the main interface between your webpage and the speed test.
|
||||
It hides the speed test web worker to the page, and provides many convenient functions to control the test.
|
||||
|
||||
|
||||
The best way to learn how to use this is to look at the basic example, but here's some documentation.
|
||||
|
||||
|
||||
To initialize the test, create a new Speedtest object:
|
||||
var s=new Speedtest();
|
||||
Now you can think of this as a finite state machine. These are the states (use getState() to see them):
|
||||
|
@ -36,7 +36,7 @@
|
|||
- ulProgress: progress of the upload test as a float 0-1
|
||||
- pingProgress: progress of the ping/jitter test as a float 0-1
|
||||
- testState: state of the test (-1=not started, 0=starting, 1=download test, 2=ping+jitter test, 3=upload test, 4=finished, 5=aborted)
|
||||
- clientIp: IP address of the client performing the test (and optionally ISP and distance)
|
||||
- clientIp: IP address of the client performing the test (and optionally ISP and distance)
|
||||
At the end of the test, the onend function will be called, with a boolean specifying whether the test was aborted or if it ended normally.
|
||||
The test can be aborted at any time with abort().
|
||||
At the end of the test, it will move to state 4
|
||||
|
|
Loading…
Reference in a new issue