feat: allow frontend to override batchsize

This commit is contained in:
əlemi 2024-12-03 20:34:07 +01:00
parent 371e5ef7cd
commit 7d0e1c4674
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -160,7 +160,8 @@ function card(key, history, last_rtt) {
</div>`; </div>`;
} }
let main = document.getElementById("uppe-rs-content"); const main = document.getElementById("uppe-rs-content");
const batchsize = (new URLSearchParams(window.location.search)).get('batch') || '%%BATCHSIZE%%';
async function updateStatus() { async function updateStatus() {
let res = await fetch("/api/status") let res = await fetch("/api/status")
@ -176,7 +177,7 @@ async function updateStatus() {
let out = ""; let out = "";
for (let key of keys) { for (let key of keys) {
let res = await fetch(`/api/status/${key}?limit=%%BATCHSIZE%%`); let res = await fetch(`/api/status/${key}?limit=${batchsize}`);
let history = await res.json(); let history = await res.json();
out += card(key, history, status[key]); out += card(key, history, status[key]);
out += "\n"; out += "\n";
@ -185,7 +186,7 @@ async function updateStatus() {
main.innerHTML = out; main.innerHTML = out;
} }
setInterval(updateStatus, 60 * 1000) setInterval(updateStatus, 5 * 60 * 1000)
updateStatus() updateStatus()
</script> </script>