Explorar el Código

Cherry-pick: revert "Use server-list.json in classic frontend by default" (#776)

* Revert "Use server-list.json in classic frontend by default"

This reverts commit fdb1681aad465d4de24eb5af28a37b2234aace72.

Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>

* bump version to v6.0.1

---------

Co-authored-by: Stefan Stidl <stefan.stidl@ffg.at>
Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
Co-authored-by: sstidl <sstidl@users.noreply.github.com>
Copilot hace 3 meses
padre
commit
6693c7ee2c
Se han modificado 2 ficheros con 42 adiciones y 48 borrados
  1. 41 47
      index-classic.html
  2. 1 1
      speedtest.js

+ 41 - 47
index-classic.html

@@ -36,58 +36,52 @@
 
 		//SERVER AUTO SELECTION
 		function initServers() {
-			var showStandaloneUI = function () {
+			if (SPEEDTEST_SERVERS.length == 0) { //standalone installation
+				//just make the UI visible
 				I("loading").className = "hidden";
 				I("serverArea").style.display = "none";
 				I("testWrapper").className = "visible";
 				initUI();
-			}
-			var noServersAvailable = function () {
-				I("message").innerHTML = "No servers available";
-			}
-			var runServerSelect = function () {
-				s.selectServer(function (server) {
-					if (server != null) { //at least 1 server is available
-						I("loading").className = "hidden"; //hide loading message
-						//populate server list for manual selection
-						for (var i = 0; i < SPEEDTEST_SERVERS.length; i++) {
-							if (SPEEDTEST_SERVERS[i].pingT == -1) continue;
-							var option = document.createElement("option");
-							option.value = i;
-							option.textContent = SPEEDTEST_SERVERS[i].name;
-							if (SPEEDTEST_SERVERS[i] === server) option.selected = true;
-							I("server").appendChild(option);
-						}
-						//show test UI
-						I("testWrapper").className = "visible";
-						initUI();
-					} else { //no servers are available, the test cannot proceed
-						noServersAvailable();
-					}
-				});
-			}
-			var loadServerList = function (serverListUrl, onFailure) {
-				s.loadServerList(serverListUrl, function (servers) {
-					if (servers == null || servers.length == 0) {
-						onFailure();
-					} else {
-						SPEEDTEST_SERVERS = servers;
-						s.addTestPoints(SPEEDTEST_SERVERS);
-						runServerSelect();
-					}
-				});
-			}
-
-			if (typeof SPEEDTEST_SERVERS === "string") {
-				//need to fetch list of servers from specified URL
-				loadServerList(SPEEDTEST_SERVERS, noServersAvailable);
-			} else if (SPEEDTEST_SERVERS.length == 0) {
-				//standalone installation by default, but use server-list.json if present
-				loadServerList("server-list.json", showStandaloneUI);
 			} else { //multiple servers
-				//hardcoded server list
-				s.addTestPoints(SPEEDTEST_SERVERS);
-				runServerSelect();
+				var noServersAvailable = function () {
+					I("message").innerHTML = "No servers available";
+				}
+				var runServerSelect = function () {
+					s.selectServer(function (server) {
+						if (server != null) { //at least 1 server is available
+							I("loading").className = "hidden"; //hide loading message
+							//populate server list for manual selection
+							for (var i = 0; i < SPEEDTEST_SERVERS.length; i++) {
+								if (SPEEDTEST_SERVERS[i].pingT == -1) continue;
+								var option = document.createElement("option");
+								option.value = i;
+								option.textContent = SPEEDTEST_SERVERS[i].name;
+								if (SPEEDTEST_SERVERS[i] === server) option.selected = true;
+								I("server").appendChild(option);
+							}
+							//show test UI
+							I("testWrapper").className = "visible";
+							initUI();
+						} else { //no servers are available, the test cannot proceed
+							noServersAvailable();
+						}
+					});
+				}
+				if (typeof SPEEDTEST_SERVERS === "string") {
+					//need to fetch list of servers from specified URL
+					s.loadServerList(SPEEDTEST_SERVERS, function (servers) {
+						if (servers == null) { //failed to load server list
+							noServersAvailable();
+						} else { //server list loaded
+							SPEEDTEST_SERVERS = servers;
+							runServerSelect();
+						}
+					});
+				} else {
+					//hardcoded server list
+					s.addTestPoints(SPEEDTEST_SERVERS);
+					runServerSelect();
+				}
 			}
 		}
 

+ 1 - 1
speedtest.js

@@ -49,7 +49,7 @@ function Speedtest() {
   this._settings = {}; //settings for the speed test worker
   this._state = 0; //0=adding settings, 1=adding servers, 2=server selection done, 3=test running, 4=done
   console.log(
-    "LibreSpeed by Federico Dossena v6.0.0pre1 - https://github.com/librespeed/speedtest"
+    "LibreSpeed by Federico Dossena v6.0.1 - https://github.com/librespeed/speedtest"
   );
 }