openAQLocationmain.tsx2 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2import { msDay } from "https://esm.town/v/stevekrouse/msDay";
36lon: number;
7}) => {
8const { results } = await fetchJSON(
9"https://api.openaq.org/v2/locations?"
10+ new URLSearchParams({
HTreeTreePmain.tsx14 matches
32}`;
3334const DEFAULT_REQUEST = `let resp = await fetch("http://localhost");
35const logIt = () => {
36console.log(resp.status);
95work.onmessage = (e) => {
96try {
97const resp: { logs: Log[]; error?: { message: string; stack: string }; requests: FetchInfo[] } = JSON.parse(
98e.data,
99);
133);
134}
135async handleRequest(req: Request, requestId: string, fetchId: string): Promise<Response> {
136let requestRow = parseResultSet<RequestRow>(
137await sqlite.execute({
167await sqlite.execute({
168sql: `UPDATE requests SET handler_logs = json_insert(handler_logs, '$[#]',json(?)) WHERE id = ?`,
169args: [JSON.stringify({ id: parseInt(fetchId), logs }), requestId],
170});
171return resp;
258const requestId = req.headers.get("X-Request-ID");
259if (requestId) {
260const fetchId = req.headers.get("X-Fetch-ID");
261req.headers.delete("X-Request-ID");
262req.headers.delete("X-Fetch-ID");
263return app.handleRequest(req, requestId, fetchId);
264}
265if (req.method === "GET") {
309date: number;
310};
311type FetchInfo = {
312id: number;
313req: RequestObj;
319// outside of this function as it won't be available within the worker.
320const workerScript = () => {
321const requests: FetchInfo[] = [];
322323let proxyUrl: string;
324let requestId: number;
325let fetchCount: number = 1;
326let blobUrl: string;
327332.join("\n"));
333334globalThis.fetch = new Proxy(fetch, {
335async apply(target, thisArg, args) {
336const id = fetchCount++;
337const ogUrl = args[0];
338args[0] = proxyUrl;
340args[1].headers = args[1].headers || {};
341args[1].headers["X-Request-ID"] = requestId;
342args[1].headers["X-Fetch-ID"] = id;
343args[1].headers["X-Original-URL"] = ogUrl;
344const req: RequestObj = {
349};
350delete req.headers["X-Request-ID"];
351delete req.headers["X-Fetch-ID"];
352delete req.headers["X-Original-URL"];
353const stack = cleanStack((new Error()).stack).replaceAll(blobUrl, "./script.ts");
datme_home_geomain.tsx2 matches
2import date_me_doc_locations from "https://esm.town/v/stevekrouse/date_me_doc_locations";
3import Layout from "https://esm.town/v/stevekrouse/dateme_layout";
4import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
5import { Hono } from "npm:hono@3";
664const app = new Hono();
65app.get("/", Home);
66export default reloadOnSaveFetchMiddleware(app.fetch);
reloadOnSavemain.tsx2 matches
3738/**
39* @param handler http val's fetch handler
40* @param vals to watch
41*/
42export function reloadOnSaveFetchMiddleware(
43handler: (req: Request) => Response | Promise<Response>,
44vals = [rootValRef()],
tanLadybugmain.tsx5 matches
30event.preventDefault();
31const formData = new FormData(form);
32const response = await fetch('/', {
33method: 'POST',
34body: formData,
43event.preventDefault();
44const formData = new FormData(form);
45const response = await fetch('/', {
46method: 'POST',
47body: formData,
135event.preventDefault();
136const formData = new FormData(form);
137const response = await fetch('/', {
138method: 'POST',
139body: formData,
148event.preventDefault();
149const formData = new FormData(form);
150const response = await fetch('/', {
151method: 'POST',
152body: formData,
219});
220221export default valTownBadge(app.fetch, import.meta.url);
blackRodentmain.tsx1 match
49app.get("/projects/Time_Blindness_Loud_Calendar_via_iOS_shortcuts", Time_Blindness_Loud_Calendar_via_iOS_shortcuts);
5051export default app.fetch;
purpleHornetmain.tsx1 match
56const app = new Hono();
57app.get("/", Bringing_My_OCD_Online);
58export default app.fetch;
azureBeetlemain.tsx1 match
55const app = new Hono();
56app.get("/", homepage);
57export default app.fetch;
valTownAnalyticsmain.tsx2 matches
34}
35// Do not await the response
36fetch(`${httpEndpoint}/event?name=import-init&val=${runningValInfo.author}/${runningValInfo.name}`);
37} catch (e) {
38console.error(`Error initializing analytics: ${e}`);
45const runningValInfo = getRunningValInfo();
46return async (req: Request): Promise<Response> => {
47fetch(`${httpEndpoint}/event?name=request&val=${runningValInfo.author}/${runningValInfo.name}&url=${req.url}`);
48return handler(req);
49};