This repository has been archived on 2023-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
web/js/stat.js

31 lines
1.3 KiB
JavaScript
Raw Normal View History

2023-02-09 20:29:07 +00:00
init();
async function init() {
display(await get())
}
async function get() {
var url = `${window.location.origin}/api/v1/stats`;
var resp = await fetch(url);
return await resp.json();
}
async function display(data) {
2023-03-12 12:53:20 +00:00
console.log(JSON.stringify(data))
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-09 20:29:07 +00:00
console.log(JSON.stringify(dat))
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";
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
}