diff --git a/assets/css/main.css b/assets/css/main.css index 7da0f81..1dd203a 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -777,14 +777,22 @@ footer.site-footer { width: 10px; height: 10px; border-radius: 50%; - background: #6b7280; /* grau = aktuell offline */ + background: #e05260; /* rot = offline (Standard) */ + box-shadow: 0 0 8px rgba(224, 82, 96, .55); margin-right: .45rem; vertical-align: middle; + transition: background .3s ease, box-shadow .3s ease; } .live-dot.is-live { background: #22c55e; /* grün = live */ animation: live-pulse 1.6s infinite; } +/* Solange der Status noch geladen wird: neutral grau, damit nie kurz + fälschlich "offline" aufblitzt. */ +.live-dot.is-unknown { + background: #6b7280; + box-shadow: none; +} @keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); } diff --git a/assets/js/postfach.js b/assets/js/postfach.js index a406236..46b7c53 100644 --- a/assets/js/postfach.js +++ b/assets/js/postfach.js @@ -162,17 +162,56 @@ async function loadNotes(applicationId) { .join("") || `
Noch keine Notizen.
`; } -/* ---------------- Live-Status ---------------- */ -function renderLiveStatus(live) { - $("admin-live-dot").classList.toggle("is-live", !!live); - $("admin-live-text").textContent = live ? "Live jetzt!" : "Aktuell offline"; +/* ---------------- Live-Status ---------------- + Der Status kommt automatisch von TikTok (Cron im Worker, jede Minute). + Die Handschaltung ist nur ein zeitlich begrenzter Vorrang. + ------------------------------------------------------------------- */ +function formatSince(iso) { + if (!iso) return null; + const diffMin = Math.floor((Date.now() - new Date(iso).getTime()) / 60000); + if (diffMin < 1) return "gerade eben"; + if (diffMin === 1) return "vor 1 Minute"; + if (diffMin < 60) return `vor ${diffMin} Minuten`; + const h = Math.floor(diffMin / 60); + return h === 1 ? "vor 1 Stunde" : `vor ${h} Stunden`; +} + +function renderLiveStatus(data) { + const live = !!(data && data.live); + const dot = $("admin-live-dot"); + dot.classList.remove("is-unknown"); + dot.classList.toggle("is-live", live); + $("admin-live-text").textContent = live ? "Jetzt live" : "Gerade offline"; + + const manual = data && data.source === "manuell"; + $("go-auto-btn").style.display = manual ? "inline-flex" : "none"; + + const lines = []; + if (manual) { + lines.push("⚠️ Von Hand gesetzt — die Automatik ist gerade übersteuert."); + if (data.overrideUntil) { + const until = new Date(data.overrideUntil); + lines.push(`Läuft aus um ${until.toLocaleTimeString("de-DE", { hour: "2-digit", minute: "2-digit" })} Uhr.`); + } + if (data.autoLive !== null && data.autoLive !== undefined) { + lines.push(`TikTok meldet gerade: ${data.autoLive ? "live" : "offline"}.`); + } + } else { + if (data && data.title && live) lines.push(`Titel: ${data.title}`); + const since = formatSince(data && data.autoCheckedAt); + if (since) lines.push(`Automatisch geprüft ${since}.`); + if (data && data.autoHealthy === false) { + lines.push("⚠️ Der letzte Abruf bei TikTok hat nicht geklappt — angezeigt wird der letzte bekannte Stand."); + } + } + $("admin-live-detail").innerHTML = lines.join("Drei Welten, eine Familie: Team Dogi.
Dogfather geht jeden Tag ab 20 Uhr live — oft schon tagsüber, zu wechselnden Zeiten. Streamplan ansehen →