From 130358a9e0504a55cf3f86b2d7035feb7f4e84de Mon Sep 17 00:00:00 2001 From: lolcat Date: Sun, 21 Apr 2024 19:31:56 -0400 Subject: v8 --- static/serverping.js | 99 ++++++++++++++++++---------------------------------- 1 file changed, 34 insertions(+), 65 deletions(-) (limited to 'static') diff --git a/static/serverping.js b/static/serverping.js index a94fe50..6b680d5 100644 --- a/static/serverping.js +++ b/static/serverping.js @@ -22,10 +22,10 @@ var list = []; var pinged_list = []; var reqs = 0; var errors = 0; -var sort = 0; // lower ping first +var sort = 6; // highest version first // check for instance redirect stuff -var redir = ""; +var redir = []; var target = "/web?"; new URL(window.location.href) .searchParams @@ -39,12 +39,16 @@ new URL(window.location.href) } if(key == "npt"){ return; } - redir += encodeURIComponent(key) + "=" + encodeURIComponent(value) + redir.push(encodeURIComponent(key) + "=" + encodeURIComponent(value)) } ); -if(redir != ""){ - redir = target + redir; +if(redir.length !== 0){ + + redir = target + redir.join("&"); +}else{ + + redir = ""; } var quote = document.createElement("div"); @@ -61,14 +65,13 @@ var table = document.createElement("table"); table.innerHTML = '' + '' + - '
Ping' + 'Server' + 'Address' + 'Bot protection' + 'Real reqs (?)' + 'Bot reqs (?)' + 'API' + - 'Version' + + '
Version' + '' + '' + ''; @@ -118,14 +121,13 @@ for(var i=0; i'; - for(var i=0; i<8; i++){ + for(var i=0; i<7; i++){ html += ''; - break; - } - - if(sorted_list[k].server.ping <= 200){ - - html += '>' + sorted_list[k].server.ping + ''; - break; - } - - html += '>' + number_format(sorted_list[k].server.ping) + ''; - break; - // server name - case 1: html += ' class="extend">' + htmlspecialchars(sorted_list[k].server.name); break; - case 2: html += '>' + htmlspecialchars(new URL(sorted_list[k].server.ip).host); break; - case 3: // bot protection + case 0: html += ' class="extend">' + htmlspecialchars(sorted_list[k].server.name); break; + case 1: html += '>' + htmlspecialchars(new URL(sorted_list[k].server.ip).host); break; + case 2: // bot protection switch(sorted_list[k].server.bot_protection){ case 0: @@ -407,15 +374,15 @@ function render_list(){ } break; - case 4: // real reqs + case 3: // real reqs html += '>' + number_format(sorted_list[k].server.real_requests); break; - case 5: // bot reqs + case 4: // bot reqs html += '>' + number_format(sorted_list[k].server.bot_requests); break; - case 6: // api enabled + case 5: // api enabled if(sorted_list[k].server.api_enabled){ @@ -427,7 +394,7 @@ function render_list(){ break; // version - case 7: html += ">v" + sorted_list[k].server.version; break; + case 6: html += ">v" + sorted_list[k].server.version; break; } html += ''; @@ -436,6 +403,8 @@ function render_list(){ html += ''; } + console.log(html); + tbody.innerHTML = html; } -- cgit v1.2.3