mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-21 06:13:48 +00:00
fix(websub): require feed existence for subscriptions, remove atom hub header, simplify router mounting
- Add KV feed existence check in hub.ts to prevent SSRF via non-existent feeds (returns 404) - Treat empty string hub.secret as absent (|| instead of ??) - Remove misleading hub Link header from atom.ts (hub only supports RSS topics) - Simplify double-layered hub router in index.ts (direct app.route instead of nested Hono) - Update hub.test.ts to seed KV with feed config for tests requiring valid subscribe/unsubscribe Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -51,17 +51,11 @@ export async function handle(c: Context): Promise<Response> {
|
||||
const baseUrl = `https://${env.DOMAIN}`;
|
||||
const atomXml = generateAtomFeed(feedConfig, emailsData, baseUrl, feedId);
|
||||
|
||||
const linkHeader = [
|
||||
`<https://${env.DOMAIN}/hub>; rel="hub"`,
|
||||
`<https://${env.DOMAIN}/atom/${feedId}>; rel="self"`,
|
||||
].join(", ");
|
||||
|
||||
return new Response(atomXml, {
|
||||
status: 200,
|
||||
headers: {
|
||||
"Content-Type": "application/atom+xml",
|
||||
"Cache-Control": "max-age=1800",
|
||||
Link: linkHeader,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user