fix(websub): add missing WebSub Link header to Atom feed

The RSS feed already advertised hub and self via the Link response
header, but the Atom feed was missing it entirely. Subscribers using
Atom had no way to discover the hub for real-time push notifications.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Julien Herr
2026-05-21 23:46:38 +02:00
parent 5723fd36f9
commit bde06dd3e4
2 changed files with 14 additions and 0 deletions
+6
View File
@@ -51,11 +51,17 @@ export async function handle(c: Context): Promise<Response> {
const baseUrl = `https://${env.DOMAIN}`;
const atomXml = generateAtomFeed(feedConfig, emailsData, baseUrl, feedId);
const linkHeader = [
`<${baseUrl}/hub>; rel="hub"`,
`<${baseUrl}/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) {