add connected instances list to aprelay

This commit is contained in:
2026-02-06 21:16:13 -05:00
parent 55b4e9d880
commit 1e11e31dd8
5 changed files with 244 additions and 16 deletions

View File

@@ -64,3 +64,37 @@ async function loadStats() {
loadStats();
setInterval(loadStats, 300000);
async function loadInstanceStatuses() {
const bodyEl = document.getElementById("instances-body");
const updatedEl = document.getElementById("instances-updated");
if (!bodyEl || !updatedEl) return;
try {
const res = await fetch("aprelay_instances.json", { cache: "no-store" });
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
const instances = Array.isArray(data.instances) ? data.instances : [];
updatedEl.textContent = data.generated_at || "";
if (!instances.length) {
bodyEl.innerHTML = `<div class="instances-row"><span class="mono">No data</span><span></span></div>`;
return;
}
bodyEl.innerHTML = instances.map(x => `
<div class="instances-row" role="row">
<span class="mono" role="cell">${x.domain}</span>
<span role="cell">${x.status}</span>
</div>
`).join("");
} catch (e) {
bodyEl.innerHTML = `<div class="instances-row"><span class="mono">Error loading list</span><span></span></div>`;
updatedEl.textContent = "";
}
}
document.addEventListener("DOMContentLoaded", () => {
loadInstanceStatuses();
});