forked from bitcoinafterlife/bal-welist-website
fix: display status with description in weinfo page, add fallbacks for undefined values, handle empty times table
This commit is contained in:
21
weinfo.html
21
weinfo.html
@@ -1,8 +1,8 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-<|begin▁of▁sentence|>8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-w, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Bal Server List</title>
|
<title>Bal Server List</title>
|
||||||
<link rel="icon" href="Logo_nero.ico" type="image/x-icon">
|
<link rel="icon" href="Logo_nero.ico" type="image/x-icon">
|
||||||
<script src="/qrcode.min.js"></script>
|
<script src="/qrcode.min.js"></script>
|
||||||
@@ -91,8 +91,19 @@
|
|||||||
document.getElementById('wetld').innerHTML = DOMPurify.sanitize(data.tld||'—');
|
document.getElementById('wetld').innerHTML = DOMPurify.sanitize(data.tld||'—');
|
||||||
document.getElementById('webalance').innerHTML = data.balance != null ? data.balance : '—';
|
document.getElementById('webalance').innerHTML = data.balance != null ? data.balance : '—';
|
||||||
document.getElementById('weversion').innerHTML = data.version||'—';
|
document.getElementById('weversion').innerHTML = data.version||'—';
|
||||||
document.getElementById('westatus').innerHTML = DOMPurify.sanitize(data.status||'—');
|
const statusMap = {
|
||||||
document.getElementById('weupdate').innerHTML = data.last_update||'—';
|
'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');
|
const tableBody = document.querySelector('#wetimes tbody');
|
||||||
tableBody.innerHTML ='';
|
tableBody.innerHTML ='';
|
||||||
@@ -130,8 +141,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
getWeInfo();
|
getWeInfo();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user