63 const fetchStories = async () => {
64 try {
65 const response = await fetch("/api/stories");
66 if (!response.ok) throw new Error("Failed to fetch dates");
67 const data = await response.json();
77 try {
78 dispatch({ type: "loading", value: true });
79 const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80 if (!response.ok) throw new Error("Failed to fetch comments");
81 const data = await response.json();
360export default async function(req: Request): Promise<Response> {
361 const url = new URL(req.url);
362 if (url.pathname === "/api/stories") {
363 const storySearch = await hnSearch({
364 search_by_date: true,
381 }
382
383 if (url.pathname === "/api/comments") {
384 const params = url.searchParams;
385 const query = params.get("query") || "";
6 * 2. Use JavaScript to handle file selection and PDF generation
7 * 3. Utilize the jsPDF library for PDF creation
8 * 4. Use the FileReader API to read image files
9 *
10 * The application will not modify or convert the images, and each PDF page
1/** @jsxImportSource npm:hono@3/jsx */
2import { Unkey } from "npm:@unkey/api@0.26.1";
3import { Ratelimit } from "npm:@unkey/ratelimit@0.4.4";
4import type { Duration } from "npm:@unkey/ratelimit@0.4.4";
3
4const replicate = new Replicate({
5 auth: Deno.env.get("REPLICATE_API_KEY"),
6});
7//
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />
30type Test<T extends string = TwoLettersString> = T;
31
32type CapitalizeTwoLetterString<T extends string, U extends string = TwoLettersString> = T extends U ? Capitalize<T>
33 : never;
34
35type fullName = `${CapitalizeTwoLetterString<"a">} ${CapitalizeTwoLetterString<"df", TwoLettersString>}`;
36
37const fn: never = "1" as undefined as never;
28type TwoLettersString = `${alfabet}${alfabet}`;
29
30type CapitalizeTwoLetterString<T extends string, U extends TwoLettersString> = T extends U ? Capitalize<T> : never;
31
32type fullName = `${CapitalizeTwoLetterString<"as", TwoLettersString>} ${CapitalizeTwoLetterString<
33 "df",
34 TwoLettersString
30type Test<T extends string = TwoLettersString> = T;
31
32type CapitalizeTwoLetterString<T extends string, U extends string = TwoLettersString> = T extends U ? Capitalize<T>
33 : never;
34
35type fullName = `${CapitalizeTwoLetterString<"a">} ${CapitalizeTwoLetterString<"df", TwoLettersString>}`;
36
37const fn: never = "1" as undefined as never;
28type TwoLettersString = `${alfabet}${alfabet}`;
29
30type CapitalizeTwoLetterString<T extends string, U extends TwoLettersString> = T extends U ? Capitalize<T> : never;
31
32type fullName = `${CapitalizeTwoLetterString<"as", TwoLettersString>} ${CapitalizeTwoLetterString<
33 "df",
34 TwoLettersString