Dashboard: content + source-health; per-viewer local dates

* Date fix: introduce GOODNEWS_TZ (goodnews/localtime.py) so the brief's "today"
  rolls over in a pinned zone (Eastern) instead of UTC — robust to host-clock
  resets. The home page now formats the brief's date in each VISITOR's local
  timezone (from its UTC freshness stamp), so nobody ever sees "tomorrow."

* Admin "Content served": articles live, fresh (7d), ingested (24h), summaries,
  active sources, today's brief size — queries.content_stats().

* Admin "Source health": per active source, the failure streak, last error,
  accepted contribution, and computed next-poll time (so backoff / "resting
  until" is visible), via queries.source_health() reusing the feeds backoff
  math. Failing sources sort to the top; times render in the viewer's zone.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jay
2026-06-06 19:34:22 +00:00
parent 452e5a3fe4
commit d87347b032
7 changed files with 227 additions and 6 deletions
+12 -1
View File
@@ -76,6 +76,17 @@
const cap = (s) => (s ? s[0].toUpperCase() + s.slice(1) : s);
const humanize = (s) => (s || '').replace(/-/g, ' ');
// Show the brief's date in the VIEWER's local timezone (from its UTC freshness
// stamp), so everyone sees their own correct date — never "tomorrow."
function localDateLabel(b) {
const ts = b?.generated_at;
if (ts) {
const d = new Date(ts.replace(' ', 'T') + 'Z');
if (!isNaN(d)) return d.toLocaleDateString(undefined, { weekday: 'long', month: 'long', day: 'numeric' });
}
return b?.brief_date ?? '';
}
let filtersOn = $derived(prefsActive());
let currentMood = $derived(moods.find((m) => m.key === selected));
let currentTopic = $derived(topics.find((t) => t.key === selected));
@@ -89,7 +100,7 @@
: (currentMood?.label ?? cap(currentTopic?.key) ?? '')
);
let viewSubtitle = $derived(
selected === 'today' ? (brief?.brief_date ?? '')
selected === 'today' ? localDateLabel(brief)
: currentTag ? (tagFamily?.description ?? '')
: (currentMood?.description ?? currentTopic?.description ?? '')
);