mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
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:
+2
-3
@@ -6,6 +6,7 @@ import {
|
||||
} from "../utils/websub";
|
||||
import { waitUntilSafe } from "../utils/worker";
|
||||
import { DEFAULT_LEASE_SECONDS, MAX_LEASE_SECONDS } from "../config/constants";
|
||||
import { feedTopicPattern } from "../utils/urls";
|
||||
|
||||
type AppEnv = { Bindings: Env };
|
||||
|
||||
@@ -60,9 +61,7 @@ hubRouter.post("/", async (c) => {
|
||||
}
|
||||
|
||||
// Validate that topic matches a known RSS or Atom feed on this hub
|
||||
const topicPattern = new RegExp(
|
||||
`^https://${env.DOMAIN.replaceAll(".", "\\.")}/(rss|atom)/([^/]+)$`,
|
||||
);
|
||||
const topicPattern = feedTopicPattern(env);
|
||||
const match = topic.match(topicPattern);
|
||||
if (!match) {
|
||||
return c.text(
|
||||
|
||||
Reference in New Issue
Block a user