fix: display status with description in weinfo page, add fallbacks for undefined values, handle empty times table

This commit is contained in:
2026-07-11 07:49:27 -04:00
parent ff4e46858b
commit ce66b0de3f

View File

@@ -1,8 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-<begin▁of▁sentence>8" />
<meta name="viewport" content="width=device-w, initial-scale=1.0" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bal Server List</title>
<link rel="icon" href="Logo_nero.ico" type="image/x-icon">
<script src="/qrcode.min.js"></script>
@@ -11,22 +11,22 @@
</head>
<style>
table {
border-collapse: collapse;
width: 100%;
margin-top: 20px;
border-collapse: collapse;
width: 100%;
margin-top: 20px;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
background-color: #f2f2f2;
}
tr:nth-child(even) {
background-color: #f9f9f9;
background-color: #f9f9f9;
}
span{
span {
margin-left:10px;
}
</style>
@@ -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();
</script>
</body>
</html>
</html>