mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ export interface Env {
|
||||
FEED_MAX_SIZE_BYTES?: string;
|
||||
PROXY_TRUSTED_IPS?: string;
|
||||
PROXY_AUTH_SECRET?: string;
|
||||
FEED_TTL_HOURS?: string;
|
||||
}
|
||||
|
||||
// Stored attachment metadata (bytes live in R2, keyed by id)
|
||||
@@ -38,6 +39,7 @@ export interface FeedConfig {
|
||||
author?: string;
|
||||
created_at: number;
|
||||
updated_at?: number;
|
||||
expires_at?: number; // Unix timestamp ms — present when a TTL is configured
|
||||
}
|
||||
|
||||
// Feed metadata interface
|
||||
@@ -64,6 +66,7 @@ export interface FeedListItem {
|
||||
id: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
expires_at?: number; // Cached from FeedConfig to avoid per-feed KV reads
|
||||
}
|
||||
|
||||
// WebSub (PubSubHubbub) subscription configuration
|
||||
|
||||
Reference in New Issue
Block a user