feat(feeds): add configurable per-feed lifetime (TTL)

Replace the demo nightly KV wipe with a per-feed expiry. Feeds can be
given a lifetime at creation (and edited later); FEED_TTL_HOURS locks the
value server-side and greys out the UI field. Expired feeds stay visible
in admin (greyed, actions disabled), return 410 on rss/atom/entries, and
reject inbound emails. The scheduled handler now purges only expired
feeds (KV + R2 attachments) on an hourly global cron.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
Julien HerrandClaude Sonnet 4.6 committed 2026-05-23 09:05:48 +02:00
1 parent 24c7d2a53e
commit f4d5edda0e
11 files changed
+461 -123

No files matched your search

+10
View File
@@ -112,6 +112,16 @@ export async function validateEmail(
response: new Response("Feed does not exist", { status: 404 }),
};
}
if (
feedConfig.expires_at !== undefined &&
feedConfig.expires_at <= Date.now()
) {
logger.warn("Rejected email: feed expired", { feedId });
return {
ok: false,
response: new Response("Feed has expired", { status: 410 }),
};
}
const allowedSenders = (feedConfig.allowed_senders || [])
.map(normalizeEmail)