Single-binary self-hosted uptime monitoring and status pages on Rust axum: HTTP probes, Lighthouse audits, SEO crawler, and PDF reports.
axumdockerrustself-hostedsqlitestatus-pageuptime-monitoringvite
1// Visibility toggle pill. Posts to /properties/<id>/public on every change,
2// then reloads so the rest of the dashboard re-renders against the new state.
3document.addEventListener("DOMContentLoaded", function () {
4 const wrap = document.getElementById("is-public-form");
5 if (!wrap) return;
6 const propertyId = wrap.dataset.propertyId;
7 if (!propertyId) return;
8 const checkbox = wrap.querySelector("#is-public-switch");
9 if (!checkbox) return;
10
11 checkbox.addEventListener("change", async () => {
12 checkbox.disabled = true;
13 try {
14 await fetch(`/properties/${propertyId}/public`, {
15 method: "POST",
16 credentials: "same-origin",
17 });
18 window.location.reload();
19 } catch (err) {
20 console.error("toggle public failed", err);
21 checkbox.disabled = false;
22 }
23 });
24});