From ce66b0de3fb563500eefa9c1e610ea587a673972 Mon Sep 17 00:00:00 2001 From: svatantrya Date: Sat, 11 Jul 2026 07:49:27 -0400 Subject: [PATCH] fix: display status with description in weinfo page, add fallbacks for undefined values, handle empty times table --- weinfo.html | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/weinfo.html b/weinfo.html index a761d2f..e4a001e 100644 --- a/weinfo.html +++ b/weinfo.html @@ -1,8 +1,8 @@ - - + + Bal Server List @@ -11,22 +11,22 @@ @@ -91,8 +91,19 @@ document.getElementById('wetld').innerHTML = DOMPurify.sanitize(data.tld||'—'); document.getElementById('webalance').innerHTML = data.balance != null ? data.balance : '—'; document.getElementById('weversion').innerHTML = data.version||'—'; - document.getElementById('westatus').innerHTML = DOMPurify.sanitize(data.status||'—'); - document.getElementById('weupdate').innerHTML = data.last_update||'—'; + const statusMap = { + 'OK': 'Health check passed', + 'TIMEOUT': 'Connection timeout', + 'CONNECTION': 'Connection error', + 'STATUS': 'HTTP error', + 'WRONG REPLY': 'Invalid JSON response', + 'REQUEST': 'Request error', + 'BODY': 'Body read error', + 'DECODE': 'Decode error', + 'KO': 'Generic error' + }; + const st = (data.status||'').split(':')[0]; + document.getElementById('westatus').innerHTML = DOMPurify.sanitize(data.status||'—') + (statusMap[st] ? ' (' + statusMap[st] + ')' : ''); const tableBody = document.querySelector('#wetimes tbody'); tableBody.innerHTML =''; @@ -130,8 +141,6 @@ } getWeInfo(); - - - + \ No newline at end of file