1export function insecureFetch(input: string | URL | Request, init?: RequestInit) {
2 const origReq = new Request(input, init);
3 const proxyURL = new URL("https://unsecure-fetch.val-town.workers.dev");
4 proxyURL.searchParams.set("url", origReq.url);
5 const req = new Request(proxyURL, origReq);
6 return globalThis.fetch(req);
7}
15
16export default async function(interval: Interval) {
17 const response = await fetch(dictionaryUrl);
18 const { features } = await response.json();
19 const featuresAboveConfidenceThreshold = features.filter(
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function uploadTo0x0(data, name) {
6 formData.append("file", blob, name);
7 formData.append("expires", "1");
8 const response = await fetch("https://0x0.st", {
9 method: "POST",
10 body: formData,
16});
17
18export default app.fetch;
7Currently (as of 4/14/24) this only works for small files (< 1mb). For larger files you get an error: `{"statusCode":413,"error":"Payload Too Large","message":"request entity too large"}`.
8
9A workaround is to upload to another service client-side, send the URL from that service to your Val Town server, and then fetch the file server-side (helper: @stevekrouse/uploadTo0x0).
10
11Migrated from folder: Archive/fileInputUploadExample
1Migrated from folder: Archive/auth/signedFetch
83});
84
85export default app.fetch;
5
6const app = new Hono();
7export default app.fetch;
8app.get("/", async (c) => {
9 const description = c.req.query("description") || "On weekdays at noon";
59});
60
61export default app.fetch;
60});
61
62export default app.fetch