mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
feat: store email attachments in R2 and expose as RSS enclosures
Attachments from incoming emails are uploaded to an optional Cloudflare R2
bucket and exposed as <enclosure> elements in RSS and <link rel="enclosure">
in Atom feeds, served at /files/{id}/{filename} with immutable caching.
R2 is opt-in: if ATTACHMENT_BUCKET is not bound the feature is a no-op.
Attachments are cleaned up from R2 on email/feed deletion and during
size-based feed trimming. Adds MockR2 to the test setup.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,11 +3,20 @@ export interface Env {
|
||||
EMAIL_STORAGE: KVNamespace;
|
||||
ADMIN_PASSWORD: string;
|
||||
DOMAIN: string;
|
||||
ATTACHMENT_BUCKET?: R2Bucket;
|
||||
FEED_MAX_SIZE_BYTES?: string;
|
||||
PROXY_TRUSTED_IPS?: string;
|
||||
PROXY_AUTH_SECRET?: string;
|
||||
}
|
||||
|
||||
// Stored attachment metadata (bytes live in R2, keyed by id)
|
||||
export interface AttachmentData {
|
||||
id: string;
|
||||
filename: string;
|
||||
contentType: string;
|
||||
size: number;
|
||||
}
|
||||
|
||||
// Email interface for stored emails
|
||||
export interface EmailData {
|
||||
subject: string;
|
||||
@@ -15,6 +24,7 @@ export interface EmailData {
|
||||
content: string;
|
||||
receivedAt: number;
|
||||
headers: Record<string, string>;
|
||||
attachments?: AttachmentData[];
|
||||
}
|
||||
|
||||
// Feed configuration interface
|
||||
@@ -41,6 +51,7 @@ export interface EmailMetadata {
|
||||
subject: string;
|
||||
receivedAt: number;
|
||||
size?: number;
|
||||
attachmentIds?: string[];
|
||||
}
|
||||
|
||||
// Feed list interface
|
||||
|
||||
Reference in New Issue
Block a user