mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-21 06:13:48 +00:00
feat: reader-rendering correctness + privacy hardening (P1·S batch)
Close the five open P1·S items from TODO.md: - X-Robots-Tag: noindex on rss/atom/entries/files + a /robots.txt - absolutize relative content URLs against the sender's site - promote lazy-loaded images (data-src → src, strip loading="lazy") - strip XML-illegal control chars from generated feeds (keep emoji) - plain-text feed <title> (strip HTML, decode entities) Sender-base derivation lives on the EmailAddress value object (siteBaseUrl) instead of a misplaced favicon helper. Bump to 0.2.1 and document the changes in README + CLAUDE.md. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+10
-5
@@ -2,6 +2,7 @@ import { Context } from "hono";
|
||||
import { html, raw } from "hono/html";
|
||||
import { Env } from "../types";
|
||||
import { processEmailContent } from "../infrastructure/html-processor";
|
||||
import { EmailAddress } from "../domain/value-objects/email-address";
|
||||
import { formatBytes } from "../domain/format";
|
||||
import { FeedRepository } from "../infrastructure/feed-repository";
|
||||
import { FeedId } from "../domain/value-objects/feed-id";
|
||||
@@ -46,6 +47,14 @@ export async function handle(c: Context<{ Bindings: Env }>): Promise<Response> {
|
||||
"Content-Security-Policy",
|
||||
"default-src 'none'; style-src 'unsafe-inline'; img-src *; frame-src 'none'",
|
||||
);
|
||||
c.header("X-Robots-Tag", "noindex");
|
||||
|
||||
const bodyContent = processEmailContent(
|
||||
emailData.content,
|
||||
emailData.attachments,
|
||||
"",
|
||||
EmailAddress.parse(emailData.from)?.siteBaseUrl() ?? "",
|
||||
);
|
||||
|
||||
// Inline images render in place (cid: refs are rewritten by processEmailContent);
|
||||
// only genuine, downloadable attachments belong in the list below.
|
||||
@@ -92,11 +101,7 @@ export async function handle(c: Context<{ Bindings: Env }>): Promise<Response> {
|
||||
<dt>Date:</dt>
|
||||
<dd>${new Date(emailData.receivedAt).toUTCString()}</dd>
|
||||
</dl>
|
||||
<div class="content">
|
||||
${raw(
|
||||
processEmailContent(emailData.content, emailData.attachments),
|
||||
)}
|
||||
</div>
|
||||
<div class="content">${raw(bodyContent)}</div>
|
||||
${attachmentsSection}
|
||||
</body>
|
||||
</html>`,
|
||||
|
||||
Reference in New Issue
Block a user