A multi-session build turning Pete's read-only web UI into something people return to. Five phases, signed-in features keyed off the OIDC subject; anonymous visitors keep the reverse-chron feed and localStorage-only state. Phase 1 — per-user read + bookmark state: user_story_state table + storage/userstate.go; auth-gated /api/read, /api/bookmark, /api/state and a /bookmarks page; reader.js syncs state server-side for signed-in users. Also hides the Matrix-posting UI when posting.enabled=false (web-only mode). Phase 2 — outbound feeds: storage.ListForFeed + web/feed.go hand-build RSS 2.0 (content:encoded) and JSON Feed 1.1 (no new dep); /feed.xml, /feed.json and per-channel variants; <link rel=alternate> discovery tags. Phase 3 — "For you" + related: storage/rank.go scores recent unread candidates by channel/source affinity + recency decay; RelatedStories via FTS5. ForYou rail + /for-you page; public /api/related feeds the reader's "You might also like". Phase 4 — source-health dashboard: source_health table + storage/sourcehealth.go (RecordPollResult, ListSourceHealth, SourceContentStats), written by the poller; admin-gated /status page behind web.admin_subs. Phase 5 — PWA + offline reader + Web Push: root-scoped manifest.webmanifest and sw.js (app-shell precache, /api/article runtime cache for offline reading, offline fallback, push/notificationclick handlers); PNG icons from pete.avif; pwa.js registers the SW and drives a notifications toggle. Web Push adds webpush-go, a [web.push] config block (pete -genvapid mints VAPID keys), a push_subscriptions table, auth-gated subscribe/unsubscribe endpoints, and a digest sender that pings each subscriber "N new stories" past their watermark, honoring disabled-sources and pruning gone endpoints. Tests added beside each new storage/web file; go test ./... and go vet clean.
112 lines
4.1 KiB
HTML
112 lines
4.1 KiB
HTML
{{define "title"}}{{.SiteTitle}} — your news feed{{end}}
|
|
|
|
{{define "main"}}
|
|
<section class="mt-2 mb-8 text-center">
|
|
<h1 class="font-display text-4xl sm:text-6xl font-bold leading-tight">
|
|
a friendlier news feed.
|
|
</h1>
|
|
<p class="mx-auto mt-3 max-w-xl text-base sm:text-lg text-[color:var(--ink)]/70">
|
|
{{if .PostingEnabled}}
|
|
Pete reads RSS, sorts stories, and posts them to Matrix.
|
|
Glowing cards are the ones he's posted.
|
|
{{else}}
|
|
Pete reads RSS and sorts stories into channels, fresh from his feeds.
|
|
{{end}}
|
|
</p>
|
|
</section>
|
|
|
|
<section data-weather-card class="mb-10 empty:hidden"></section>
|
|
|
|
{{if .ForYou}}
|
|
<section class="mb-10">
|
|
<div class="flex items-end justify-between gap-3 mb-4">
|
|
<h2 class="font-display text-xl sm:text-2xl font-bold">
|
|
<span aria-hidden="true">✨</span> For you
|
|
</h2>
|
|
<a href="/for-you" class="text-xs font-semibold text-[color:var(--ink)]/60 hover:text-[color:var(--ink)]">more →</a>
|
|
</div>
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
|
|
{{range .ForYou}}
|
|
{{template "card" dict "Story" . "Theme" .Channel "ShowChannel" true}}
|
|
{{end}}
|
|
</div>
|
|
</section>
|
|
{{end}}
|
|
|
|
{{if and .PostingEnabled .JustPosted}}
|
|
<section class="mb-10">
|
|
<div class="flex items-end justify-between gap-3 mb-4">
|
|
<h2 class="font-display text-xl sm:text-2xl font-bold">
|
|
<span aria-hidden="true">📡</span> Pete just posted
|
|
</h2>
|
|
<span class="text-xs text-[color:var(--ink)]/50">most recent posts to Matrix</span>
|
|
</div>
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
{{range .JustPosted}}
|
|
{{template "card" dict "Story" . "Theme" .Channel "ShowChannel" true}}
|
|
{{end}}
|
|
</div>
|
|
</section>
|
|
{{end}}
|
|
|
|
<section class="mb-10">
|
|
<div class="flex items-end justify-between gap-3 mb-4">
|
|
<h2 class="font-display text-xl sm:text-2xl font-bold">
|
|
<span aria-hidden="true">📊</span> Channels
|
|
</h2>
|
|
<span class="text-xs text-[color:var(--ink)]/50">{{if .PostingEnabled}}last 24 hours{{else}}what Pete's tracking{{end}}</span>
|
|
</div>
|
|
<div class="grid grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4">
|
|
{{range .Stats}}
|
|
<a href="/{{.Channel.Slug}}"
|
|
class="block rounded-3xl bg-[color:var(--card)] border-2 border-[color:var(--ink)]/10 shadow-pete p-4 hover:-translate-y-1 hover:shadow-pete-lg transition">
|
|
<div class="flex items-center gap-2">
|
|
<span class="inline-flex items-center justify-center h-9 w-9 rounded-2xl bg-theme-{{.Channel.Theme}} text-white text-lg">
|
|
{{.Channel.Emoji}}
|
|
</span>
|
|
<span class="font-display text-lg font-semibold">{{.Channel.Title}}</span>
|
|
</div>
|
|
<dl class="mt-3 space-y-1 text-xs text-[color:var(--ink)]/70">
|
|
{{if $.PostingEnabled}}
|
|
<div class="flex justify-between gap-2">
|
|
<dt>last post</dt>
|
|
<dd class="font-semibold text-[color:var(--ink)]">
|
|
{{if .HasLastPosted}}{{timeAgo .LastPostedAt}}{{else}}—{{end}}
|
|
</dd>
|
|
</div>
|
|
<div class="flex justify-between gap-2">
|
|
<dt>posted 24h</dt>
|
|
<dd class="font-semibold text-[color:var(--ink)]">{{.PostsToday}}</dd>
|
|
</div>
|
|
{{end}}
|
|
<div class="flex justify-between gap-2">
|
|
<dt>stories</dt>
|
|
<dd class="font-semibold text-[color:var(--ink)]">{{.Total}}</dd>
|
|
</div>
|
|
</dl>
|
|
</a>
|
|
{{end}}
|
|
</div>
|
|
</section>
|
|
|
|
<section class="mb-12">
|
|
<div class="flex items-end justify-between gap-3 mb-4">
|
|
<h2 class="font-display text-xl sm:text-2xl font-bold">
|
|
<span aria-hidden="true">🗞️</span> Latest across the feed
|
|
</h2>
|
|
<span class="text-xs text-[color:var(--ink)]/50">newest first, all channels</span>
|
|
</div>
|
|
{{if .Latest}}
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
|
|
{{range .Latest}}
|
|
{{template "card" dict "Story" . "Theme" .Channel "ShowChannel" true}}
|
|
{{end}}
|
|
</div>
|
|
{{else}}
|
|
<div class="rounded-3xl bg-[color:var(--card)] border-2 border-dashed border-[color:var(--ink)]/15 p-8 text-center text-[color:var(--ink)]/60">
|
|
Nothing here yet — Pete's still listening.
|
|
</div>
|
|
{{end}}
|
|
</section>
|
|
{{end}}
|