feat(manascore): add live uptime badges from status.mana.how

- generate-status-page.sh now also writes status.json alongside index.html
  Format: { updated, summary: {up, total}, services: { appName: bool } }
- nginx status.mana.how serves status.json with CORS headers (public read)
  and explicit location block to avoid rewrite to index.html
- ManaScore index page fetches status.json client-side on load and
  injects green ● LIVE / red ● DOWN badge next to each app's status chip

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-31 18:47:55 +02:00
parent 259253e7b3
commit 08032c004b
3 changed files with 62 additions and 0 deletions

View file

@ -170,6 +170,7 @@ const statuses = [...new Set(sortedAudits.map((a) => a.data.status))];
<span class="text-muted-foreground truncate text-xs font-medium">
{data.app}
</span>
<span class="live-badge shrink-0" data-app={data.app} />
<span class="text-muted-foreground/50 text-[10px]">
{data.date.toLocaleDateString('de-DE', {
day: '2-digit',
@ -547,4 +548,25 @@ const statuses = [...new Set(sortedAudits.map((a) => a.data.status))];
// Sort select
sortSelect.addEventListener('change', applySort);
// Live uptime badges from status.mana.how/status.json
(async () => {
try {
const res = await fetch('https://status.mana.how/status.json', { cache: 'no-store' });
if (!res.ok) return;
const data = await res.json();
const services: Record<string, boolean> = data.services ?? {};
document.querySelectorAll<HTMLElement>('.live-badge').forEach((badge) => {
const app = badge.dataset.app;
if (!app || !(app in services)) return;
const up = services[app];
badge.innerHTML = up
? '<span style="color:#22c55e;font-size:9px;font-weight:600;letter-spacing:.04em">● LIVE</span>'
: '<span style="color:#ef4444;font-size:9px;font-weight:600;letter-spacing:.04em">● DOWN</span>';
});
} catch {
// status.mana.how unreachable — silently skip badges
}
})();
</script>