diff --git a/.gitignore b/.gitignore index d18402de..9a0bac94 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc .*.swp +.DS_Store diff --git a/modules/speedtestv2.py b/modules/speedtestv2.py new file mode 100644 index 00000000..797ae771 --- /dev/null +++ b/modules/speedtestv2.py @@ -0,0 +1,12 @@ +# Copyright 2018 dhtech +# +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file + + +def generate(host, *args): + + info = {} + return {'speedtestv2': info} + +# vim: ts=4: sts=4: sw=4: expandtab diff --git a/modules/speedtestv2/files/Speed-Test-main/.gitignore b/modules/speedtestv2/files/Speed-Test-main/.gitignore new file mode 100644 index 00000000..e43b0f98 --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/modules/speedtestv2/files/Speed-Test-main/License.md b/modules/speedtestv2/files/Speed-Test-main/License.md new file mode 100644 index 00000000..b93a9207 --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/License.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 OpenSpeedTest™ + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/modules/speedtestv2/files/Speed-Test-main/README.md b/modules/speedtestv2/files/Speed-Test-main/README.md new file mode 100644 index 00000000..f932c0a8 --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/README.md @@ -0,0 +1,496 @@ +# **[SpeedTest by OpenSpeedTest™](https://openspeedtest.com?Run&ref=Github)** - Free & Open-Source HTML5 Network Performance Estimation Tool. + + + +SpeedTest by OpenSpeedTest™ is a Free and Open-Source HTML5 Network Performance Estimation Tool Written in Vanilla Javascript and only uses built-in Web APIs like `XMLHttpRequest` `(XHR)`, `HTML`, `CSS`, `JS`, & `SVG`. No Third-Party frameworks or libraries are Required. All we need is a static web server like `NGINX`. I started this project in 2011 and moved to OpenSpeedTest.com dedicated Project/Domain Name in 2013. + + +[![Download OpenSpeedTest-Server V2.1](https://github.com/openspeedtest/v2-Test/raw/main/images/10G-S.gif)](https://go.openspeedtest.com/Server "Download OpenSpeedTest-Server V2.1") + Download from the Microsoft Store Download from the Mac App Store Download from the App Store Download from the Google Play Store Download from the Snap Store Download from the Docker Hub Download from the Helm Store Download from GitHub + +**No client-side software or plugin is required. You can run a network speed test from any device with a [Web Browser that is IE10 or newer.](https://www.youtube.com/watch?v=9f-OM_WQ7Bw&list=PLt-deStxFJOMEAs2O1lJhscMNzcg9E3Po&index=1)** + + Video Tutorial by Roberto Jorge Tech + Video Tutorial by LanPad + +## Why OpenSpeedTest + + + +### Secure by Design. + + + +OpenSpeedTest contains Only `STATIC` Files like `HTML`,`CSS` & `JS`. + +So you don't need to worry about Security Updates or Hidden Exploits that may compromise your secure environments. + + + +### Lightweight, High Performance. + + + +OpenSpeedTest is written in Vanilla JavaScript. No Third-Party frameworks or libraries were used. SpeedTest script file size is under 8kB gzip. The unexpected side effect of using Vanilla JavaScript is High Performance. + + + +### Run a speed test from Any Device. + + + +OpenSpeedTest will run on Any Web Browser that is IE10 or newer. + + + +### Ready for Any Display Size and Resolution. + + + +OpenSpeedTest User interface is written in SVG. + + + +# Create Your Own SpeedTest Server. + +### Server Requirements : + +`Nginx`, `Apache`, `IIS`, `Express`, or Any Web server that supports `HTTP/1.1` or newer. + +- Accept, `GET`, `POST`, `HEAD` & `OPTIONS`, Response `200 OK`. + +- Accept, `POST` to Static Files, Response `200 OK`. + +- `client_max_body_size`, 35 Megabytes or more. + +- Timeout greater than `60 seconds`. + +- Disable `Access logs` for Increasing server performance. + +- Improve `Time to First Byte` (TTFB) + +- Warning! If you run it behind a **[Reverse Proxy](https://github.com/openspeedtest/Speed-Test/issues/4#issuecomment-1229157193)**, you should increase the `post-body content length` to 35 megabytes. +- Supports `HTTP2` & `HTTP3`. +- `HTTP1.1` is recommended for achieving maximum performance. +- **[You Should Follow our Nginx Config.](https://github.com/openspeedtest/Nginx-Configuration)** + + + +# Or, You can use OpenSpeedTest-Server. + +OpenSpeedTest-Server is available for Windows, Mac, Linux, Android, iOS & Docker. +[![Download OpenSpeedTest-Server V2.1](https://open.cachefly.net/assets/images/OSTV2-SS.png)](https://go.openspeedtest.com/Server "Download OpenSpeedTest-Server V2.1") +#### Fully Optimized and ready to use applications. + Download from the Microsoft Store Download from the Mac App Store Download from the App Store Download from the Google Play Store Download from the Snap Store Download from the Docker Hub Download from the Helm Store Download from GitHub + + +### New features: + + + +1. Stress Test. (Continuous Speed Test) + + + +To enable the stress test. Pass `Stress` or `S` keyword as a URL parameter. + + + +```` + +http://192.168.1.5?Stress=Low + +```` + +After the `STRESS` or `S` keyword, you can specify the number of seconds you need to run the StressTest in seconds, or preset values such as `Low`, `Medium`, `High`, `VeryHigh`, `Extreme`, `Day`, and `Year`. Will run a speed test for `300`,`600`,`900`,`1800`,`3600`,`86400`,`31557600` seconds, respectively. Also, you can feed the first letter of each parameter and its values. + + +```` + +http://192.168.1.5?S=L + +```` + +`S=L` is the same as passing `Stress=low` + +Or you can specify the number of seconds eg:`5000` directly without any preset keywords. + + + +```` + +http://192.168.1.5?Stress=5000 + +```` + + + +2. Run a speed test automatically + + + +Run a speed test automatically on page load. + +```` + +http://192.168.1.5?Run + +```` + +Run a speed test automatically after a few seconds. + +```` + +http://192.168.1.5?Run=10 or http://192.168.1.5?R=10 + +```` + + + +You can pass multiple keywords, and it's not `Case-Sensitive`. + + + +```` + +http://192.168.1.5?Run&Stress=300 OR http://192.168.1.5?R&S=300 + +```` + +This will start a speed test immediately and run for `300 seconds` in each direction. That is 300 seconds for download and `300 seconds` for upload. + + + +3. Save results to a Database + + + +Edit `Index.html` + +```` + +var saveData = true; + +var saveDataURL = "//yourDatabase.Server.com:4500/save?data="; + +```` + +4. Add multiple servers. The app will choose one with the least latency automatically. + + + +Edit `Index.html` + +```` + +var openSpeedTestServerList = [ + +{"ServerName":"Home-Earth", "Download":"/downloading", "Upload":"/upload", "ServerIcon":"DefaultIcon"}, + +{"ServerName":"Home-Mars", "Download":"/downloading", "Upload":"/upload", "ServerIcon":"DefaultIcon"}, + +{"ServerName":"Home-Moon", "Download":"/downloading", "Upload":"/upload", "ServerIcon":"DefaultIcon"} + +]; + +```` + +5. Disable or change Overhead Compensation factor. + + + +```` + +http://192.168.1.5?clean + +```` + +Overhead Compensation factor, This is browser based test, Many Unknowns. Currently 4%. That is within the margin of error. + +You can pass `Clean` or `C` as a URL Parameter and reset Overhead Compensation factor to Zero or set any value between 0 and 4. 1 = 1% to 4 = 4%. + +`Clean` will not accept values above 4, so Compensation is limited to maximum 4%. + + + +6. Change the default limit of 6 parallel HTTP connections to the Server. + + + +```` + +http://192.168.1.5?XHR=3 OR http://192.168.1.5?X=3 + +```` + +Allow the user to Change the default limit of 6 parallel HTTP connections to the Server. `XHR` will Accept values above 1 and max 32 + +pass `XHR` or `X` as a URL Parameter. + + + +7. Select a different server to run a speed test. + + + +```` + +http://192.168.1.5?Host=http://192.168.55.1:90 OR http://192.168.1.5?h=http://192.168.55.1:90 + +```` + +Pass `Host` or `H` as a URL Parameter. + +`HOST` will Accept only valid HTTP URLs like `http://192.168.1.10:3000` or `https://yourHost.com`. + + + +8. Select and run one test at a time, `DOWNLOAD`, `UPLOAD`, or `PING`. + + + +```` + +http://192.168.1.5?Test=Upload OR http://192.168.1.5?T=U + +```` + +`TEST` Allow the user to select and run one test at a time, Download, Upload, or Ping. + +Pass `Test` or `T` as a URL Parameter. + + + +9. Set a PingTimeout dynamically by passing `Out` or `O` as a URL Parameter + + + +```` + +http://192.168.1.5?Out=7000 OR http://192.168.1.5?O=7000 + +```` + +If Server not responded within 5 Seconds for any requests we send ('pingSamples' times) + +We will show `Network Error`, You can change the limit here. + +In milliseconds, if you need to set `6 seconds`. Change the value to `6000`. + + + +10. Set the Number of ping samples by adding `Ping` or `P` as a URL Parameter + + + +```` + +http://192.168.1.5?Ping=500 OR http://192.168.1.5?P=500 + +```` + +More samples = more accurate representation. `Ping = 500` will send `501` requests to server to find the accurate ping value. +Take a look at index.html, you can set a custom ping sample size, threads, upload data size etc. + +## Self-hosted (On-Premise) / (Docker Image/Source Code) +### For Headless large-scale deployments. +You have two options here. If you need a custom deployment, use our source code along with a web server of your choice. I prefer Nginx, and you can find my [Nginx Configuration](https://github.com/openspeedtest/Nginx-Configuration) here. Or you can use our docker image. You can deploy it on your LAN/WAN with or without an active internet connection. + +**This is docker implementation using nginxinc/nginx-unprivileged:stable-alpine. uses significantly fewer resources.** + +- NGINX Docker image that runs NGINX as a non root, unprivileged user. + + ### Docker install instructions: + + Install Docker and run the following command! + +````bash + +sudo docker run --restart=unless-stopped --name openspeedtest -d -p 3000:3000 -p 3001:3001 openspeedtest/latest + +```` +#### Or use docker-compose.yml +```` +version: '3.3' +services: + speedtest: + restart: unless-stopped + container_name: openspeedtest + ports: + - '3000:3000' + - '3001:3001' + image: openspeedtest/latest +```` +- Warning! If you run it behind a **[Reverse Proxy](https://github.com/openspeedtest/Speed-Test/issues/4#issuecomment-1229157193)**, you should increase the `post-body content length` to 35 megabytes. + +- **[Follow our Nginx Config.](https://github.com/openspeedtest/Nginx-Configuration)** + +Now open your browser and direct it to: + +A: For **HTTP** use: `http://YOUR-SERVER-IP:3000` + +B: For **HTTPS** use: `https://YOUR-SERVER-IP:3001` + +#### Container-Port for http is 3000 +If you need to run this image on a different port for `HTTP`, Eg: change to `80` = `-p 80:3000` +#### Container-Port for https is 3001 +If you need to run this image on a different port for `HTTPS`, Eg: change to `443` = `-p 443:3001` + +### Setup Free LetsEncrypt SSL with Automatic Certificate Renewal +***Requirements*** +- PUBLIC IPV4 and/or IPV6 address. +- A domain name that resolves to speed test server's IP address. +- Email ID + +The following command will generate a Let's Encrypt certificate for your domain name and configure a cron job to automatically renew the certificate. + +```` +docker run -e ENABLE_LETSENCRYPT=True -e DOMAIN_NAME=speedtest.yourdomain.com -e USER_EMAIL=you@yourdomain.pro --restart=unless-stopped --name openspeedtest -d -p 80:3000 -p 443:3001 openspeedtest/latest +```` +#### Or use docker-compose.yml +```` +version: '3.3' +services: + speedtest: + environment: + - ENABLE_LETSENCRYPT=True + - DOMAIN_NAME=speedtest.yourdomain.com + - USER_EMAIL=you@yourdomain.pro + restart: unless-stopped + container_name: openspeedtest + ports: + - '80:3000' + - '443:3001' + image: openspeedtest/latest +```` + +### How to Use Your Own Secure Sockets Layer (SSL) Certificate, Self-Signed or Paid? +***Requirements*** +- Folder with your Certificate, Self-Signed or Paid. +- Rename .cet file and .key file to `nginx.crt` & `nginx.key` + + The folder needs to contain: + +- `nginx.crt` + +- `nginx.key` + + +```` +sudo docker run --restart=unless-stopped --name openspeedtest -d -p 3000:3000 -p 3001:3001 openspeedtest/latest +```` + +To mount a folder with your own SSL certificate to this Docker container, append the following line to the above command: + + +````bash + +-v /${PATH-TO-YOUR-OWN-SSL-CERTIFICATE}:/etc/ssl/ + +```` + +I am adding a folder with nginx.crt and nginx.key from my desktop by using the following command. + +````bash + +sudo docker run -v /Users/vishnu/Desktop/docker/:/etc/ssl/ --restart=unless-stopped --name openspeedtest -d -p 3000:3000 -p 3001:3001 openspeedtest/latest + +```` +#### Or use docker-compose.yml +```` +version: '3.3' +services: + speedtest: + volumes: + - '/Users/vishnu/Desktop/docker/:/etc/ssl/' + restart: unless-stopped + container_name: openspeedtest + ports: + - '3000:3000' + - '3001:3001' + image: openspeedtest/latest +```` +## Advanced Configuration Options + +- Container Port Configuration + +To enable port changes, set the `CHANGE_CONTAINER_PORTS` environment variable to `"True"` and provide appropriate values for the following variables. + +`CHANGE_CONTAINER_PORTS=True` + +`HTTP_PORT=3000` + +`HTTPS_PORT=3001` + +- Set User + +`SET_USER=101` + +- Only Allow `CORS Request` from listed domains. + +`ALLOW_ONLY=domain1.com;domain2.com;domain3.com` + +- `SET_SERVER_NAME` Display the server name on the UI. + +`SET_SERVER_NAME=HOME-NAS` + + +Docker images run better on Linux Platforms, including your NAS. But if you install docker on macOS or Windows, you may see poor performance. I asked this on Docker forums, and they told me macOS and Windows support is for Development purposes only. For Production, you need to use any Linux Platform. + +The same Story goes for Windows NGINX. Nginx uses only one worker even if you specify n number of worker processes. They will show in Task Manager, but the system will only use one. I got this information directly from the Nginx website. + + + + + +## Why do you need to Create Your Own SpeedTest Server? + +You can run OpenSpeedTest Server in your Home Lab, Office Server or Cloud Server. So that you or employees who work from home can run a speed test to your office and make sure they can run everything smoothly. + + + +**Choosing between ISP1 & ISP2.** + + + +Sometimes your ISP2 is Faster than ISP1 when you test your speed on popular speed test sites. But when you connect to your Home/Office/Cloud, that slower connection may perform better. The only way to find out is to run a speed test against your infrastructure. + + + +**Troubleshooting network issues.** + + + +It is common even when your Internet connection is working fine, but some of the devices in your network may experience trouble getting decent connectivity to the internet. The issue might be the wrong VLAN ID or Faulty Switch. If you run a Local network speed test, you can find and fix these issues easily. + + + +**Before you add a repeater.** + + + +Most repeaters will reduce your network speed by 50%, so if you put it far away, it will perform worst, and if you put it too close, you will not get enough coverage if you run a Local Network speed test. Depending on the application requirements, you can decide exactly where you need to put your repeater. + + + +**Browsing experience.** + + + +Many useful browser extensions are out there that we all know and love. But some of them are really slowing you down for **few seconds per page you visit**. You may see good performance when you test your network performance via File Transfer or Command-line utilities, but you may experience poor performance when browsing the internet. This is due to a bad browser configuration that including unwanted extensions installed. From my experience, only keep the one you are going to use every single day. Extension that you may use once in a while should be removed or disabled for maximum performance. If you see poor performance, try OpenSpeedTest from Private Window or Incognito Window. **This tool can be used to check the browser performance and impact of Extensions on your browsing experience.** + + + +**No client-side software or plugin is required. You can run a network speed test from any device with a [Web Browser that is IE10 or newer.](https://www.youtube.com/watch?v=9f-OM_WQ7Bw&list=PLt-deStxFJOMEAs2O1lJhscMNzcg9E3Po&index=1)** + +- Like this Project? Please **Donate NOW & Keep us Alive** -> https://go.openspeedtest.com/Donate + +MIT License + +Copyright (c) 2013 - 2023 OpenSpeedTest™ + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/css/app.css b/modules/speedtestv2/files/Speed-Test-main/assets/css/app.css new file mode 100644 index 00000000..39fa9393 --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/assets/css/app.css @@ -0,0 +1,382 @@ +/* roboto-regular - latin */ +@font-face { + font-family: "Roboto"; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url("..fonts/roboto-v30-latin-regular.eot"); /* IE9 Compat Modes */ + src: local(""), + url("../fonts/roboto-v30-latin-regular.eot?#iefix") + format("embedded-opentype"), + /* IE6-IE8 */ url("../fonts/roboto-v30-latin-regular.woff2") + format("woff2"), + /* Super Modern Browsers */ + url("../fonts/roboto-v30-latin-regular.woff") format("woff"), + /* Modern Browsers */ url("../fonts/roboto-v30-latin-regular.ttf") + format("truetype"), + /* Safari, Android, iOS */ + url("../fonts/roboto-v30-latin-regular.svg#Roboto") format("svg"); /* Legacy iOS */ +} +/* roboto-500 - latin */ +@font-face { + font-family: "Roboto"; + font-style: normal; + font-weight: 500; + font-display: swap; + src: url("assets/fonts/roboto-v30-latin-500.eot"); /* IE9 Compat Modes */ + src: local(""), + url("assets/fonts/roboto-v30-latin-500.eot?#iefix") + format("embedded-opentype"), + /* IE6-IE8 */ url("../fonts/roboto-v30-latin-500.woff2") + format("woff2"), + /* Super Modern Browsers */ url("../fonts/roboto-v30-latin-500.woff") + format("woff"), + /* Modern Browsers */ url("../fonts/roboto-v30-latin-500.ttf") + format("truetype"), + /* Safari, Android, iOS */ + url("../fonts/roboto-v30-latin-500.svg#Roboto") format("svg"); /* Legacy iOS */ +} + +body { + margin: 0px; + padding: 0px; + display: block; +} + +::-webkit-scrollbar { + display: none; +} +html { + -ms-overflow-style: none; + scrollbar-width: none; +} + +.Credits { +color: rgb(125 119 119); +text-align: center; +font-size:14px; +font-family: Roboto-Medium, Roboto; +font-weight: 500; +} +.Credits a { + text-decoration: none; + color: rgb(113, 113, 113); +} +.Credits a:hover { +color: #14b0fe; +} + +.ConnectError { + display: none; + +} + +.openSpeedtestApp { + + height: 100vh; + width: 100vw; + display: none; + overflow: hidden; +} +.main-Gaugebg { + fill: none; + stroke: rgb(231, 231, 232); + stroke-linecap: round; + stroke-linejoin: round; + stroke-width: 22px; + stroke-dasharray: 681; +} +.main-GaugeBlue { + fill: none; + stroke: url(#gradient); + stroke-linecap: round; + stroke-linejoin: round; + stroke-width: 22px; + stroke-dasharray: 681; + stroke-opacity: 0; +} +.main-GaugeWhite { + fill: none; + stroke: rgb(255, 255, 255); + stroke-linecap: round; + stroke-linejoin: round; + stroke-width: 15px; + stroke-dasharray: 0, 681; + stroke-dashoffset: 1; + stroke-opacity: 0; +} +.oDo-Meter { + font-size: 16.633283615112305px; + fill: gray; + font-family: Roboto-Medium, Roboto; + font-weight: 500; +} +.oDoLive-Speed { + font-size: 28px; + fill: #201e1e; + font-family: Roboto-Medium, Roboto; + font-weight: 500; + text-anchor: middle; +} + +.oDoLive-Status { + font-size: 10px; + fill: #d2d1d2; + font-family: Roboto-Medium, Roboto; + font-weight: 500; + text-anchor: middle; +} +.uiBg { + fill: #d2d1d2; +} +.progressbg { + stroke: rgb(231, 231, 232); + stroke-width: 8px; + stroke-linecap: round; + stroke-linejoin: round; + stroke-dasharray: 400; + stroke-dashoffset: 0; +} +.Cards { + fill: #f2f2f2; +} +.Symbol { + fill: url(#gradient); +} +.rtext { + font-size: 12px; + fill: #333; + font-family: Roboto-Medium, Roboto; + font-weight: 500; +} +.rtextnum { + font-size: 23px; + fill: #201e1e; + font-family: Roboto-Medium, Roboto; + font-weight: 500; + text-anchor: middle; +} +.rtextmbms { + font-size: 12px; + fill: #5f5f5f; + font-family: Roboto-Medium, Roboto; + font-weight: 500; + text-anchor: middle; +} +.jitter-Mob { + font-size: 9px; + fill: #5f5f5f; + font-family: Roboto-Medium, Roboto; + font-weight: 500; + text-anchor: middle; +} +.startButton { + fill: url(#RadialGradient1); + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + -webkit-tap-highlight-color: transparent; + cursor: pointer; + pointer-events: visible; +} +.buttonTxt { + font-size: 40px; + fill: #ffffff; + font-family: Roboto-Medium, Roboto; + font-weight: 500; + text-anchor: middle; +} + +.intro-Progress { + stroke: #56c4fb; + stroke-width: 8px; + stroke-linecap: round; + stroke-linejoin: round; + stroke-dasharray: 400; + stroke-dashoffset: 0; +} +.progressElmstart { + stroke: #56c4fb; + stroke-width: 8px; + stroke-linecap: round; + stroke-linejoin: round; + stroke-dasharray: 400; + stroke-dashoffset: 0; + display: block; +} +.Startsettings { + fill: url(#RadialGradient1); + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + -webkit-tap-highlight-color: transparent; + cursor: pointer; + pointer-events: visible; + opacity: 0.1; + transition: opacity 1s ease-in-out; +} +.Startsettings:hover { + opacity: 1; +} + +.progressbg { + stroke: rgb(231, 231, 232); + stroke-width: 8px; + stroke-linecap: round; + stroke-linejoin: round; + stroke-dasharray: 400; + stroke-dashoffset: 0; +} +.deskStart { + fill: none; + stroke: rgb(231, 231, 232); + stroke-linecap: round; + stroke-linejoin: round; + stroke-width: 22px; + stroke-dasharray: 681; + stroke: url(#gradient); +} +#UI-Desk { + display: none; +} +#UI-Mob { + display: none; +} +.oDoTop-Speed { + font-size: 16.96px; + fill: gray; + font-family: Roboto-Medium, Roboto; + font-weight: 500; + text-anchor: end; +} +#upSymbolDesk { + fill: #14b0fe; + display: none; +} +#downSymbolDesk { + fill: #14b0fe; + display: none; +} +#upSymbolMob { + fill: #14b0fe; + display: none; +} +#downSymbolMob { + fill: #14b0fe; + display: none; +} + +#ipMob { + font-size: 15px; + fill: #201e1e; + font-family: Roboto-Medium, Roboto; + font-weight: 500; + text-anchor: middle; + display: none; +} +#ipDesk { + font-size: 15px; + fill: #201e1e; + font-family: Roboto-Medium, Roboto; + font-weight: 500; + text-anchor: middle; + display: none; +} + +.spinner { + position: absolute; + z-index: 999; + top: 50vh; + left: 50vw; + text-align: center; +} + +.spinner > div { + width: 20px; + height: 20px; + background-color: #2196f3; + + border-radius: 100%; + display: inline-block; + -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both; + animation: sk-bouncedelay 1.4s infinite ease-in-out both; +} + +.spinner .bounce1 { + -webkit-animation-delay: -0.32s; + animation-delay: -0.32s; +} + +.spinner .bounce2 { + -webkit-animation-delay: -0.16s; + animation-delay: -0.16s; +} + +@-webkit-keyframes sk-bouncedelay { + 0%, + 80%, + 100% { + -webkit-transform: scale(0); + } + 40% { + -webkit-transform: scale(1); + } +} + +@keyframes sk-bouncedelay { + 0%, + 80%, + 100% { + -webkit-transform: scale(0); + transform: scale(0); + } + 40% { + -webkit-transform: scale(1); + transform: scale(1); + } +} + +.darkmode { + margin-bottom: -15px; + fill: #75757a99; + padding-top: 16px; + display: none; + cursor: pointer; + margin-right: 30px; +} +#daymode { + margin-right: 40px; +} +.darkmode:hover { + fill: #000000; +} + +.Mobile, +.Desktop { + visibility: hidden; + width: 100vw; + height: 100vh; +} + +@media only screen and (orientation: landscape) { + .Mobile { + visibility: hidden; + } + .Desktop { + visibility: visible; + } +} + +@media only screen and (orientation: portrait) { + .spinner { + top: 42vh; + left: 42vw; + } + .Mobile { + visibility: visible; + } + .Desktop { + visibility: hidden; + } +} +@media only screen and (max-width: 300px) { + .Credits{ + display: none; + } +} diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/css/darkmode.css b/modules/speedtestv2/files/Speed-Test-main/assets/css/darkmode.css new file mode 100644 index 00000000..14fef300 --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/assets/css/darkmode.css @@ -0,0 +1,45 @@ +body { + background-color: #181818; +} +#ipDesk { + fill: aliceblue; +} + +.oDoLive-Speed { + fill: #ffffff; +} +.oDoLive-Status { + fill: aliceblue; +} +#ipMob { + fill: aliceblue; +} +.rtextnum { + fill: #ffffff; +} +.rtextmbms { + fill: #ffffff; +} +.rtext { + fill: #ffffff; +} +.Cards { + fill: #000000; +} + +.main-Gaugebg { + stroke: #000000; +} +.uiBg { + fill: #000000; +} +.progressbg { + stroke: #202020; +} +.jitter-Mob { + fill: #ffffff; +} + +.ConnectError { + fill: #ffffff; +} diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.eot b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.eot new file mode 100644 index 00000000..fec03612 Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.eot differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.svg b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.svg new file mode 100644 index 00000000..67eecf44 --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.svg @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.ttf b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.ttf new file mode 100644 index 00000000..4f515e2a Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.ttf differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.woff b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.woff new file mode 100644 index 00000000..d39bb52a Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.woff differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.woff2 b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.woff2 new file mode 100644 index 00000000..29342a8d Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-500.woff2 differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.eot b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.eot new file mode 100644 index 00000000..c244b089 Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.eot differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.svg b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.svg new file mode 100644 index 00000000..627f5a36 --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.svg @@ -0,0 +1,308 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.ttf b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.ttf new file mode 100644 index 00000000..d0e63254 Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.ttf differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.woff b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.woff new file mode 100644 index 00000000..9eaa94f9 Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.woff differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.woff2 b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.woff2 new file mode 100644 index 00000000..020729ef Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/fonts/roboto-v30-latin-regular.woff2 differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/app.svg b/modules/speedtestv2/files/Speed-Test-main/assets/images/app.svg new file mode 100644 index 00000000..01441ac0 --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/assets/images/app.svg @@ -0,0 +1,459 @@ + + + + + + + + + + + + + 0 + .5 + 1 + 10 + 100 + 500 + 1000+ + ... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DOWNLOAD + + + + + UPLOAD + + + + + + + + + + PING + + + + JITTER + + + --- + Mbps + + + --- + Mbps + + + -- + ms + + + -- + ms + + + + + + + + + -- + Jitter + -- + ms + + + + + + + + + + + + Start + + + + + + + + + + + + + + + + + + + Network Error + + + + SpeedTest by OpenSpeedTest™️ + + + + + + + + + + + + + + + + + + + + + HTML5 Network Performance Estimation Tool. by OpenSpeedTest™ + + + + + + The download speed is how fast you can pull data from the server to you in the form of images, videos, text and more. Activities such as listening to music on Spotify, downloading large files or streaming videos on Netflix all require you to download data. + + + The upload speed is how fast you send data from you to others in the form of images, videos, text and more. Activities such as uploading to YouTube or Sending email, playing live games like PubG, Voice and Video calling a friend require fast upload speeds for you to send data to someone else’s server. + + + Ping "Round-trip time" is more or less well defined as the network delay from point A to B and back. This is the sum of all encoding, queueing, processing, decoding, and propagation delays in both directions. Essentially, it's the delay when A may be expecting an answer from B for a request that requires very little processing. A fast ping means a more responsive connection, especially in applications where timing is everything (like video games). Ping is measured in Milliseconds (ms). Jitter is simply the difference in Ping "Round-trip time" . In other words, jitter is measuring time difference in packet inter-arrival time. Jitter helps diagnose internet connection stability. The higher the jitter value, the worse the stability of the connection. + + + + + + + + + Download speed is measured in megabits per second (Mbps). + + + Upload speed is measured in megabits per second (Mbps). + + + + + Ping is measured in Milliseconds (ms). + + + Jitter is measured in Milliseconds (ms). + + + + + Shows you real-time network traffic graph for Upload! + + + Shows you real-time network traffic graph for Download! + + + Your download speed! + + + Your upload speed! + + + Your ping! + + + Your jitter! + + + + + + + + + + Download speed is measured in megabits per second (Mbps). + + + Upload speed is measured in megabits per second (Mbps). + + + + + Ping is measured in Milliseconds (ms). + + + Jitter is measured in Milliseconds (ms). + + + + + Shows you real-time network traffic graph for Upload! + + + Shows you real-time network traffic graph for Download! + + + Your download speed! + + + Your upload speed! + + + Your ping! + + + Your jitter! + + + + + Click here to Run a Speed Test! Or Press "Enter" + + + Options + + + + + + HTML5 Network Performance Estimation Tool. by OpenSpeedTest™ + + + + + + The download speed is how fast you can pull data from the server to you in the form of images, videos, text and more. Activities such as listening to music on Spotify, downloading large files or streaming videos on Netflix all require you to download data. + + + The upload speed is how fast you send data from you to others in the form of images, videos, text and more. Activities such as uploading to YouTube or Sending email, playing live games like PubG, Voice and Video calling a friend require fast upload speeds for you to send data to someone else’s server. + + + Ping "Round-trip time" is more or less well defined as the network delay from point A to B and back. This is the sum of all encoding, queueing, processing, decoding, and propagation delays in both directions. Essentially, it's the delay when A may be expecting an answer from B for a request that requires very little processing. A fast ping means a more responsive connection, especially in applications where timing is everything (like video games). Ping is measured in Milliseconds (ms). Jitter is simply the difference in Ping "Round-trip time" . In other words, jitter is measuring time difference in packet inter-arrival time. Jitter helps diagnose internet connection stability. The higher the jitter value, the worse the stability of the connection. + + + + + + + + + Download speed is measured in megabits per second (Mbps). + + + Upload speed is measured in megabits per second (Mbps). + + + Ping is measured in Milliseconds (ms). + + + + + + Shows you real-time network traffic graph for Download! + + + Upload speed is measured in megabits per second (Mbps). + + + Your ping! and Jitter + + + Your upload speed! + + + Your download speed! + + + + + + + + + Click here to run a speed! + + + Options + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/android-chrome-192x192.png b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/android-chrome-192x192.png new file mode 100644 index 00000000..df78b83c Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/android-chrome-192x192.png differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/android-chrome-512x512.png b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/android-chrome-512x512.png new file mode 100644 index 00000000..559d3eaf Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/android-chrome-512x512.png differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/apple-touch-icon.png b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/apple-touch-icon.png new file mode 100644 index 00000000..14aec788 Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/apple-touch-icon.png differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/browserconfig.xml b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/browserconfig.xml new file mode 100644 index 00000000..ef1658c6 --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #ffc40d + + + diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/favicon-16x16.png b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/favicon-16x16.png new file mode 100644 index 00000000..0dd76a80 Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/favicon-16x16.png differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/favicon-32x32.png b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/favicon-32x32.png new file mode 100644 index 00000000..e3ad7510 Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/favicon-32x32.png differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/favicon.ico b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/favicon.ico new file mode 100644 index 00000000..bebc1524 Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/favicon.ico differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/launcher-icon-1x.png b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/launcher-icon-1x.png new file mode 100644 index 00000000..50bdeae8 Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/launcher-icon-1x.png differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/launcher-icon-2x.png b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/launcher-icon-2x.png new file mode 100644 index 00000000..98687998 Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/launcher-icon-2x.png differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/launcher-icon-3x.png b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/launcher-icon-3x.png new file mode 100644 index 00000000..b612922b Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/launcher-icon-3x.png differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/launcher-icon-4x.png b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/launcher-icon-4x.png new file mode 100644 index 00000000..5936c147 Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/launcher-icon-4x.png differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/mstile-150x150.png b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/mstile-150x150.png new file mode 100644 index 00000000..eb66ae2b Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/mstile-150x150.png differ diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/safari-pinned-tab.svg b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/safari-pinned-tab.svg new file mode 100644 index 00000000..e525e9b4 --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/safari-pinned-tab.svg @@ -0,0 +1,108 @@ + + + + +Created by potrace 1.11, written by Peter Selinger 2001-2013 + + + + + + + + + + diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/site.webmanifest b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/site.webmanifest new file mode 100644 index 00000000..058491fb --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/assets/images/icons/site.webmanifest @@ -0,0 +1,22 @@ +{ + "name": "OpenSpeedTest", + "short_name": "Speed Test", + "icons": [ + { + "src": "/assets/images/icons/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/assets/images/icons/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone", + "start_url": "/" + + +} diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/js/app-2.5.4.js b/modules/speedtestv2/files/Speed-Test-main/assets/js/app-2.5.4.js new file mode 100644 index 00000000..f5b5b6e4 --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/assets/js/app-2.5.4.js @@ -0,0 +1,1427 @@ +/* + Official Website : https://OpenSpeedTest.COM | Email: support@openspeedtest.com + Developed by : Vishnu | https://Vishnu.Pro | Email : me@vishnu.pro + Like this Project? Please Donate NOW & Keep us Alive -> https://go.openspeedtest.com/Donate + Speed Test by OpenSpeedTest™️ is Free and Open-Source Software (FOSS) with MIT License. + Read full license terms @ http://go.openspeedtest.com/License + If you have any Questions, ideas or Comments Please Send it via -> https://go.openspeedtest.com/SendMessage +*/ +window.onload = function() { + var appSVG = document.getElementById("OpenSpeedTest-UI"); + appSVG.parentNode.replaceChild(appSVG.contentDocument.documentElement, appSVG); + ostOnload(); + OpenSpeedTest.Start(); +}; +(function(OpenSpeedTest) { + var Status; + var ProG; + var Callback = function(callback) { + if (callback && typeof callback === "function") { + callback(); + } + }; + function _(el) { + if (!(this instanceof _)) { + return new _(el); + } + this.el = document.getElementById(el); + } + _.prototype.fade = function fade(type, ms, callback00) { + var isIn = type === "in", opacity = isIn ? 0 : 1, interval = 14, duration = ms, gap = interval / duration, self = this; + if (isIn) { + self.el.style.display = "block"; + self.el.style.opacity = opacity; + } + function func() { + opacity = isIn ? opacity + gap : opacity - gap; + self.el.style.opacity = opacity; + if (opacity <= 0) { + self.el.style.display = "none"; + } + if (opacity <= 0 || opacity >= 1) { + window.clearInterval(fading, Callback(callback00)); + } + } + var fading = window.setInterval(func, interval); + }; + var easeOutQuint = function(t, b, c, d) { + t /= d; + t--; + return c * (t * t * t * t * t + 1) + b; + }; + var easeOutCubic = function(t, b, c, d) { + t /= d; + t--; + return c * (t * t * t + 1) + b; + }; + var openSpeedtestShow = function() { + this.YourIP = _("YourIP"); + this.ipDesk = _("ipDesk"); + this.ipMob = _("ipMob"); + this.downSymbolDesk = _("downSymbolDesk"); + this.upSymbolDesk = _("upSymbolDesk"); + this.upSymbolMob = _("upSymbolMob"); + this.downSymbolMob = _("downSymbolMob"); + this.settingsMob = _("settingsMob"); + this.settingsDesk = _("settingsDesk"); + this.oDoLiveStatus = _("oDoLiveStatus"); + this.ConnectErrorMob = _("ConnectErrorMob"); + this.ConnectErrorDesk = _("ConnectErrorDesk"); + this.downResult = _("downResult"); + this.upRestxt = _("upRestxt"); + this.pingResult = _("pingResult"); + this.jitterDesk = _("jitterDesk"); + this.pingMobres = _("pingMobres"); + this.JitterResultMon = _("JitterResultMon"); + this.JitterResultms = _("JitterResultms"); + this.UI_Desk = _("UI-Desk"); + this.UI_Mob = _("UI-Mob"); + this.oDoTopSpeed = _("oDoTopSpeed"); + this.startButtonMob = _("startButtonMob"); + this.startButtonDesk = _("startButtonDesk"); + this.intro_Desk = _("intro-Desk"); + this.intro_Mob = _("intro-Mob"); + this.loader = _("loading_app"); + this.OpenSpeedtest = _("OpenSpeedtest"); + this.mainGaugebg_Desk = _("mainGaugebg-Desk"); + this.mainGaugeBlue_Desk = _("mainGaugeBlue-Desk"); + this.mainGaugeWhite_Desk = _("mainGaugeWhite-Desk"); + this.mainGaugebg_Mob = _("mainGaugebg-Mob"); + this.mainGaugeBlue_Mob = _("mainGaugeBlue-Mob"); + this.mainGaugeWhite_Mob = _("mainGaugeWhite-Mob"); + this.oDoLiveSpeed = _("oDoLiveSpeed"); + this.progressStatus_Mob = _("progressStatus-Mob"); + this.progressStatus_Desk = _("progressStatus-Desk"); + this.graphc1 = _("graphc1"); + this.graphc2 = _("graphc2"); + this.graphMob2 = _("graphMob2"); + this.graphMob1 = _("graphMob1"); + this.text = _("text"); + this.scale = [{degree:680, value:0}, {degree:570, value:0.5}, {degree:460, value:1}, {degree:337, value:10}, {degree:220, value:100}, {degree:115, value:500}, {degree:0, value:1000},]; + this.element = ""; + this.chart = ""; + this.polygon = ""; + this.width = 200; + this.height = 50; + this.maxValue = 0; + this.values = []; + this.points = []; + this.vSteps = 5; + this.measurements = []; + this.points = []; + }; + openSpeedtestShow.prototype.reset = function() { + this.element = ""; + this.chart = ""; + this.polygon = ""; + this.width = 200; + this.height = 50; + this.maxValue = 0; + this.values = []; + this.points = []; + this.vSteps = 5; + this.measurements = []; + this.points = []; + }; + openSpeedtestShow.prototype.ip = function() { + var Self = this; + if (Self.ipDesk.el.style.display === "block") { + Self.ipDesk.el.style.display = "none"; + Self.ipMob.el.style.display = "none"; + } else { + Self.ipDesk.el.style.display = "block"; + Self.ipMob.el.style.display = "block"; + } + }; + openSpeedtestShow.prototype.prePing = function() { + this.loader.fade("out", 500); + this.OpenSpeedtest.fade("in", 1000); + }; + openSpeedtestShow.prototype.app = function() { + this.loader.fade("out", 500, this.ShowAppIntro()); + }; + openSpeedtestShow.prototype.ShowAppIntro = function() { + this.OpenSpeedtest.fade("in", 1000); + }; + openSpeedtestShow.prototype.userInterface = function() { + var Self = this; + this.intro_Desk.fade("out", 1000); + this.intro_Mob.fade("out", 1000, this.ShowUI()); + }; + openSpeedtestShow.prototype.ShowUI = function() { + this.UI_Desk.fade("in", 1000); + this.UI_Mob.fade("in", 1000, uiLoaded); + function uiLoaded(argument) { + Status = "Loaded"; + console.log("Developed by Vishnu. Email --\x3e me@vishnu.pro"); + } + }; + openSpeedtestShow.prototype.Symbol = function(dir) { + if (dir == 0) { + this.downSymbolMob.el.style.display = "block"; + this.downSymbolDesk.el.style.display = "block"; + this.upSymbolMob.el.style.display = "none"; + this.upSymbolDesk.el.style.display = "none"; + } + if (dir == 1) { + this.downSymbolMob.el.style.display = "none"; + this.downSymbolDesk.el.style.display = "none"; + this.upSymbolMob.el.style.display = "block"; + this.upSymbolDesk.el.style.display = "block"; + } + if (dir == 2) { + this.downSymbolMob.el.style.display = "none"; + this.downSymbolDesk.el.style.display = "none"; + this.upSymbolMob.el.style.display = "none"; + this.upSymbolDesk.el.style.display = "none"; + } + }; + openSpeedtestShow.prototype.Graph = function(speed, select) { + if (!("remove" in Element.prototype)) { + Element.prototype.remove = function() { + if (this.parentNode) { + this.parentNode.removeChild(this); + } + }; + } + var Self = this; + var Remove; + if (select === 0) { + var Graphelement = this.graphc1.el; + Remove = "line"; + this.graphMob2.el.style.display = "none"; + this.graphMob1.el.style.display = "block"; + } else { + Graphelement = this.graphc2.el; + Remove = "line2"; + this.graphMob1.el.style.display = "none"; + this.graphMob2.el.style.display = "block"; + } + if (!isNaN(speed)) { + this.values.push(speed); + } else { + this.values.push(""); + } + function calcMeasure() { + for (x = 0; x < Self.vSteps; x++) { + var measurement = Math.ceil(Self.maxValue / Self.vSteps * (x + 1)); + Self.measurements.push(measurement); + } + Self.measurements.reverse(); + } + function createChart(element, values) { + calcMaxValue(); + calcPoints(); + calcMeasure(); + var removeLine = document.getElementsByClassName(Remove); + while (removeLine.length > 0) { + removeLine[0].remove(); + } + Self.polygon = document.createElementNS("http://www.w3.org/2000/svg", "polygon"); + Self.polygon.setAttribute("points", Self.points); + Self.polygon.setAttribute("class", Remove); + if (Self.values.length > 1) { + Graphelement.appendChild(Self.polygon); + } + } + function calcPoints() { + if (Self.values.length > 1) { + var points = "0," + Self.height + " "; + for (x = 0; x < Self.values.length; x++) { + var perc = Self.values[x] / Self.maxValue; + var steps = 130 / (Self.values.length - 1); + var point = (steps * x).toFixed(2) + "," + (Self.height - Self.height * perc).toFixed(2) + " "; + points += point; + } + points += "130," + Self.height; + Self.points = points; + } + } + var x; + function calcMaxValue() { + Self.maxValue = 0; + for (x = 0; x < Self.values.length; x++) { + if (Self.values[x] > Self.maxValue) { + Self.maxValue = Self.values[x]; + } + } + Self.maxValue = Math.ceil(Self.maxValue); + } + if (speed > 0) { + createChart(Graphelement, speed); + } + }; + openSpeedtestShow.prototype.progress = function(Switch, duration) { + var Self = this; + var Stop = duration; + var Stage = Switch; + var currTime = Date.now(); + var chan2 = 0 - 400; + var interval = setInterval(function() { + var timeNow = (Date.now() - currTime) / 1000; + var toLeft = easeOutCubic(timeNow, 400, 400, Stop); + var toRight = easeOutCubic(timeNow, 400, chan2, Stop); + if (Stage) { + Self.progressStatus_Desk.el.style.strokeDashoffset = toLeft; + Self.progressStatus_Mob.el.style.strokeDashoffset = toLeft; + } else { + Self.progressStatus_Desk.el.style.strokeDashoffset = toRight; + Self.progressStatus_Mob.el.style.strokeDashoffset = toRight; + } + if (timeNow >= Stop) { + clearInterval(interval); + ProG = "done"; + Self.progressStatus_Desk.el.style.strokeDashoffset = 800; + Self.progressStatus_Mob.el.style.strokeDashoffset = 800; + } + }, 14); + }; + openSpeedtestShow.prototype.mainGaugeProgress = function(currentSpeed) { + var Self = this; + var speed = currentSpeed; + if (speed < 0) { + speed = 0; + } + var mainGaugeOffset = Self.getNonlinearDegree(speed); + if (currentSpeed > 0) { + this.mainGaugeBlue_Desk.el.style.strokeOpacity = 1; + this.mainGaugeWhite_Desk.el.style.strokeOpacity = 1; + this.mainGaugeBlue_Mob.el.style.strokeOpacity = 1; + this.mainGaugeWhite_Mob.el.style.strokeOpacity = 1; + this.mainGaugeBlue_Desk.el.style.strokeDashoffset = mainGaugeOffset; + this.mainGaugeWhite_Desk.el.style.strokeDashoffset = mainGaugeOffset == 0 ? 1 : mainGaugeOffset + 1; + this.mainGaugeBlue_Mob.el.style.strokeDashoffset = mainGaugeOffset; + this.mainGaugeWhite_Mob.el.style.strokeDashoffset = mainGaugeOffset == 0 ? 1 : mainGaugeOffset + 1; + } + if (mainGaugeOffset == 0 && speed > 1000) { + this.mainGaugeBlue_Mob.el.style.strokeDashoffset = mainGaugeOffset >= 681 ? 681 : mainGaugeOffset; + this.mainGaugeWhite_Mob.el.style.strokeDashoffset = mainGaugeOffset == 0 ? 1 : mainGaugeOffset + 1; + this.mainGaugeWhite_Desk.el.style.strokeDashoffset = mainGaugeOffset == 0 ? 1 : mainGaugeOffset + 1; + this.mainGaugeBlue_Desk.el.style.strokeDashoffset = mainGaugeOffset >= 681 ? 681 : mainGaugeOffset; + } else if (mainGaugeOffset == 0 && speed <= 0) { + this.mainGaugeBlue_Mob.el.style.strokeDashoffset = 681.1; + this.mainGaugeWhite_Mob.el.style.strokeDashoffset = 0.1; + this.mainGaugeWhite_Desk.el.style.strokeDashoffset = 0.1; + this.mainGaugeBlue_Desk.el.style.strokeDashoffset = 681.1; + } + }; + openSpeedtestShow.prototype.showStatus = function(e) { + this.oDoLiveStatus.el.textContent = e; + }; + openSpeedtestShow.prototype.ConnectionError = function() { + this.ConnectErrorMob.el.style.display = "block"; + this.ConnectErrorDesk.el.style.display = "block"; + }; + openSpeedtestShow.prototype.uploadResult = function(upload) { + if (upload < 1) { + this.upRestxt.el.textContent = upload.toFixed(3); + } + if (upload >= 1 && upload < 9999) { + this.upRestxt.el.textContent = upload.toFixed(1); + } + if (upload >= 10000 && upload < 99999) { + this.upRestxt.el.textContent = upload.toFixed(1); + this.upRestxt.el.style.fontSize = "20px"; + } + if (upload >= 100000) { + this.upRestxt.el.textContent = upload.toFixed(1); + this.upRestxt.el.style.fontSize = "18px"; + } + }; + openSpeedtestShow.prototype.pingResults = function(data, Display) { + var ShowData = data; + if (Display === "Ping") { + if (ShowData >= 1 && ShowData < 10000) { + this.pingResult.el.textContent = Math.floor(ShowData); + this.pingMobres.el.textContent = Math.floor(ShowData); + } else if (ShowData >= 0 && ShowData < 1) { + if (ShowData == 0) { + ShowData = 0; + } + this.pingResult.el.textContent = ShowData; + this.pingMobres.el.textContent = ShowData; + } + } + if (Display === "Error") { + this.oDoLiveSpeed.el.textContent = ShowData; + } + }; + openSpeedtestShow.prototype.downloadResult = function(download) { + if (download < 1) { + this.downResult.el.textContent = download.toFixed(3); + } + if (download >= 1 && download < 9999) { + this.downResult.el.textContent = download.toFixed(1); + } + if (download >= 10000 && download < 99999) { + this.downResult.el.textContent = download.toFixed(1); + this.downResult.el.style.fontSize = "20px"; + } + if (download >= 100000) { + this.downResult.el.textContent = download.toFixed(1); + this.downResult.el.style.fontSize = "18px"; + } + }; + openSpeedtestShow.prototype.jitterResult = function(data, Display) { + var ShowData = data; + if (Display === "Jitter") { + if (ShowData >= 1 && ShowData < 10000) { + this.jitterDesk.el.textContent = Math.floor(ShowData); + if (ShowData >= 1 && ShowData < 100) { + this.JitterResultMon.el.textContent = Math.floor(ShowData); + } + if (ShowData >= 100) { + var kData = (ShowData / 1000).toFixed(1); + this.JitterResultMon.el.textContent = kData + "k"; + } + } else if (ShowData >= 0 && ShowData < 1) { + if (ShowData == 0) { + ShowData = 0; + } + this.jitterDesk.el.textContent = ShowData; + this.JitterResultMon.el.textContent = ShowData; + } + } + }; + openSpeedtestShow.prototype.LiveSpeed = function(data, Display) { + var ShowData = data; + if (Display === "countDown") { + var speed = ShowData.toFixed(0); + this.oDoLiveSpeed.el.textContent = speed; + return; + } + if (Display === "speedToZero") { + if (typeof ShowData == "number") { + ShowData = ShowData.toFixed(1); + } + if (ShowData <= 0) { + ShowData = 0; + } + this.oDoLiveSpeed.el.textContent = ShowData; + this.oDoTopSpeed.el.textContent = "1000+"; + this.oDoTopSpeed.el.style.fontSize = "16.9px"; + this.oDoTopSpeed.el.style.fill = "gray"; + return; + } + if (Display === "Ping") { + if (ShowData >= 1 && ShowData < 10000) { + this.oDoLiveSpeed.el.textContent = Math.floor(ShowData); + } else if (ShowData >= 0 && ShowData < 1) { + if (ShowData == 0) { + ShowData = 0; + } + this.oDoLiveSpeed.el.textContent = ShowData; + } + } else { + if (ShowData == 0) { + var speed = ShowData.toFixed(0); + this.oDoLiveSpeed.el.textContent = speed; + } + if (ShowData <= 1 && ShowData > 0) { + var speed = ShowData.toFixed(3); + this.oDoLiveSpeed.el.textContent = speed; + } + if (ShowData > 1) { + var speed = ShowData.toFixed(1); + this.oDoLiveSpeed.el.textContent = speed; + } + if (ShowData <= 1000) { + this.oDoTopSpeed.el.textContent = "1000+"; + this.oDoTopSpeed.el.style.fontSize = "16.9px"; + this.oDoTopSpeed.el.style.fill = "gray"; + } + if (ShowData >= 1010) { + this.oDoTopSpeed.el.textContent = Math.floor(ShowData / 1010) * 1000 + "+"; + this.oDoTopSpeed.el.style.fill = "gray"; + this.oDoTopSpeed.el.style.fontSize = "17.2px"; + } + } + }; + openSpeedtestShow.prototype.GaugeProgresstoZero = function(currentSpeed, status) { + var speed = currentSpeed; + var Self = this; + var duration = 3; + if (speed >= 0) { + var time = Date.now(); + var SpeedtoZero = 0 - speed; + var interval = setInterval(function() { + var timeNow = (Date.now() - time) / 1000; + var speedToZero = easeOutQuint(timeNow, speed, SpeedtoZero, duration); + Self.LiveSpeed(speedToZero, "speedToZero"); + Self.mainGaugeProgress(speedToZero); + if (timeNow >= duration || speedToZero <= 0) { + clearInterval(interval); + Self.LiveSpeed(0, "speedToZero"); + Self.mainGaugeProgress(0); + Status = status; + } + }, 16); + } + }; + openSpeedtestShow.prototype.getNonlinearDegree = function(mega_bps) { + var i = 0; + if (0 == mega_bps || mega_bps <= 0 || isNaN(mega_bps)) { + return 0; + } + while (i < this.scale.length) { + if (mega_bps > this.scale[i].value) { + i++; + } else { + return this.scale[i - 1].degree + (mega_bps - this.scale[i - 1].value) * (this.scale[i].degree - this.scale[i - 1].degree) / (this.scale[i].value - this.scale[i - 1].value); + } + } + return this.scale[this.scale.length - 1].degree; + }; + var openSpeedtestGet = function() { + this.OverAllTimeAvg = window.performance.now(); + this.SpeedSamples = []; + this.FinalSpeed; + }; + openSpeedtestGet.prototype.reset = function() { + this.OverAllTimeAvg = window.performance.now(); + this.SpeedSamples = []; + this.FinalSpeed = 0; + }; + openSpeedtestGet.prototype.ArraySum = function(Arr) { + var array = Arr; + if (array) { + var sum = array.reduce(function(A, B) { + if (typeof A === "number" && typeof B === "number") { + return A + B; + } + }, 0); + return sum; + } else { + return 0; + } + }; + openSpeedtestGet.prototype.AvgSpeed = function(Livespeed, Start, duration) { + var Self = this; + this.timeNow = (window.performance.now() - this.OverAllTimeAvg) / 1000; + this.FinalSpeed; + var StartRecoding = Start; + StartRecoding = duration - StartRecoding; + if (this.timeNow >= StartRecoding) { + if (Livespeed > 0) { + this.SpeedSamples.push(Livespeed); + } + Self.FinalSpeed = Self.ArraySum(Self.SpeedSamples) / Self.SpeedSamples.length; + } + return Self.FinalSpeed; + }; + openSpeedtestGet.prototype.uRandom = function(size, callback) { + var size = size; + var randomValue = new Uint32Array(262144); + function getRandom() { + var n = randomValue.length; + for (var i = 0; i < n; i++) { + randomValue[i] = Math.random() * 4294967296; + } + return randomValue; + } + var randomData = []; + var genData = function(dataSize) { + var dataSize = dataSize; + for (var i = 0; i < dataSize; i++) { + randomData[i] = getRandom(); + } + return randomData; + }; + return new Blob(genData(size), {type:"application/octet-stream"}, Callback(callback)); + }; + openSpeedtestGet.prototype.addEvt = function(o, e, f) { + o.addEventListener(e, f); + }; + openSpeedtestGet.prototype.remEvt = function(o, e, f) { + o.removeEventListener(e, f); + }; + var openSpeedtestEngine = function() { + var Get = new openSpeedtestGet(); + var Show = new openSpeedtestShow(); + Show.app(); + var SendData; + var myhostName = location.hostname; + var key; + var TestServerip; + var downloadSpeed; + var uploadSpeed; + var dataUsedfordl; + var dataUsedforul; + var pingEstimate; + var jitterEstimate; + var logData; + var return_data; + var ReQ = []; + var StartTime = []; + var CurrentTime = []; + var LiveSpeedArr; + var dLoaded = 0; + var uLoaded = 0; + var currentSpeed = 0; + var uploadTimeing; + var downloadTimeing; + var downloadTime; + var uploadTime; + var saveTestData; + var stop = 0; + function reSett() { + StartTime = 0; + CurrentTime = 0; + LiveSpeedArr = 0; + currentSpeed = 0; + } + var userAgentString; + if (window.navigator.userAgent) { + userAgentString = window.navigator.userAgent; + } else { + userAgentString = "Not Found"; + } + var ulFinal = ulDuration * 0.6; + var dlFinal = dlDuration * 0.6; + function setFinal() { + if (ulDuration * 0.6 >= 7) { + ulFinal = 7; + } + if (dlDuration * 0.6 >= 7) { + dlFinal = 7; + } + } + setFinal(); + var launch = true; + var init = true; + Get.addEvt(Show.settingsMob.el, "click", ShowIP); + Get.addEvt(Show.settingsDesk.el, "click", ShowIP); + Get.addEvt(Show.startButtonDesk.el, "click", runTasks); + Get.addEvt(Show.startButtonMob.el, "click", runTasks); + Get.addEvt(document, "keypress", hiEnter); + var addEvent = true; + var getParams = function(url) { + var params = {}; + var parser = document.createElement("a"); + parser.href = url; + var query = parser.search.substring(1); + var vars = query.split("&"); + for (var i = 0; i < vars.length; i++) { + var pair = vars[i].split("="); + params[pair[0]] = decodeURIComponent(pair[1]); + } + return params; + }; + var getCommand = getParams(window.location.href.toLowerCase()); + if (setPingSamples) { + if (typeof getCommand.ping === "string" || typeof getCommand.p === "string") { + var setPing; + if (typeof getCommand.ping !== "undefined") { + setPing = getCommand.ping; + } else if (typeof getCommand.p !== "undefined") { + setPing = getCommand.p; + } + if (setPing > 0) { + pingSamples = setPing; + pingSamples = setPing; + } + } + } + if (setPingTimeout) { + if (typeof getCommand.out === "string" || typeof getCommand.o === "string") { + var setOut; + if (typeof getCommand.out !== "undefined") { + setOut = getCommand.out; + } else if (typeof getCommand.o !== "undefined") { + setOut = getCommand.o; + } + if (setOut > 1) { + pingTimeOut = setOut; + pingTimeOut = setOut; + } + } + } + if (setHTTPReq) { + if (typeof getCommand.xhr === "string" || typeof getCommand.x === "string") { + var setThreads; + if (typeof getCommand.xhr !== "undefined") { + setThreads = getCommand.xhr; + } else if (typeof getCommand.x !== "undefined") { + setThreads = getCommand.x; + } + if (setThreads > 0 && setThreads <= 32) { + dlThreads = setThreads; + ulThreads = setThreads; + } + } + } + function isValidHttpUrl(str) { + var regex = /(?:https?):\/\/(\w+:?\w*)?(\S+)(:\d+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; + if (!regex.test(str)) { + return false; + } else { + return true; + } + } + if (selectServer) { + if (typeof getCommand.host === "string" || typeof getCommand.h === "string") { + var severAddress; + if (typeof getCommand.host !== "undefined") { + severAddress = getCommand.host; + } else if (typeof getCommand.h !== "undefined") { + severAddress = getCommand.h; + } + if (isValidHttpUrl(severAddress)) { + openSpeedTestServerList = [{ServerName:"Home", Download:severAddress + "/downloading", Upload:severAddress + "/upload", ServerIcon:"DefaultIcon",},]; + } + } + } + var custom = parseInt(getCommand.stress); + var customS = parseInt(getCommand.s); + var runStress; + var runStressCustom; + if (typeof getCommand.stress === "string") { + runStress = getCommand.stress; + runStressCustom = custom; + } else if (typeof getCommand.s === "string") { + runStress = getCommand.s; + runStressCustom = customS; + } + if (runStress && stressTest) { + if (runStress === "low" || runStress === "l") { + dlDuration = 300; + ulDuration = 300; + } + if (runStress === "medium" || runStress === "m") { + dlDuration = 600; + ulDuration = 600; + } + if (runStress === "high" || runStress === "h") { + dlDuration = 900; + ulDuration = 900; + } + if (runStress === "veryhigh" || runStress === "v") { + dlDuration = 1800; + ulDuration = 1800; + } + if (runStress === "extreme" || runStress === "e") { + dlDuration = 3600; + ulDuration = 3600; + } + if (runStress === "day" || runStress === "d") { + dlDuration = 86400; + ulDuration = 86400; + } + if (runStress === "year" || runStress === "y") { + dlDuration = 31557600; + ulDuration = 31557600; + } + if (custom > 12 || customS > 12) { + dlDuration = runStressCustom; + ulDuration = runStressCustom; + } + } + var overheadClean = parseInt(getCommand.clean); + var overheadCleanC = parseInt(getCommand.c); + var customOverHeadValue = 1; + if (overheadClean) { + customOverHeadValue = overheadClean; + } else if (overheadCleanC) { + customOverHeadValue = overheadCleanC; + } + if (enableClean) { + if (typeof getCommand.clean === "string" || typeof getCommand.c === "string") { + if (overheadClean >= 1 || overheadCleanC >= 1) { + if (overheadClean < 5 || overheadCleanC < 5) { + upAdjust = 1 + customOverHeadValue / 100; + dlAdjust = 1 + customOverHeadValue / 100; + } + } else { + upAdjust = 1; + dlAdjust = 1; + } + } + } + var OpenSpeedTestRun = parseInt(getCommand.run); + var OpenSpeedTestRunR = parseInt(getCommand.r); + var OpenSpeedTestStart; + if (enableRun) { + if (typeof getCommand.run === "string" || typeof getCommand.r === "string") { + if (OpenSpeedTestRun > 0) { + OpenSpeedTestStart = OpenSpeedTestRun; + } else if (OpenSpeedTestRunR > 0) { + OpenSpeedTestStart = OpenSpeedTestRunR; + } else { + OpenSpeedTestStart = 0; + } + } + } + if (OpenSpeedTestStart >= 0) { + if (launch) { + runTasks(); + } + } + var runTest = getCommand.test; + var runTestT = getCommand.t; + var SelectTest = false; + if (selectTest) { + if (typeof runTest === "string" || typeof runTestT === "string") { + var runTestC; + if (runTest) { + runTestC = runTest; + SelectTest = runTest; + } else if (runTestT) { + runTestC = runTestT; + SelectTest = runTestT; + } + if (runTestC === "download" || runTestC === "d") { + uploadSpeed = 0; + dataUsedforul = 0; + SelectTest = "Download"; + if (launch) { + runTasks(); + } + } else if (runTestC === "upload" || runTestC === "u") { + downloadSpeed = 0; + dataUsedfordl = 0; + SelectTest = "Upload"; + stop = 1; + if (launch) { + runTasks(); + } + } else if (runTestC === "ping" || runTestC === "p") { + uploadSpeed = 0; + dataUsedforul = 0; + downloadSpeed = 0; + dataUsedfordl = 0; + SelectTest = "Ping"; + if (launch) { + runTasks(); + } + } else { + SelectTest = false; + } + } + } + var Startit = 0; + function removeEvts() { + Get.remEvt(Show.settingsMob.el, "click", ShowIP); + Get.remEvt(Show.settingsDesk.el, "click", ShowIP); + Get.remEvt(Show.startButtonDesk.el, "click", runTasks); + Get.remEvt(Show.startButtonMob.el, "click", runTasks); + Get.remEvt(document, "keypress", hiEnter); + } + var requestIP = false; + function ShowIP() { + if (requestIP) { + Show.YourIP.el.textContent = "Please wait.."; + ServerConnect(7); + requestIP = false; + } + Show.ip(); + } + function runTasks() { + if (addEvent) { + removeEvts(); + addEvent = false; + } + if (OpenSpeedTestStart >= 0) { + launch = false; + Show.userInterface(); + init = false; + var AutoTme = Math.ceil(Math.abs(OpenSpeedTestStart)); + Show.showStatus("Automatic Test Starts in ..."); + var autoTest = setInterval(countDownF, 1000); + } + function countDownF() { + if (AutoTme >= 1) { + AutoTme = AutoTme - 1; + Show.LiveSpeed(AutoTme, "countDown"); + } else { + if (AutoTme <= 0) { + clearInterval(autoTest); + launch = true; + OpenSpeedTestStart = undefined; + runTasks(); + } + } + } + if (openSpeedTestServerList === "fetch" && launch === true) { + launch = false; + Show.showStatus("Fetching Server Info.."); + ServerConnect(6); + } + if (launch === true) { + if (SelectTest === "Ping") { + testRun(); + } else if (SelectTest === "Download") { + testRun(); + } else if (SelectTest === "Upload") { + testRun(); + } else if (SelectTest === false) { + testRun(); + } + } + } + var osttm = "\u2122"; + var myname = "OpenSpeedTest"; + var com = ".com"; + var ost = myname + osttm; + function hiEnter(e) { + if (e.key === "Enter") { + runTasks(); + } + } + var showResult = 0; + if (openChannel === "web") { + showResult = webRe; + requestIP = true; + } + if (openChannel === "widget") { + showResult = widgetRe; + requestIP = true; + } + if (openChannel === "selfwidget") { + showResult = widgetRe; + TestServerip = domainx; + myhostName = TestServerip; + } + if (openChannel === "dev") { + } + function testRun() { + if (init) { + Show.userInterface(); + init = false; + } + OpenSpeedtest(); + } + function OpenSpeedtest() { + if (openChannel === "widget" || openChannel === "web") { + ServerConnect(1); + } + function readyToUP() { + uploadTime = window.performance.now(); + upReq(); + } + var Engine = setInterval(function() { + if (Status === "Loaded") { + Status = "busy"; + sendPing(0); + } + if (Status === "Ping") { + Status = "busy"; + Show.showStatus("Milliseconds"); + } + if (Status === "Download") { + Show.showStatus("Initializing.."); + Get.reset(); + reSett(); + Show.reset(); + downloadTime = window.performance.now(); + downReq(); + Status = "initDown"; + } + if (Status === "Downloading") { + Show.Symbol(0); + if (Startit == 0) { + Startit = 1; + Show.showStatus("Testing download speed.."); + var extraTime = (window.performance.now() - downloadTime) / 1000; + dReset = extraTime; + Show.progress(1, dlDuration + 2.5); + dlDuration += extraTime; + } + downloadTimeing = (window.performance.now() - downloadTime) / 1000; + reportCurrentSpeed("dl"); + Show.showStatus("Mbps download"); + Show.mainGaugeProgress(currentSpeed); + Show.LiveSpeed(currentSpeed); + Show.Graph(currentSpeed, 0); + downloadSpeed = Get.AvgSpeed(currentSpeed, dlFinal, dlDuration); + if (downloadTimeing >= dlDuration && ProG == "done") { + if (SelectTest) { + Show.GaugeProgresstoZero(currentSpeed, "SendR"); + Show.showStatus("All done"); + Show.Symbol(2); + } else { + Show.GaugeProgresstoZero(currentSpeed, "Upload"); + } + Show.downloadResult(downloadSpeed); + dataUsedfordl = dLoaded; + stop = 1; + Status = "busy"; + reSett(); + Get.reset(); + } + } + if (Status == "Upload") { + if (stop === 1) { + Show.Symbol(1); + Status = "initup"; + Show.showStatus("Initializing.."); + Show.LiveSpeed("...", "speedToZero"); + SendData = Get.uRandom(ulDataSize, readyToUP); + if (SelectTest) { + Startit = 1; + } + } + } + if (Status === "Uploading") { + if (Startit == 1) { + Startit = 2; + Show.showStatus("Testing upload speed.."); + currentSpeed = 0; + Get.reset(); + Show.reset(); + var extraUTime = (window.performance.now() - uploadTime) / 1000; + uReset = extraUTime; + Show.progress(false, ulDuration + 2.5); + ulDuration += extraUTime; + } + Show.showStatus("Mbps upload"); + uploadTimeing = (window.performance.now() - uploadTime) / 1000; + reportCurrentSpeed("up"); + Show.mainGaugeProgress(currentSpeed); + Show.LiveSpeed(currentSpeed); + Show.Graph(currentSpeed, 1); + uploadSpeed = Get.AvgSpeed(currentSpeed, ulFinal, ulDuration); + if (uploadTimeing >= ulDuration && stop == 1) { + dataUsedforul = uLoaded; + Show.uploadResult(uploadSpeed); + Show.GaugeProgresstoZero(currentSpeed, "SendR"); + SendData = undefined; + Show.showStatus("All done"); + Show.Symbol(2); + Status = "busy"; + stop = 0; + } + } + if (Status === "Error") { + Show.showStatus("Check your network connection status."); + Show.ConnectionError(); + Status = "busy"; + clearInterval(Engine); + var dummyElement = document.createElement("div"); + dummyElement.innerHTML = ''; + var htmlAnchorElement = dummyElement.querySelector("a"); + Show.oDoLiveSpeed.el.textContent = "Network Error"; + var circleSVG = document.getElementById("oDoLiveSpeed"); + htmlAnchorElement.innerHTML = circleSVG.innerHTML; + circleSVG.innerHTML = dummyElement.innerHTML; + } + if (Status === "SendR") { + Show.showStatus("All done"); + var dummyElement = document.createElement("div"); + dummyElement.innerHTML = ''; + var htmlAnchorElement = dummyElement.querySelector("a"); + Show.oDoLiveSpeed.el.textContent = ost; + var circleSVG = document.getElementById("oDoLiveSpeed"); + htmlAnchorElement.innerHTML = circleSVG.innerHTML; + circleSVG.innerHTML = dummyElement.innerHTML; + if (location.hostname != myname.toLowerCase() + com) { + saveTestData = "https://" + myname.toLowerCase() + com + "/results/show.php?" + "&d=" + downloadSpeed.toFixed(3) + "&u=" + uploadSpeed.toFixed(3) + "&p=" + pingEstimate + "&j=" + jitterEstimate + "&dd=" + (dataUsedfordl / 1048576).toFixed(3) + "&ud=" + (dataUsedforul / 1048576).toFixed(3) + "&ua=" + userAgentString; + saveTestData = encodeURI(saveTestData); + var circleSVG2 = document.getElementById("resultsData"); + circleSVG2.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", saveTestData); + circleSVG2.setAttribute("target", "_blank"); + if (saveData) { + ServerConnect(5); + } + } else { + ServerConnect(3); + } + Status = "busy"; + clearInterval(Engine); + } + }, 100); + } + function downReq() { + for (var i = 0; i < dlThreads; i++) { + setTimeout(function(i) { + SendReQ(i); + }, dlDelay * i, i); + } + } + function upReq() { + for (var i = 0; i < ulThreads; i++) { + setTimeout(function(i) { + SendUpReq(i); + }, ulDelay * i, i); + } + } + var dLoad = 0; + var dDiff = 0; + var dTotal = 0; + var dtLoad = 0; + var dtDiff = 0; + var dtTotal = 0; + var dRest = 0; + var dReset; + var uReset; + var uLoad = 0; + var uDiff = 0; + var uTotal = 0; + var utLoad = 0; + var utDiff = 0; + var utTotal = 0; + var uRest = 0; + var dualReset; + var neXT = dlDuration * 1000 - 6000; + var dualupReset; + var neXTUp = ulDuration * 1000 - 6000; + function reportCurrentSpeed(now) { + if (now === "dl") { + var dTime = downloadTimeing * 1000; + if (dTime > dReset * 1000 + dlFinal / 2 * 1000 && dRest === 0) { + dRest = 1; + dtTotal = dtTotal * 0.01; + dTotal = dTotal * 0.01; + dualReset = dTime + 10000; + } + if (dTime >= dualReset && dualReset < neXT) { + dualReset += 10000; + dtTotal = dtTotal * 0.01; + dTotal = dTotal * 0.01; + } + dLoad = dLoaded <= 0 ? 0 : dLoaded - dDiff; + dDiff = dLoaded; + dTotal += dLoad; + dtLoad = dtDiff = 0 ? 0 : dTime - dtDiff; + dtDiff = dTime; + dtTotal += dtLoad; + if (dTotal > 0) { + LiveSpeedArr = dTotal / dtTotal / 125 * upAdjust; + currentSpeed = LiveSpeedArr; + } + } + if (now === "up") { + var Tym = uploadTimeing * 1000; + if (Tym > uReset * 1000 + ulFinal / 2 * 1000 && uRest === 0) { + uRest = 1; + utTotal = utTotal * 0.1; + uTotal = uTotal * 0.1; + dualupReset = Tym + 10000; + } + if (Tym >= dualupReset && dualupReset < neXTUp) { + dualupReset += 10000; + utTotal = utTotal * 0.1; + uTotal = uTotal * 0.1; + } + uLoad = uLoaded <= 0 ? 0 : uLoaded - uDiff; + uDiff = uLoaded; + uTotal += uLoad; + utLoad = utDiff = 0 ? 0 : Tym - utDiff; + utDiff = Tym; + utTotal += utLoad; + if (uTotal > 0) { + LiveSpeedArr = uTotal / utTotal / 125 * upAdjust; + currentSpeed = LiveSpeedArr; + } + } + } + function SendReQ(i) { + var lastLoaded = 0; + var OST = new XMLHttpRequest(); + ReQ[i] = OST; + ReQ[i].open("GET", fianlPingServer.Download + "?n=" + Math.random(), true); + ReQ[i].onprogress = function(e) { + if (stop === 1) { + ReQ[i].abort(); + ReQ[i] = null; + ReQ[i] = undefined; + delete ReQ[i]; + return false; + } + if (Status == "initDown") { + Status = "Downloading"; + } + var eLoaded = e.loaded <= 0 ? 0 : e.loaded - lastLoaded; + if (isNaN(eLoaded) || !isFinite(eLoaded) || eLoaded < 0) { + return false; + } + dLoaded += eLoaded; + lastLoaded = e.loaded; + }; + ReQ[i].onload = function(e) { + if (lastLoaded === 0) { + dLoaded += e.total; + } + if (Status == "initDown") { + Status = "Downloading"; + } + if (ReQ[i]) { + ReQ[i].abort(); + ReQ[i] = null; + ReQ[i] = undefined; + delete ReQ[i]; + } + if (stop === 0) { + SendReQ(i); + } + }; + ReQ[i].onerror = function(e) { + if (stop === 0) { + SendReQ(i); + } + }; + ReQ[i].responseType = "arraybuffer"; + ReQ[i].send(); + } + var uReQ = []; + function SendUpReq(i) { + var lastULoaded = 0; + var OST = new XMLHttpRequest(); + uReQ[i] = OST; + uReQ[i].open("POST", fianlPingServer.Upload + "?n=" + Math.random(), true); + uReQ[i].upload.onprogress = function(e) { + if (Status == "initup" && some === undefined) { + var some; + Status = "Uploading"; + } + if (uploadTimeing >= ulDuration) { + uReQ[i].abort(); + uReQ[i] = null; + uReQ[i] = undefined; + delete uReQ[i]; + return false; + } + var eLoaded = e.loaded <= 0 ? 0 : e.loaded - lastULoaded; + if (isNaN(eLoaded) || !isFinite(eLoaded) || eLoaded < 0) { + return false; + } + uLoaded += eLoaded; + lastULoaded = e.loaded; + }; + uReQ[i].onload = function() { + if (lastULoaded === 0) { + uLoaded += ulDataSize * 1048576; + if (uploadTimeing >= ulDuration) { + uReQ[i].abort(); + uReQ[i] = null; + uReQ[i] = undefined; + delete uReQ[i]; + return false; + } + } + if (Status == "initup" && some === undefined) { + var some; + Status = "Uploading"; + } + if (uReQ[i]) { + uReQ[i].abort(); + uReQ[i] = null; + uReQ[i] = undefined; + delete uReQ[i]; + } + if (stop === 1) { + SendUpReq(i); + } + }; + uReQ[i].onerror = function(e) { + if (uploadTimeing <= ulDuration) { + SendUpReq(i); + } + }; + uReQ[i].setRequestHeader("Content-Type", "application/octet-stream"); + if (i > 0 && uLoaded <= 17000) { + } else { + uReQ[i].send(SendData); + } + } + function sendPing() { + readServerList(); + } + var fianlPingServer; + var statusPing; + var statusPingFinal; + var statusJitter; + var statusJitterFinal; + var statusPingTest; + var pingSendStatus = -1; + var finalPing = []; + var pingServer = []; + var finalJitter = []; + var pingSendLength = openSpeedTestServerList.length; + function readServerList() { + pingSendLength = openSpeedTestServerList.length; + Status = "Ping"; + performance.clearResourceTimings(); + if (pingSendStatus < pingSendLength - 1) { + pingSendStatus++; + if (statusPingTest != "Stop") { + sendPingRequest(openSpeedTestServerList[pingSendStatus], readServerList); + } + } else { + if (pingServer.length >= 1) { + var finalLeastPingResult = Math.min.apply(Math, finalPing); + var finalLeastPingResultIndex = finalPing.indexOf(finalLeastPingResult); + fianlPingServer = pingServer[finalLeastPingResultIndex]; + statusPingFinal = finalLeastPingResult; + statusJitterFinal = finalJitter[finalLeastPingResultIndex]; + statusPingTest = "Busy"; + Show.LiveSpeed(statusPingFinal, "Ping"); + Show.pingResults(statusPingFinal, "Ping"); + Show.jitterResult(statusJitterFinal, "Jitter"); + pingEstimate = statusPingFinal; + jitterEstimate = statusJitterFinal; + if (SelectTest) { + if (SelectTest == "Ping") { + Status = "SendR"; + } else { + Status = SelectTest; + } + } else { + Status = "Download"; + } + } else { + if (pingServer.Download) { + } else { + Status = "Error"; + } + } + } + } + function sendPingRequest(serverListElm, callback) { + var pingSamplesSend = 0; + var pingResult = []; + var jitterResult = []; + function sendNewPingReq() { + if (pingSamplesSend < pingSamples) { + pingSamplesSend++; + if (statusPingTest != "Stop") { + PingRequest(); + } + } else { + if (pingResult.length > 1) { + jitterResult.sort(function(a, b) { + return a - b; + }); + jitterResult = jitterResult.slice(0, jitterResult.length * jitterFinalSample); + jitterResult = jitterResult.reduce(function(acc, val) { + return acc + val; + }, 0) / jitterResult.length; + var leastJitter = jitterResult.toFixed(1); + var leastPing = Math.min.apply(Math, pingResult); + finalPing.push(leastPing); + pingServer.push(serverListElm); + finalJitter.push(leastJitter); + if (typeof callback === "function") { + callback(); + } + } else { + if (typeof callback === "function") { + callback(); + } + } + } + } + function PingRequest() { + var OST = new XMLHttpRequest(); + var ReQ = OST; + if (statusPingTest != "Stop") { + ReQ.abort(); + } + ReQ.open(pingMethod, serverListElm[pingFile] + "?n=" + Math.random(), true); + ReQ.timeout = pingTimeOut; + var startTime = window.performance.now(); + ReQ.send(); + ReQ.onload = function() { + if (this.status === 200 && this.readyState === 4) { + var endTime = Math.floor(window.performance.now() - startTime); + var perfNum = performance.getEntries(); + perfNum = perfNum[perfNum.length - 1]; + var perfPing; + if (perfNum.initiatorType === "xmlhttprequest") { + perfPing = parseFloat(perfNum.duration.toFixed(1)); + } else { + perfPing = endTime; + } + if (pingSamplesSend > 250) { + perfPing = endTime; + } + if (perfPing <= 0) { + statusPing = 0.1; + pingResult.push(0.1); + } else { + statusPing = perfPing; + pingResult.push(perfPing); + } + if (pingResult.length > 1) { + var jitterCalc = Math.abs(pingResult[pingResult.length - 1] - pingResult[pingResult.length - 2]).toFixed(1); + jitterResult.push(parseFloat(jitterCalc)); + statusJitter = jitterCalc; + Show.LiveSpeed(perfPing, "Ping"); + Show.pingResults(perfPing, "Ping"); + Show.jitterResult(jitterCalc, "Jitter"); + } + sendNewPingReq(); + } + if (this.status === 404 && this.readyState === 4) { + pingSamplesSend++; + sendNewPingReq(); + } + }; + ReQ.onerror = function(e) { + pingSamplesSend++; + sendNewPingReq(); + }; + ReQ.ontimeout = function(e) { + pingSamplesSend++; + sendNewPingReq(); + }; + } + PingRequest(); + } + var ServerConnect = function(auth) { + var Self = this; + var xhr = new XMLHttpRequest(); + var url = OpenSpeedTestdb; + if (auth == 1) { + url = webIP; + } + if (auth == 5) { + url = saveDataURL; + } + if (auth == 7) { + url = get_IP; + } + xhr.open("POST", url, true); + xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xhr.onreadystatechange = function() { + if (xhr.readyState == 4 && xhr.status == 200) { + return_data = xhr.responseText.trim(); + if (auth == 2) { + key = return_data; + } + if (auth == 1) { + TestServerip = return_data; + } + if (auth == 3) { + setTimeout(function() { + location.href = showResult + return_data; + }, 1500); + } + if (auth == 6) { + openSpeedTestServerList = JSON.parse(return_data); + launch = true; + runTasks(); + } + if (auth == 7) { + Show.YourIP.el.textContent = return_data; + } + } + }; + if (auth == 2) { + logData = "r=n"; + } + if (auth == 3) { + logData = "r=l" + "&d=" + downloadSpeed + "&u=" + uploadSpeed + "&dd=" + dataUsedfordl / 1048576 + "&ud=" + dataUsedforul / 1048576 + "&p=" + pingEstimate + "&do=" + myhostName + "&S=" + key + "&sip=" + TestServerip + "&jit=" + jitterEstimate + "&ua=" + userAgentString; + } + if (auth == 5) { + logData = saveTestData; + } + if (auth == 6) { + logData = "r=s"; + } + xhr.send(logData); + }; + }; + OpenSpeedTest.Start = function() { + new openSpeedtestEngine(); + }; +})(window.OpenSpeedTest = window.OpenSpeedTest || {}); diff --git a/modules/speedtestv2/files/Speed-Test-main/assets/js/app-2.5.4.min.js b/modules/speedtestv2/files/Speed-Test-main/assets/js/app-2.5.4.min.js new file mode 100644 index 00000000..0df99a1f --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/assets/js/app-2.5.4.min.js @@ -0,0 +1,51 @@ +/* + Official Website : https://OpenSpeedTest.COM | Email: support@openspeedtest.com + Developed by : Vishnu | https://Vishnu.Pro | Email : me@vishnu.pro + Like this Project? Please Donate NOW & Keep us Alive -> https://go.openspeedtest.com/Donate + Speed Test by OpenSpeedTest™️ is Free and Open-Source Software (FOSS) with MIT License. + Read full license terms @ http://go.openspeedtest.com/License + If you have any Questions, ideas or Comments Please Send it via -> https://go.openspeedtest.com/SendMessage +*/ +window.onload=function(){var X=document.getElementById("OpenSpeedTest-UI");X.parentNode.replaceChild(X.contentDocument.documentElement,X);ostOnload();OpenSpeedTest.Start()}; +(function(X){function h(c){if(!(this instanceof h))return new h(c);this.el=document.getElementById(c)}var m,Ma,Na=function(c){c&&"function"===typeof c&&c()};h.prototype.fade=function(c,d,a){var f="in"===c,t=f?0:1,w=14/d,n=this;f&&(n.el.style.display="block",n.el.style.opacity=t);var q=window.setInterval(function(){t=f?t+w:t-w;n.el.style.opacity=t;0>=t&&(n.el.style.display="none");(0>=t||1<=t)&&window.clearInterval(q,Na(a))},14)};var Oa=function(c,d,a,f){c/=f;c--;return a*(c*c*c+1)+d},r=function(){this.YourIP= +h("YourIP");this.ipDesk=h("ipDesk");this.ipMob=h("ipMob");this.downSymbolDesk=h("downSymbolDesk");this.upSymbolDesk=h("upSymbolDesk");this.upSymbolMob=h("upSymbolMob");this.downSymbolMob=h("downSymbolMob");this.settingsMob=h("settingsMob");this.settingsDesk=h("settingsDesk");this.oDoLiveStatus=h("oDoLiveStatus");this.ConnectErrorMob=h("ConnectErrorMob");this.ConnectErrorDesk=h("ConnectErrorDesk");this.downResult=h("downResult");this.upRestxt=h("upRestxt");this.pingResult=h("pingResult");this.jitterDesk= +h("jitterDesk");this.pingMobres=h("pingMobres");this.JitterResultMon=h("JitterResultMon");this.JitterResultms=h("JitterResultms");this.UI_Desk=h("UI-Desk");this.UI_Mob=h("UI-Mob");this.oDoTopSpeed=h("oDoTopSpeed");this.startButtonMob=h("startButtonMob");this.startButtonDesk=h("startButtonDesk");this.intro_Desk=h("intro-Desk");this.intro_Mob=h("intro-Mob");this.loader=h("loading_app");this.OpenSpeedtest=h("OpenSpeedtest");this.mainGaugebg_Desk=h("mainGaugebg-Desk");this.mainGaugeBlue_Desk=h("mainGaugeBlue-Desk"); +this.mainGaugeWhite_Desk=h("mainGaugeWhite-Desk");this.mainGaugebg_Mob=h("mainGaugebg-Mob");this.mainGaugeBlue_Mob=h("mainGaugeBlue-Mob");this.mainGaugeWhite_Mob=h("mainGaugeWhite-Mob");this.oDoLiveSpeed=h("oDoLiveSpeed");this.progressStatus_Mob=h("progressStatus-Mob");this.progressStatus_Desk=h("progressStatus-Desk");this.graphc1=h("graphc1");this.graphc2=h("graphc2");this.graphMob2=h("graphMob2");this.graphMob1=h("graphMob1");this.text=h("text");this.scale=[{degree:680,value:0},{degree:570,value:.5}, +{degree:460,value:1},{degree:337,value:10},{degree:220,value:100},{degree:115,value:500},{degree:0,value:1E3}];this.polygon=this.chart=this.element="";this.width=200;this.height=50;this.maxValue=0;this.values=[];this.points=[];this.vSteps=5;this.measurements=[];this.points=[]};r.prototype.reset=function(){this.polygon=this.chart=this.element="";this.width=200;this.height=50;this.maxValue=0;this.values=[];this.points=[];this.vSteps=5;this.measurements=[];this.points=[]};r.prototype.ip=function(){"block"=== +this.ipDesk.el.style.display?(this.ipDesk.el.style.display="none",this.ipMob.el.style.display="none"):(this.ipDesk.el.style.display="block",this.ipMob.el.style.display="block")};r.prototype.prePing=function(){this.loader.fade("out",500);this.OpenSpeedtest.fade("in",1E3)};r.prototype.app=function(){this.loader.fade("out",500,this.ShowAppIntro())};r.prototype.ShowAppIntro=function(){this.OpenSpeedtest.fade("in",1E3)};r.prototype.userInterface=function(){this.intro_Desk.fade("out",1E3);this.intro_Mob.fade("out", +1E3,this.ShowUI())};r.prototype.ShowUI=function(){this.UI_Desk.fade("in",1E3);this.UI_Mob.fade("in",1E3,function(c){m="Loaded";console.log("Developed by Vishnu. Email --\x3e me@vishnu.pro")})};r.prototype.Symbol=function(c){0==c&&(this.downSymbolMob.el.style.display="block",this.downSymbolDesk.el.style.display="block",this.upSymbolMob.el.style.display="none",this.upSymbolDesk.el.style.display="none");1==c&&(this.downSymbolMob.el.style.display="none",this.downSymbolDesk.el.style.display="none",this.upSymbolMob.el.style.display= +"block",this.upSymbolDesk.el.style.display="block");2==c&&(this.downSymbolMob.el.style.display="none",this.downSymbolDesk.el.style.display="none",this.upSymbolMob.el.style.display="none",this.upSymbolDesk.el.style.display="none")};r.prototype.Graph=function(c,d){function a(q,M){for(n=f.maxValue=0;nf.maxValue&&(f.maxValue=f.values[n]);f.maxValue=Math.ceil(f.maxValue);if(1=d&&(clearInterval(t),Ma="done",a.progressStatus_Desk.el.style.strokeDashoffset=800,a.progressStatus_Mob.el.style.strokeDashoffset=800)},14)};r.prototype.mainGaugeProgress=function(c){var d=c;0>d&&(d=0);var a=this.getNonlinearDegree(d);0=d&&(this.mainGaugeBlue_Mob.el.style.strokeDashoffset=681.1,this.mainGaugeWhite_Mob.el.style.strokeDashoffset=.1,this.mainGaugeWhite_Desk.el.style.strokeDashoffset=.1,this.mainGaugeBlue_Desk.el.style.strokeDashoffset=681.1)};r.prototype.showStatus=function(c){this.oDoLiveStatus.el.textContent=c};r.prototype.ConnectionError=function(){this.ConnectErrorMob.el.style.display= +"block";this.ConnectErrorDesk.el.style.display="block"};r.prototype.uploadResult=function(c){1>c&&(this.upRestxt.el.textContent=c.toFixed(3));1<=c&&9999>c&&(this.upRestxt.el.textContent=c.toFixed(1));1E4<=c&&99999>c&&(this.upRestxt.el.textContent=c.toFixed(1),this.upRestxt.el.style.fontSize="20px");1E5<=c&&(this.upRestxt.el.textContent=c.toFixed(1),this.upRestxt.el.style.fontSize="18px")};r.prototype.pingResults=function(c,d){var a=c;"Ping"===d&&(1<=a&&1E4>a?(this.pingResult.el.textContent=Math.floor(a), +this.pingMobres.el.textContent=Math.floor(a)):0<=a&&1>a&&(0==a&&(a=0),this.pingResult.el.textContent=a,this.pingMobres.el.textContent=a));"Error"===d&&(this.oDoLiveSpeed.el.textContent=a)};r.prototype.downloadResult=function(c){1>c&&(this.downResult.el.textContent=c.toFixed(3));1<=c&&9999>c&&(this.downResult.el.textContent=c.toFixed(1));1E4<=c&&99999>c&&(this.downResult.el.textContent=c.toFixed(1),this.downResult.el.style.fontSize="20px");1E5<=c&&(this.downResult.el.textContent=c.toFixed(1),this.downResult.el.style.fontSize= +"18px")};r.prototype.jitterResult=function(c,d){var a=c;"Jitter"===d&&(1<=a&&1E4>a?(this.jitterDesk.el.textContent=Math.floor(a),1<=a&&100>a&&(this.JitterResultMon.el.textContent=Math.floor(a)),100<=a&&(a=(a/1E3).toFixed(1),this.JitterResultMon.el.textContent=a+"k")):0<=a&&1>a&&(0==a&&(a=0),this.jitterDesk.el.textContent=a,this.JitterResultMon.el.textContent=a))};r.prototype.LiveSpeed=function(c,d){var a=c;if("countDown"===d){var f=a.toFixed(0);this.oDoLiveSpeed.el.textContent=f}else"speedToZero"=== +d?("number"==typeof a&&(a=a.toFixed(1)),0>=a&&(a=0),this.oDoLiveSpeed.el.textContent=a,this.oDoTopSpeed.el.textContent="1000+",this.oDoTopSpeed.el.style.fontSize="16.9px",this.oDoTopSpeed.el.style.fill="gray"):"Ping"===d?1<=a&&1E4>a?this.oDoLiveSpeed.el.textContent=Math.floor(a):0<=a&&1>a&&(0==a&&(a=0),this.oDoLiveSpeed.el.textContent=a):(0==a&&(f=a.toFixed(0),this.oDoLiveSpeed.el.textContent=f),1>=a&&0=a&&(this.oDoTopSpeed.el.textContent="1000+",this.oDoTopSpeed.el.style.fontSize="16.9px",this.oDoTopSpeed.el.style.fill="gray"),1010<=a&&(this.oDoTopSpeed.el.textContent=1E3*Math.floor(a/1010)+"+",this.oDoTopSpeed.el.style.fill="gray",this.oDoTopSpeed.el.style.fontSize="17.2px"))};r.prototype.GaugeProgresstoZero=function(c,d){var a=this;if(0<=c)var f=Date.now(),t=0-c,w=setInterval(function(){var n=(Date.now()-f)/1E3;var q=n/3;q--;q=t*(q*q*q*q*q+1)+c;a.LiveSpeed(q,"speedToZero");a.mainGaugeProgress(q); +if(3<=n||0>=q)clearInterval(w),a.LiveSpeed(0,"speedToZero"),a.mainGaugeProgress(0),m=d},16)};r.prototype.getNonlinearDegree=function(c){var d=0;if(0==c||0>=c||isNaN(c))return 0;for(;dthis.scale[d].value)d++;else return this.scale[d-1].degree+(c-this.scale[d-1].value)*(this.scale[d].degree-this.scale[d-1].degree)/(this.scale[d].value-this.scale[d-1].value);return this.scale[this.scale.length-1].degree};var O=function(){this.OverAllTimeAvg=window.performance.now();this.SpeedSamples= +[];this.FinalSpeed};O.prototype.reset=function(){this.OverAllTimeAvg=window.performance.now();this.SpeedSamples=[];this.FinalSpeed=0};O.prototype.ArraySum=function(c){return c?c.reduce(function(d,a){if("number"===typeof d&&"number"===typeof a)return d+a},0):0};O.prototype.AvgSpeed=function(c,d,a){this.timeNow=(window.performance.now()-this.OverAllTimeAvg)/1E3;this.FinalSpeed;this.timeNow>=a-d&&(0=l&&(clearInterval(g),G=!0,Z=void 0,d())}Pa&&(x.remEvt(e.settingsMob.el,"click",c),x.remEvt(e.settingsDesk.el,"click",c),x.remEvt(e.startButtonDesk.el,"click",d),x.remEvt(e.startButtonMob.el,"click",d),x.remEvt(document,"keypress",a),Pa=!1);if(0<=Z){G=!1;e.userInterface();ua=!1;var l=Math.ceil(Math.abs(Z));e.showStatus("Automatic Test Starts in ...");var g=setInterval(b,1E3)}"fetch"===openSpeedTestServerList&&!0===G&&(G=!1,e.showStatus("Fetching Server Info.."),Y(6));!0===G&&("Ping"=== +A?f():"Download"===A?f():"Upload"===A?f():!1===A&&f())}function a(b){"Enter"===b.key&&d()}function f(){ua&&(e.userInterface(),ua=!1);t()}function t(){function b(){va=window.performance.now();n()}"widget"!==openChannel&&"web"!==openChannel||Y(1);var l=setInterval(function(){"Loaded"===m&&(m="busy",Q());"Ping"===m&&(m="busy",e.showStatus("Milliseconds"));"Download"===m&&(e.showStatus("Initializing.."),x.reset(),y=ha=0,e.reset(),wa=window.performance.now(),w(),m="initDown");if("Downloading"===m){e.Symbol(0); +if(0==aa){aa=1;e.showStatus("Testing download speed..");var g=(window.performance.now()-wa)/1E3;Qa=g;e.progress(1,dlDuration+2.5);dlDuration+=g}xa=(window.performance.now()-wa)/1E3;q("dl");e.showStatus("Mbps download");e.mainGaugeProgress(y);e.LiveSpeed(y);e.Graph(y,0);R=x.AvgSpeed(y,ya,dlDuration);xa>=dlDuration&&"done"==Ma&&(A?(e.GaugeProgresstoZero(y,"SendR"),e.showStatus("All done"),e.Symbol(2)):e.GaugeProgresstoZero(y,"Upload"),e.downloadResult(R),ia=S,I=1,m="busy",y=ha=0,x.reset())}"Upload"== +m&&1===I&&(e.Symbol(1),m="initup",e.showStatus("Initializing.."),e.LiveSpeed("...","speedToZero"),za=x.uRandom(ulDataSize,b),A&&(aa=1));"Uploading"===m&&(1==aa&&(aa=2,e.showStatus("Testing upload speed.."),y=0,x.reset(),e.reset(),Ra=g=(window.performance.now()-va)/1E3,e.progress(!1,ulDuration+2.5),ulDuration+=g),e.showStatus("Mbps upload"),T=(window.performance.now()-va)/1E3,q("up"),e.mainGaugeProgress(y),e.LiveSpeed(y),e.Graph(y,1),U=x.AvgSpeed(y,Aa,ulDuration),T>=ulDuration&&1==I&&(ja=P,e.uploadResult(U), +e.GaugeProgresstoZero(y,"SendR"),za=void 0,e.showStatus("All done"),e.Symbol(2),m="busy",I=0));if("Error"===m){e.showStatus("Check your network connection status.");e.ConnectionError();m="busy";clearInterval(l);g=document.createElement("div");g.innerHTML='';var u=g.querySelector("a");e.oDoLiveSpeed.el.textContent="Network Error";var C=document.getElementById("oDoLiveSpeed");u.innerHTML=C.innerHTML; +C.innerHTML=g.innerHTML}"SendR"===m&&(e.showStatus("All done"),g=document.createElement("div"),g.innerHTML='',u=g.querySelector("a"),e.oDoLiveSpeed.el.textContent=fb,C=document.getElementById("oDoLiveSpeed"),u.innerHTML=C.innerHTML,C.innerHTML=g.innerHTML,location.hostname!=Ba.toLowerCase()+Sa?(ba="https://"+Ba.toLowerCase()+Sa+"/results/show.php?&d="+R.toFixed(3)+"&u="+U.toFixed(3)+"&p="+ +Ca+"&j="+Da+"&dd="+(ia/1048576).toFixed(3)+"&ud="+(ja/1048576).toFixed(3)+"&ua="+Ta,ba=encodeURI(ba),g=document.getElementById("resultsData"),g.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",ba),g.setAttribute("target","_blank"),saveData&&Y(5)):Y(3),m="busy",clearInterval(l))},100)}function w(){for(var b=0;b1E3*Qa+ya/2*1E3&&0===Ua&&(Ua=1,ka*=.01,ca*=.01,la=l+1E4);l>=la&&la=S?0:S-Wa;Wa=S;ca+=Va;Xa=Ea=l-Ea;Ea=l;ka+=Xa;01E3*Ra+Aa/2*1E3&&0===Ya&&(Ya=1,ma*=.1,da*=.1,na=b+1E4),b>=na&&na=P?0:P-$a,$a=P,da+=Za,ab=Fa=b-Fa,Fa=b,ma+=ab,0=g.loaded?0:g.loaded-l;if(isNaN(u)||!isFinite(u)||0>u)return!1;S+=u;l=g.loaded};z[b].onload=function(g){0===l&&(S+=g.total);"initDown"==m&&(m="Downloading");z[b]&&(z[b].abort(),z[b]=null,z[b]=void 0,delete z[b]);0===I&&M(b)};z[b].onerror=function(g){0===I&&M(b)};z[b].responseType="arraybuffer";z[b].send()}function F(b){var l=0;v[b]=new XMLHttpRequest;v[b].open("POST",Ga.Upload+"?n="+Math.random(),!0); +v[b].upload.onprogress=function(g){"initup"==m&&void 0===u&&(m="Uploading");if(T>=ulDuration)return v[b].abort(),v[b]=null,v[b]=void 0,delete v[b],!1;var u=0>=g.loaded?0:g.loaded-l;if(isNaN(u)||!isFinite(u)||0>u)return!1;P+=u;l=g.loaded};v[b].onload=function(){if(0===l&&(P+=1048576*ulDataSize,T>=ulDuration))return v[b].abort(),v[b]=null,v[b]=void 0,delete v[b],!1;if("initup"==m&&void 0===g){var g;m="Uploading"}v[b]&&(v[b].abort(),v[b]=null,v[b]=void 0,delete v[b]);1===I&&F(b)};v[b].onerror=function(g){T<= +ulDuration&&F(b)};v[b].setRequestHeader("Content-Type","application/octet-stream");0=P||v[b].send(za)}function Q(){bb=openSpeedTestServerList.length;m="Ping";performance.clearResourceTimings();if(Ha=B?J.push(.1):J.push(B);1=ra&&(ulThreads=dlThreads=ra)}if(selectServer&&("string"===typeof k.host||"string"===typeof k.h)){if("undefined"!==typeof k.host)var sa=k.host;else"undefined"!==typeof k.h&&(sa=k.h);/(?:https?):\/\/(\w+:?\w*)?(\S+)(:\d+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/.test(sa)&& +(openSpeedTestServerList=[{ServerName:"Home",Download:sa+"/downloading",Upload:sa+"/upload",ServerIcon:"DefaultIcon"}])}E=parseInt(k.stress);W=parseInt(k.s);if("string"===typeof k.stress){var p=k.stress;var H=E}else"string"===typeof k.s&&(p=k.s,H=W);if(p&&stressTest){if("low"===p||"l"===p)ulDuration=dlDuration=300;if("medium"===p||"m"===p)ulDuration=dlDuration=600;if("high"===p||"h"===p)ulDuration=dlDuration=900;if("veryhigh"===p||"v"===p)ulDuration=dlDuration=1800;if("extreme"===p||"e"===p)ulDuration= +dlDuration=3600;if("day"===p||"d"===p)ulDuration=dlDuration=86400;if("year"===p||"y"===p)ulDuration=dlDuration=31557600;if(12p||5>H)upAdjust=1+E/100,dlAdjust=1+E/100}else dlAdjust=upAdjust=1;p=parseInt(k.run);H=parseInt(k.r);var Z;!enableRun||"string"!==typeof k.run&&"string"!==typeof k.r||(Z=0',createCookie("mode","dark")));"light"===a&&(nightModeMob.style.display="none",dayModeMob.style.display="inline-block",nightMode.style.display="none", +dayMode.style.display="inline-block",(darkStyle=document.getElementById("darkmode"))&&darkStyle.parentNode.removeChild(darkStyle),createCookie("mode","light"))}function toggleSkin(){(darkStyle=document.getElementById("darkmode"))?setSkin("light"):setSkin("dark")}function createCookie(a,c,b){if(b){var d=new Date;d.setTime(d.getTime()+864E5*b);b="; expires="+d.toGMTString()}else b="";document.cookie=a+"="+c+b+"; path=/"} +function getCookieValue(a,c){return(c=document.cookie.match("(^|;)\\s*"+a+"\\s*=\\s*([^;]+)"))?c.pop():""}; \ No newline at end of file diff --git a/modules/speedtestv2/files/Speed-Test-main/downloading b/modules/speedtestv2/files/Speed-Test-main/downloading new file mode 100644 index 00000000..b78c32fa Binary files /dev/null and b/modules/speedtestv2/files/Speed-Test-main/downloading differ diff --git a/modules/speedtestv2/files/Speed-Test-main/hosted.html b/modules/speedtestv2/files/Speed-Test-main/hosted.html new file mode 100644 index 00000000..ea51ac3b --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/hosted.html @@ -0,0 +1,25 @@ + + + + + + + Speedtest by OpenSpeedtest.com + + + + +
+ Speed Test by OpenSpeedTest™ +
+ + \ No newline at end of file diff --git a/modules/speedtestv2/files/Speed-Test-main/index.html b/modules/speedtestv2/files/Speed-Test-main/index.html new file mode 100644 index 00000000..2772b6b6 --- /dev/null +++ b/modules/speedtestv2/files/Speed-Test-main/index.html @@ -0,0 +1,167 @@ + + + + SpeedTest by OpenSpeedTest™ + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + +
+ SpeedTest by OpenSpeedTest™ is a Free and Open-Source HTML5 Network Speed Test Software. +

