orchard
mirrorEvery site I host, in one repo, along with the Cloudflare Tunnel and Caddy that front them. It's all Go, Vite, and SQLite, and it runs on a desktop at home with nothing listening on an inbound port.
blogbuncaddycloudflare-tunneldockergogolanghomelabhtml-templatemonorepoself-hostedseosqlitestatic-sitetypstuptime-monitoringviteweb-analytics
1// Reloads after the post, so the rest of the dashboard re-renders against the
2// new visibility.
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});