2023-02-09 20:29:07 +00:00
|
|
|
init();
|
|
|
|
|
2023-04-05 16:10:21 +01:00
|
|
|
async function init() { // The page init function
|
2023-02-09 20:29:07 +00:00
|
|
|
display(await get())
|
|
|
|
}
|
|
|
|
|
2023-04-05 16:10:21 +01:00
|
|
|
async function get() { // Fetch data from API
|
2023-02-09 20:29:07 +00:00
|
|
|
var url = `${window.location.origin}/api/v1/stats`;
|
|
|
|
var resp = await fetch(url);
|
|
|
|
return await resp.json();
|
|
|
|
}
|
|
|
|
|
2023-04-05 16:10:21 +01:00
|
|
|
async function display(data) { // Parses and displays data from API
|
2023-02-17 12:57:37 +00:00
|
|
|
document.getElementById('server_host').textContent = data.host;
|
2023-03-10 22:12:03 +00:00
|
|
|
document.getElementById('server_mode').textContent = data.mode || "Unknown";
|
2023-03-12 12:53:20 +00:00
|
|
|
document.getElementById('ver-bkend').textContent = data.verBkend || "Unknown";
|
2023-02-09 20:29:07 +00:00
|
|
|
let dat = data.dat[0]
|
2023-03-13 20:13:10 +00:00
|
|
|
let ver = data.ver[0]
|
2023-02-12 21:45:41 +00:00
|
|
|
document.getElementById('time').textContent = await convertUnixLocal(dat.since);
|
2023-02-09 20:29:07 +00:00
|
|
|
document.getElementById('ldbws').textContent = dat.ldbws || "0";
|
|
|
|
document.getElementById('ldbsvws').textContent = dat.ldbsvws || "0";
|
2023-02-16 21:40:11 +00:00
|
|
|
document.getElementById('apicorpus').textContent = dat.corpus_api || "0";
|
2023-02-09 20:29:07 +00:00
|
|
|
document.getElementById('corpus').textContent = dat.corpus || "0";
|
|
|
|
document.getElementById('stations').textContent = dat.stations || "0";
|
|
|
|
document.getElementById('users').textContent = dat.user || "0";
|
|
|
|
document.getElementById('meta').textContent = dat.meta || "0";
|
2023-03-13 20:13:10 +00:00
|
|
|
document.getElementById('ver-dbman').textContent = ver.dbmanager || "Unknown";
|
2023-03-10 22:10:25 +00:00
|
|
|
document.getElementById('ver-web').textContent = localStorage.getItem('ver-web') || "Unknown";
|
2023-02-09 20:29:07 +00:00
|
|
|
}
|