Merge pull request 'server status' (#11) from feature/home-server-status-prometheus into main

Reviewed-on: #11
This commit was merged in pull request #11.
This commit is contained in:
2026-06-14 01:07:21 -04:00
3 changed files with 115 additions and 2 deletions
+10 -2
View File
@@ -39,8 +39,16 @@
`).join("");
};
fetch("/api/server-status", { cache: "no-store" })
.then((res) => res.ok ? res.json() : null)
const loadStatus = (url) => fetch(url, { cache: "no-store" })
.then((res) => {
if (!res.ok) {
throw new Error(`status ${res.status}`);
}
return res.json();
});
loadStatus(`/server-status.json?ts=${Date.now()}`)
.catch(() => loadStatus("/api/server-status"))
.then((data) => data && render(data))
.catch(() => {});
})();