mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
feat(websub): add hub discovery Link headers to RSS and Atom feeds
This commit is contained in:
@@ -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 = [
|
||||
`<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) {
|
||||
|
||||
@@ -65,11 +65,17 @@ export async function handle(c: Context): Promise<Response> {
|
||||
const rssXml = generateRssFeed(feedConfig, emailsData, baseUrl, feedId);
|
||||
|
||||
// Return the RSS feed with appropriate content type
|
||||
const linkHeader = [
|
||||
`<https://${env.DOMAIN}/hub>; rel="hub"`,
|
||||
`<https://${env.DOMAIN}/rss/${feedId}>; rel="self"`,
|
||||
].join(", ");
|
||||
|
||||
return new Response(rssXml, {
|
||||
status: 200,
|
||||
headers: {
|
||||
"Content-Type": "application/rss+xml",
|
||||
"Cache-Control": "max-age=1800", // 30 minutes cache
|
||||
Link: linkHeader,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user