mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
style: fix Prettier formatting on 11 files
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,8 @@ describe("Admin Routes", () => {
|
||||
mockEnv = createMockEnv() as unknown as Env;
|
||||
testApp = new Hono();
|
||||
testApp.route("/admin", app);
|
||||
request = (path, init = {}) => Promise.resolve(testApp.request(path, init, mockEnv));
|
||||
request = (path, init = {}) =>
|
||||
Promise.resolve(testApp.request(path, init, mockEnv));
|
||||
loginAndGetCookie = async () => {
|
||||
const formData = new FormData();
|
||||
formData.append("password", "test-password");
|
||||
@@ -366,7 +367,10 @@ describe("Admin Routes", () => {
|
||||
} as unknown as Env;
|
||||
}
|
||||
|
||||
function makeProxyRequest(path: string, headers: Record<string, string> = {}) {
|
||||
function makeProxyRequest(
|
||||
path: string,
|
||||
headers: Record<string, string> = {},
|
||||
) {
|
||||
const proxyApp = new Hono();
|
||||
proxyApp.route("/admin", app);
|
||||
return proxyApp.request(path, { headers }, proxyEnv());
|
||||
|
||||
@@ -68,7 +68,11 @@ describe("Atom Feed Route", () => {
|
||||
`feed:${FEED_ID}:metadata`,
|
||||
JSON.stringify({
|
||||
emails: [
|
||||
{ key: emailKey, subject: "Atom Entry Subject", receivedAt: 1700000001000 },
|
||||
{
|
||||
key: emailKey,
|
||||
subject: "Atom Entry Subject",
|
||||
receivedAt: 1700000001000,
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
+49
-23
@@ -21,7 +21,9 @@ export async function handle(c: Context): Promise<Response> {
|
||||
return new Response("Feed not found", { status: 404 });
|
||||
}
|
||||
|
||||
const metaEntry = feedMetadata.emails.find((e) => e.receivedAt === receivedAt);
|
||||
const metaEntry = feedMetadata.emails.find(
|
||||
(e) => e.receivedAt === receivedAt,
|
||||
);
|
||||
if (!metaEntry) {
|
||||
return new Response("Entry not found", { status: 404 });
|
||||
}
|
||||
@@ -39,26 +41,50 @@ export async function handle(c: Context): Promise<Response> {
|
||||
"default-src 'none'; style-src 'unsafe-inline'; img-src *; frame-src 'none'",
|
||||
);
|
||||
|
||||
return c.html(html`<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>${emailData.subject}</title>
|
||||
<style>
|
||||
body { font-family: sans-serif; max-width: 800px; margin: 0 auto; padding: 1rem; }
|
||||
.meta { color: #666; font-size: 0.875rem; margin-bottom: 1.5rem; border-bottom: 1px solid #eee; padding-bottom: 0.75rem; }
|
||||
.meta dt { display: inline; font-weight: bold; }
|
||||
.meta dd { display: inline; margin: 0 1rem 0 0.25rem; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>${emailData.subject}</h1>
|
||||
<dl class="meta">
|
||||
<dt>From:</dt><dd>${emailData.from}</dd>
|
||||
<dt>Date:</dt><dd>${new Date(emailData.receivedAt).toUTCString()}</dd>
|
||||
</dl>
|
||||
<div class="content">${raw(emailData.content)}</div>
|
||||
</body>
|
||||
</html>`);
|
||||
return c.html(
|
||||
html`<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0"
|
||||
/>
|
||||
<title>${emailData.subject}</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 1rem;
|
||||
}
|
||||
.meta {
|
||||
color: #666;
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: 1.5rem;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 0.75rem;
|
||||
}
|
||||
.meta dt {
|
||||
display: inline;
|
||||
font-weight: bold;
|
||||
}
|
||||
.meta dd {
|
||||
display: inline;
|
||||
margin: 0 1rem 0 0.25rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>${emailData.subject}</h1>
|
||||
<dl class="meta">
|
||||
<dt>From:</dt>
|
||||
<dd>${emailData.from}</dd>
|
||||
<dt>Date:</dt>
|
||||
<dd>${new Date(emailData.receivedAt).toUTCString()}</dd>
|
||||
</dl>
|
||||
<div class="content">${raw(emailData.content)}</div>
|
||||
</body>
|
||||
</html>`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ describe("GET /files/:attachmentId/:filename", () => {
|
||||
});
|
||||
|
||||
it("returns 200 with stored content when attachment exists", async () => {
|
||||
const content = new TextEncoder().encode("PDF content").buffer as ArrayBuffer;
|
||||
const content = new TextEncoder().encode("PDF content")
|
||||
.buffer as ArrayBuffer;
|
||||
await mockR2.put("test-uuid", content, {
|
||||
httpMetadata: { contentType: "application/pdf" },
|
||||
});
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { Context } from "hono";
|
||||
import { Env } from "../types";
|
||||
import {
|
||||
ForwardEmailPayload,
|
||||
handleForwardEmail,
|
||||
} from "../lib/forwardemail";
|
||||
import { ForwardEmailPayload, handleForwardEmail } from "../lib/forwardemail";
|
||||
|
||||
export async function handle(c: Context): Promise<Response> {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user