1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
133});
134
135export default modifyFetchHandler(passwordAuth(app.fetch));
12 }
13 console.log("Making export api request with params " + queryParams.toString());
14 const response = await fetch("https://readwise.io/api/v2/export/?" + queryParams.toString(), {
15 method: "GET",
16 headers: {
44 }
45 console.log("Making export api request with params " + queryParams.toString());
46 const response = await fetch("https://readwise.io/api/v3/list/?" + queryParams.toString(), {
47 method: "GET",
48 headers: {
8 // Later, if you want to get new documents updated after some date, do this:
9 // const docsAfterDate = new Date(Date.now() - 24 * 60 * 60 * 1000); // use your own stored date
10 // const newData = await fetchDocumentListApi(docsAfterDate.toISOString());
11
12 return new Response(dataToRSS(
1Reader docs here: https://readwise.io/reader_api
2
3Adapted from the example code. Fetches items from Readwise Reader given a token, and optional updatedAfter and location parameters.
5In order to get read items from Readwise Reader -> Workflowy, this turns the read items (aka "archive") into an RSS feed, which Zapier picks up, and creates bullets in Workflowy.
6
7Ideally would store the generated RSS or the last fetch date, and only get new items, but for now `readwiseReaderDocumentList` re-fetches the full history each time.
33
34 // Post the message so we can deal with large text data.
35 await fetch(`/post-message?threadId=${input.getAttribute("data-thread-id")}`, {
36 method: "post",
37 body: msgDiv.textContent,
147 return new Response(body, { headers: { "Content-Type": "text/event-stream" } });
148});
149export default app.fetch;
75 });
76
77 self.addEventListener('fetch', (event) =>
1import { fetchTodaysNytCxPuzzle } from "https://esm.town/v/plr/fetchTodaysNytCxPuzzle";
2import type { Puzzle, PuzzleContent } from "https://esm.town/v/plr/fetchTodaysNytCxPuzzle";
3
4const formatGrid = (
10};
11
12export const fetchTodaysNytCxGridAndClues = async (
13 { filled }: { filled: boolean } = { filled: false },
14): Promise<Pick<PuzzleContent, "grid" | "clues">> => {
15 const puzzle = await fetchTodaysNytCxPuzzle();
16 const grid = formatGrid(puzzle.content.grid, { filled });
17 const clues = puzzle.content.clues;
1# DuckDB
2
3[DuckDB](https://duckdb.org/) works on Val Town, with only one small tweak! We're basically using DuckDB in the same way you'd use it with a browser - using the WASM package with its dependencies fetched from [jsdelivr](https://www.jsdelivr.com/).
4
5The only trick is to create the worker ourselves rather than using `duckdb.createWorker`. DuckDB's built-in createWorker method doesn't specify a worker type, which causes `type` to default to `classic`, and Deno (our runtime) doesn't support classic workers.