mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
feat(admin): link email detail to its public entry page
Add a "Public page" link next to the Rendered/Raw toggle in the admin email view, opening the standalone /entries/:feedId/:entryId render. Centralize the entry route shape in a pure entryPath() builder, used by both the admin link and the RSS/Atom/JSON feed generator. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import { Feed } from "feed";
|
||||
import { FeedConfig, EmailData } from "../types";
|
||||
import { processEmailContent, htmlToText } from "./html-processor";
|
||||
import { EmailAddress } from "../domain/value-objects/email-address";
|
||||
import { entryPath } from "./urls";
|
||||
|
||||
export { processEmailContent as extractBodyContent };
|
||||
|
||||
@@ -64,7 +65,7 @@ function buildFeed(
|
||||
});
|
||||
|
||||
for (const email of emails) {
|
||||
const entryUrl = `${baseUrl}/entries/${feedId}/${email.receivedAt}`;
|
||||
const entryUrl = `${baseUrl}${entryPath(feedId, email.receivedAt)}`;
|
||||
// Inline images are rendered in the body, not surfaced as an enclosure.
|
||||
const firstAttachment = email.attachments?.find((a) => !a.inline);
|
||||
const bodyContent = processEmailContent(
|
||||
|
||||
@@ -17,6 +17,12 @@ export function feedJsonUrl(feedId: string, env: Env): string {
|
||||
return `${baseUrl(env)}/json/${feedId}`;
|
||||
}
|
||||
|
||||
/** Path of an email's public HTML view. The single source of truth for the
|
||||
* `/entries/:feedId/:entryId` route shape (entryId = the email's receivedAt). */
|
||||
export function entryPath(feedId: string, receivedAt: number): string {
|
||||
return `/entries/${feedId}/${receivedAt}`;
|
||||
}
|
||||
|
||||
export function feedUrl(
|
||||
format: "rss" | "atom",
|
||||
feedId: string,
|
||||
|
||||
Reference in New Issue
Block a user