© Copyright 2013-2024 OpenSpeedTest™ All Rights Reserved.

+
+ + + + + + diff --git a/modules/speedtestv2/files/Speed-Test-main/upload b/modules/speedtestv2/files/Speed-Test-main/upload new file mode 100644 index 00000000..e69de29b diff --git a/modules/speedtestv2/files/speedtest.conf b/modules/speedtestv2/files/speedtest.conf new file mode 100644 index 00000000..23d4c11d --- /dev/null +++ b/modules/speedtestv2/files/speedtest.conf @@ -0,0 +1,106 @@ +# SpeedTest by OpenSpeedTest™ is a Free and Open-Source Network Speed Test Software. +# Like this Project? Please Donate NOW & Keep us Alive -> https://go.openspeedtest.com/Donate +# Thank you for your support! we greatly appreciate your donation. +# Your contribution helps us continue to improve and maintain the tool for everyone to use. +# Official Website : https://OpenSpeedTest.com | Email: support@openspeedtest.com +# Developed by : Vishnu | https://Vishnu.Pro | Email : me@vishnu.pro + +server { + server_name _ localhost speedtest2.event.dreamhack.se; + listen 80 http2 reuseport; + listen 443 ssl http2 reuseport; + listen [::]:80 http2 reuseport; + listen [::]:443 ssl http2 reuseport; + # If you like to Enable HTTP2 add "http2" to the above line. + # If HTTP2 Enabled. Upload location should Proxy_Pass to http 1.1 port. + # Otherwise you will see abnormal Upload Speeds. + # Nginx Server Windows SSL Performance was very poor! Better use Linux if you need SSL support. + ssl_certificate /etc/ssl/certs/speedtest2.event.dreamhack.se.crt; # Use your own certificate & key + ssl_certificate_key /etc/ssl/private/speedtest2.event.dreamhack.se.key; # <-- key + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; + ssl_ciphers "ALL"; + ssl_prefer_server_ciphers on; + ssl_session_cache shared:SSL:100m; + ssl_session_timeout 1d; + ssl_session_tickets on; + root /usr/share/nginx/html/; + index index.html; + client_max_body_size 35m; + error_page 405 =200 $uri; + access_log off; + gzip off; + fastcgi_read_timeout 999; + log_not_found off; + server_tokens off; + error_log /dev/null; #Disable this for Windows Nginx. + tcp_nodelay on; + tcp_nopush on; + sendfile on; + open_file_cache max=200000 inactive=20s; + open_file_cache_valid 30s; + open_file_cache_min_uses 2; + open_file_cache_errors off; + + location ~ /\.well-known/acme-challenge/ { + allow all; + default_type "text/plain"; + root /usr/share/nginx/html/; + try_files $uri =404; + break; + } + + location / { + add_header 'Access-Control-Allow-Origin' "*" always; + add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; + #Very Very Important! You SHOULD send no-store from server for Google Chrome. + add_header Cache-Control 'no-store, no-cache, max-age=0, no-transform'; + add_header Last-Modified $date_gmt; + if_modified_since off; + expires off; + etag off; + + if ($request_method = OPTIONS ) { + add_header 'Access-Control-Allow-Credentials' "true"; + add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With' always; + add_header 'Access-Control-Allow-Origin' "$http_origin" always; + add_header 'Access-Control-Allow-Methods' "GET, POST, OPTIONS" always; + return 200; + } + } + + #HTTP2 & HTTP3 will not wait for the post body and return 200. We need to stop that behaviour. + #Otherwise, you will see abnormal upload speed. To fix this issue, Enable the following lines. (Only Applicable If you Enabled HTTP2 or HTTP3 in This Server.) + + #HTTP2 & HTTP3 -> UPLOAD FIX -- START + + location = /upload { + proxy_pass http://127.0.0.1:80/dev-null; + } + location = /dev-null { + return 200; + } + + #HTTP2 & HTTP3 -> UPLOAD FIX -- END + + # Caching for Static Files, + location ~* ^.+\.(?:css|cur|js|jpe?g|gif|htc|ico|png|html|xml|otf|ttf|eot|woff|woff2|svg)$ { + access_log off; + expires 365d; + add_header Cache-Control public; + add_header Vary Accept-Encoding; + tcp_nodelay off; + open_file_cache max=3000 inactive=120s; + open_file_cache_valid 45s; + open_file_cache_min_uses 2; + open_file_cache_errors off; + gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml; + } +} \ No newline at end of file diff --git a/modules/speedtestv2/manifests/init.pp b/modules/speedtestv2/manifests/init.pp new file mode 100644 index 00000000..40769d21 --- /dev/null +++ b/modules/speedtestv2/manifests/init.pp @@ -0,0 +1,72 @@ +# Copyright 2026 dhtech +# +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file +# +# == Class: speedtest +# +# This class manages the speedtest +# +# +# === Parameters +# + +class speedtestv2 { + + include apt + + exec { 'apt-update': + command => '/usr/bin/apt update', + } + + package { 'nginx': + ensure => installed, + require => Exec['apt-update'], + } + + # Needed for 'ssl-cert' group + ensure_packages(['ssl-cert']) + + file { '/etc/ssl/certs/speedtest2.event.dreamhack.se.crt': + ensure => file, + owner => 'root', + group => 'ssl-cert', + mode => '0644', + source => 'puppet:///letsencrypt/fullchain.pem', + links => 'follow', + } + + file { '/etc/ssl/private/speedtest2.event.dreamhack.se.key': + ensure => file, + owner => 'root', + group => 'ssl-cert', + mode => '0640', + source => 'puppet:///letsencrypt/privkey.pem', + links => 'follow', + } + + file { '/etc/nginx/sites-enabled/default': + ensure =>absent, + force =>true, + notify =>Service['nginx'], + require =>Package['nginx'], + } + + file { 'speedtestv2-conf': + ensure => file, + path => '/etc/nginx/sites-enabled/speedtest', + source => 'puppet:///modules/speedtestv2/speedtest.conf', + notify => Service['nginx'], + require => Package['nginx'], + } + + file { '/usr/share/nginx/html/': + ensure => directory, + recurse => true, + owner => 'root', + group => 'root', + mode => '0755', + source => 'puppet:///modules/speedtestv2/Speed-Test-main/', + require => Package['nginx'], #Make sure that apt install has been run + } +} diff --git a/modules/speedtestv2/metadata.json b/modules/speedtestv2/metadata.json new file mode 100644 index 00000000..17de50fe --- /dev/null +++ b/modules/speedtestv2/metadata.json @@ -0,0 +1,13 @@ +{ + "name": "speedtestv2", + "version": "0.1.0", + "author": "dhtech", + "summary": "speedtest v2 site", + "license": "BSD", + "source": "", + "project_page": null, + "issues_url": null, + "dependencies": [ + {"name":"puppetlabs/stdlib","version_requirement":">= 1.0.0"} + ] +} diff --git a/modules/speedtestv2/templates/nginx.conf.erb b/modules/speedtestv2/templates/nginx.conf.erb new file mode 100644 index 00000000..43a5213b --- /dev/null +++ b/modules/speedtestv2/templates/nginx.conf.erb @@ -0,0 +1,15 @@ +worker_processes auto; +worker_rlimit_nofile 100000; +events { + worker_connections 2048; + multi_accept on; +} + +error_log /var/log/nginx/error.log notice; +pid /tmp/nginx.pid; + +http { + include mime.types; + default_type application/octet-stream; + include /etc/nginx/conf.d/*.conf; +} diff --git a/modules/speedtestv2/templates/speedtest.conf.erb b/modules/speedtestv2/templates/speedtest.conf.erb new file mode 100644 index 00000000..7b228e55 --- /dev/null +++ b/modules/speedtestv2/templates/speedtest.conf.erb @@ -0,0 +1,106 @@ +# SpeedTest by OpenSpeedTest™ is a Free and Open-Source Network Speed Test Software. +# Like this Project? Please Donate NOW & Keep us Alive -> https://go.openspeedtest.com/Donate +# Thank you for your support! we greatly appreciate your donation. +# Your contribution helps us continue to improve and maintain the tool for everyone to use. +# Official Website : https://OpenSpeedTest.com | Email: support@openspeedtest.com +# Developed by : Vishnu | https://Vishnu.Pro | Email : me@vishnu.pro + +server { + server_name _ localhost speedtest2.event.dreamhack.se; + listen 80 reuseport; + listen 443 ssl reuseport; + listen [::]:80 reuseport; + listen [::]:443 ssl reuseport; + # If you like to Enable HTTP2 add "http2" to the above line. + # If HTTP2 Enabled. Upload location should Proxy_Pass to http 1.1 port. + # Otherwise you will see abnormal Upload Speeds. + # Nginx Server Windows SSL Performance was very poor! Better use Linux if you need SSL support. + ssl_certificate /etc/ssl/certs/speedtest2.event.dreamhack.se.crt; # Use your own certificate & key + ssl_certificate_key /etc/ssl/private/speedtest2.event.dreamhack.se.key; # <-- key + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; + ssl_ciphers "ALL"; + ssl_prefer_server_ciphers on; + ssl_session_cache shared:SSL:100m; + ssl_session_timeout 1d; + ssl_session_tickets on; + root /usr/share/nginx/html/; + index index.html; + client_max_body_size 35m; + error_page 405 =200 $uri; + access_log off; + gzip off; + fastcgi_read_timeout 999; + log_not_found off; + server_tokens off; + error_log /dev/null; #Disable this for Windows Nginx. + tcp_nodelay on; + tcp_nopush on; + sendfile on; + open_file_cache max=200000 inactive=20s; + open_file_cache_valid 30s; + open_file_cache_min_uses 2; + open_file_cache_errors off; + + location ~ /\.well-known/acme-challenge/ { + allow all; + default_type "text/plain"; + root /usr/share/nginx/html/; + try_files $uri =404; + break; + } + + location / { + add_header 'Access-Control-Allow-Origin' "*" always; + add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; + #Very Very Important! You SHOULD send no-store from server for Google Chrome. + add_header Cache-Control 'no-store, no-cache, max-age=0, no-transform'; + add_header Last-Modified $date_gmt; + if_modified_since off; + expires off; + etag off; + + if ($request_method = OPTIONS ) { + add_header 'Access-Control-Allow-Credentials' "true"; + add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With' always; + add_header 'Access-Control-Allow-Origin' "$http_origin" always; + add_header 'Access-Control-Allow-Methods' "GET, POST, OPTIONS" always; + return 200; + } + } + + #HTTP2 & HTTP3 will not wait for the post body and return 200. We need to stop that behaviour. + #Otherwise, you will see abnormal upload speed. To fix this issue, Enable the following lines. (Only Applicable If you Enabled HTTP2 or HTTP3 in This Server.) + + #HTTP2 & HTTP3 -> UPLOAD FIX -- START + + #location = /upload { + # proxy_pass http://127.0.0.1:3000/dev-null; + #} + #location = /dev-null { + # return 200; + #} + + #HTTP2 & HTTP3 -> UPLOAD FIX -- END + + # Caching for Static Files, + location ~* ^.+\.(?:css|cur|js|jpe?g|gif|htc|ico|png|html|xml|otf|ttf|eot|woff|woff2|svg)$ { + access_log off; + expires 365d; + add_header Cache-Control public; + add_header Vary Accept-Encoding; + tcp_nodelay off; + open_file_cache max=3000 inactive=120s; + open_file_cache_valid 45s; + open_file_cache_min_uses 2; + open_file_cache_errors off; + gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml; + } +} \ No newline at end of file