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

24 lines
864 B
JavaScript

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) {
document.getElementById('server_host').textContent = `HOST: ${data.host}`;
let dat = data.dat[0]
console.log(JSON.stringify(dat))
document.getElementById('time').textContent = dat.since;
document.getElementById('ldbws').textContent = dat.ldbws || "0";
document.getElementById('ldbsvws').textContent = dat.ldbsvws || "0";
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";
}