Просмотр исходного кода

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

This reverts commit fdb1681aad465d4de24eb5af28a37b2234aace72.

Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
Stefan Stidl 3 месяцев назад
Родитель
Сommit
a77b739905
1 измененных файлов с 41 добавлено и 47 удалено
  1. 41 47
      index-classic.html

+ 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();
+				}
 			}
 		}