fix(feed): add Atom link in emails page, fix HTML stripping, use request URL for self-link

- Add Atom Feed URL to the Feed Details card in the emails page
- Fix extractBodyContent to handle emails without a closing </body> tag
  (regex now falls back to capturing everything after the opening <body>)
- Use the actual request URL origin for atom:link rel="self" in RSS/Atom
  feeds, guaranteeing it always matches the document location regardless
  of how DOMAIN is configured

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Julien Herr
2026-05-22 18:41:21 +02:00
parent bcc9640591
commit 4428f35dd4
4 changed files with 31 additions and 7 deletions
+2 -1
View File
@@ -93,7 +93,7 @@ emailsRouter.get("/feeds/:feedId/emails", async (c) => {
const emailAddress = `${feedId}@${env.DOMAIN}`;
const rssUrl = `https://${env.DOMAIN}/rss/${feedId}`;
const atomUrl = `https://${env.DOMAIN}/atom/${feedId}`;
return c.html(
<Layout title={`${feedConfig.title} - Emails`}>
@@ -114,6 +114,7 @@ emailsRouter.get("/feeds/:feedId/emails", async (c) => {
<div>
<CopyField label="Email Address:" value={emailAddress} />
<CopyField label="RSS Feed:" value={rssUrl} />
<CopyField label="Atom Feed:" value={atomUrl} />
</div>
</div>
+2
View File
@@ -16,11 +16,13 @@ export async function handle(c: Context<{ Bindings: Env }>): Promise<Response> {
}
const baseUrl = `https://${c.env.DOMAIN}`;
const selfUrl = new URL(c.req.url).origin + `/atom/${feedId}`;
const atomXml = generateAtomFeed(
feedData.feedConfig,
feedData.emails,
baseUrl,
feedId,
selfUrl,
);
const linkHeader = [
`<${baseUrl}/hub>; rel="hub"`,
+2
View File
@@ -16,11 +16,13 @@ export async function handle(c: Context<{ Bindings: Env }>): Promise<Response> {
}
const baseUrl = `https://${c.env.DOMAIN}`;
const selfUrl = new URL(c.req.url).origin + `/rss/${feedId}`;
const rssXml = generateRssFeed(
feedData.feedConfig,
feedData.emails,
baseUrl,
feedId,
selfUrl,
);
const linkHeader = [
`<${baseUrl}/hub>; rel="hub"`,