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

@ -368,3 +368,31 @@ HTMLEOF
mv "${OUTPUT}.tmp" "$OUTPUT"
echo "$(date '+%H:%M:%S') Status-Seite generiert → $OUTPUT (${total_up}/${total_all} online)"
# ── status.json für ManaScore Live-Badge ─────────────────────────────────────
JSON_OUTPUT="$(dirname "$OUTPUT")/status.json"
TIMESTAMP_ISO="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
echo "$SUCCESS_JSON" | jq \
--arg ts "$TIMESTAMP_ISO" \
--argjson total_up "$total_up" \
--argjson total_all "$total_all" \
'{
updated: $ts,
summary: { up: $total_up, total: $total_all },
services: (
.data.result | map({
key: (
.metric.instance
| ltrimstr("https://")
| if . == "mana.how" then "manacore"
else (. | rtrimstr(".mana.how") | rtrimstr("/health"))
end
),
value: (.value[1] == "1")
}) | from_entries
)
}' > "${JSON_OUTPUT}.tmp" && mv "${JSON_OUTPUT}.tmp" "$JSON_OUTPUT"
echo "$(date '+%H:%M:%S') status.json generiert → $JSON_OUTPUT"