4import process from "node:process";
5
6async function fetchCast({ fid, hash }: { fid: string; hash: string }) {
7 console.log("fetchCast", { fid, hash });
8 const res = await fetch(
9 `https://api.neynar.com/v2/farcaster/cast?identifier=${hash}&type=hash`,
10 {
34 };
35
36 const res = await fetch(`https://simple-api.glif.app`, {
37 method: "POST",
38 body: JSON.stringify(body),
76 };
77
78 console.log("postCast fetching...", url, cast);
79 const res = await fetch(url, options);
80 let json;
81 try {
152
153 const cast = data.castId;
154 const castText = await fetchCast(cast);
155 console.log({ cast, castText });
156 const inputs = [castText];
17});
18
19export default app.fetch;
11How does this new shiny search engine work? Well, it's quite simple.
12
131. I wrote a [Deno script](https://github.com/pomdtr/val-town-mirror/blob/main/scripts/pull.ts) that fetches all vals from the Val Town API.
142. I pushed the data to a [Github Repository](https://github.com/pomdtr/val-town-mirror)
153. I added a [Github Action](https://github.com/pomdtr/val-town-mirror/blob/main/.github/workflows/sync.yaml) that runs the script every hour to refresh the data.
11How does this new shiny search engine work? Well, it's quite simple.
12
131. I wrote a [Deno script](https://github.com/pomdtr/val-town-mirror/blob/main/scripts/pull.ts) that fetches all vals from the Val Town API.
142. I pushed the data to a [Github Repository](https://github.com/pomdtr/val-town-mirror)
153. I added a [Github Action](https://github.com/pomdtr/val-town-mirror/blob/main/.github/workflows/sync.yaml) that runs the script every hour to refresh the data.
11How does this new shiny search engine work? Well, it's quite simple.
12
131. I wrote a Deno script that fetches all vals from the Val Town API.
14
15```ts
27const vals = [];
28while (true) {
29 console.log("fetching", url);
30 const resp = await fetch(url);
31 if (!resp.ok) {
32 console.error(resp.statusText);
76const vals = [];
77while (true) {
78 console.log("fetching", url);
79 const resp = await fetch(url);
80 if (!resp.ok) {
81 console.error(resp.statusText);
84 let selection = await blob.getJSON(`ph-${version}-selection-${weight}`);
85 if (!selection) {
86 const res = await fetch(this.selectionURL(weight, version), {
87 method: "GET",
88 mode: "cors",
109
110 if (!buffer) {
111 const res = await fetch(this.fontURL(weight, version), {
112 method: "GET",
113 mode: "cors",
134
135 if (!css) {
136 const res = await fetch(this.cssURL(weight, version), {
137 method: "GET",
138 mode: "cors",
7 body.append("client_secret", Deno.env.get("NOTEHUB_CLIENT_SECRET"));
8
9 const res = await fetch("https://notehub.io/oauth2/token", {
10 method: "POST",
11 headers: {
22 try {
23 const token = await authenticate();
24 const res = await fetch(
25 `https://api.notefile.net/v1/projects/${projectUID}/devices/${deviceUID}/notes/${fileName}`,
26 {
103 }
104
105 const dom_promise = fetch(url.toString(), {
106 method: req.method,
107 headers: new Headers({
110 "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
111 "Accept-Language": "en-US,en;q=0.5",
112 "Sec-Fetch-Site": "cross-site",
113 "Sec-Fetch-Mode": "navigate",
114 "Sec-Fetch-User": "?1",
115 "Sec-Fetch-Dest": "document",
116 "Referer": "https://www.google.com/",
117 "sec-ch-ua": `"Not A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"`,
22});
23
24export default app.fetch;
1import { email } from "https://esm.town/v/std/email";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,