Live · Supabase
Reads only the public milo_public_stats view with your anon key. No install IDs or IPs are ever exposed here.
Saved only in this browser (localStorage). For Cloudflare Pages, set VITE_SUPABASE_URL / VITE_SUPABASE_ANON_KEY and they autofill.
Not connected.
No data yet.
'; return; } const max = Math.max(...entries.map(([, v]) => v)); el.innerHTML = ""; for (const [k, v] of entries) { const row = document.createElement("div"); row.className = "bar-row"; const pct = max ? Math.round((v / max) * 100) : 0; row.innerHTML = ``;
row.children[0].textContent = k || "unknown";
row.querySelector("i").style.width = pct + "%";
row.querySelector("code").textContent = String(v);
el.appendChild(row);
}
}
async function load() {
const url = $("supabaseUrl").value.trim().replace(/\/$/, "");
const key = $("supabaseKey").value.trim();
if (!/^https:\/\/.+\.supabase\.co$/i.test(url)) {
$("statusLine").textContent = "URL should look like https://xxxxx.supabase.co";
return;
}
if (!key) { $("statusLine").textContent = "Paste the anon key (never the service_role key)."; return; }
store.set("milo.supabaseUrl", url);
store.set("milo.supabaseAnonKey", key);
$("statusLine").textContent = "Loading…";
try {
const { createClient } = await import("https://esm.sh/@supabase/supabase-js@2.47.0");
const sb = createClient(url, key);
const { data, error } = await sb.from("milo_public_stats").select("*").single();
if (error) throw error;
$("sTotal").textContent = data.total_installs ?? 0;
$("s30").textContent = data.active_30d ?? 0;
$("s7").textContent = data.active_7d ?? 0;
bars($("byPlatform"), data.by_platform);
bars($("byVersion"), data.by_version);
bars($("byCountry"), data.by_country);
$("statusLine").textContent = "Live from " + url;
} catch (e) {
$("statusLine").textContent = "Failed: " + (e?.message ?? e);
}
}
$("loadBtn").addEventListener("click", load);
$("forgetBtn").addEventListener("click", () => {
store.del("milo.supabaseUrl"); store.del("milo.supabaseAnonKey");
$("supabaseUrl").value = ""; $("supabaseKey").value = "";
$("statusLine").textContent = "Forgotten. Paste fresh credentials to reconnect.";
});
if ($("supabaseUrl").value && $("supabaseKey").value) load();