refactor: extract url helpers, add EMAIL_DOMAIN support

- Add src/utils/urls.ts with baseUrl, feedRssUrl, feedAtomUrl, feedUrl,
  feedEmailAddress, feedTopicPattern
- Add optional EMAIL_DOMAIN env var so web domain and email domain can
  differ (e.g. demo.kill-the.news serves feeds, @kill-the.news receives mail)
- Replace all inline domain template literals with the new helpers
- Remove unused site_url/feed_url fields from FeedConfig
- Remove unused feedPath param from fetchFeedData
- Extract verifyCallback() to deduplicate verifyAndStoreSubscription /
  verifyAndDeleteSubscription

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Julien Herr
2026-05-22 22:38:29 +02:00
parent c64ceb4ee7
commit 7b2b98d693
15 changed files with 104 additions and 92 deletions
+1 -2
View File
@@ -3,6 +3,7 @@ export interface Env {
EMAIL_STORAGE: KVNamespace;
ADMIN_PASSWORD: string;
DOMAIN: string;
EMAIL_DOMAIN?: string;
ATTACHMENT_BUCKET?: R2Bucket;
FEED_MAX_SIZE_BYTES?: string;
PROXY_TRUSTED_IPS?: string;
@@ -33,8 +34,6 @@ export interface FeedConfig {
description?: string;
allowed_senders?: string[];
language: string;
site_url: string;
feed_url: string;
author?: string;
created_at: number;
updated_at?: number;