refactor: simplify quick-win code after review

- Make feedId required in generateRssFeed (removes dead /emails/ fallback)
- Hoist loop-invariant conditional and remove intermediate variable
- Extract normalizeAllowedSenders() so JSON and form paths share same logic
- Move escapeHtml to src/utils/html.ts for reuse by admin.ts
- Parallelize the two independent KV puts in feed creation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Julien Herr
2026-05-20 23:55:17 +02:00
parent e140b433d8
commit 5308544672
4 changed files with 21 additions and 34 deletions
+1 -8
View File
@@ -1,13 +1,6 @@
import { Context } from "hono";
import { Env, FeedMetadata, EmailData } from "../types";
function escapeHtml(str: string): string {
return str
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;");
}
import { escapeHtml } from "../utils/html";
export async function handle(c: Context): Promise<Response> {
const env = c.env as unknown as Env;