25
26 try {
27 const response = await fetch('/realtime-generate-image', {
28 method: 'POST',
29 headers: {
1import { API_URL } from "https://esm.town/v/std/API_URL";
2
3export async function fetchAPI(
4 path: string,
5 options?: RequestInit & {
15
16 while (true) {
17 const resp = await fetch(url, {
18 headers: {
19 ...options?.headers,
42 }
43
44 return fetch(`${API_URL}${path}`, {
45 ...options,
46 headers: {
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3const plugins = await fetchJSON(
4 "https://raw.githubusercontent.com/obsidianmd/obsidian-releases/HEAD/community-plugins.json",
5);
6
7const stats = await fetchJSON(
8 "https://raw.githubusercontent.com/obsidianmd/obsidian-releases/HEAD/community-plugin-stats.json",
9);
6
7function esmTown(url) {
8 return fetch(url, {
9 headers: {
10 "User-Agent":
15
16const app = new Hono();
17export default app.fetch;
18
19app.get("/", async (c) =>
10 image,
11 );
12 const data = await (await fetch(await getUploadURL(), {
13 "body": fd,
14 "method": "POST",
24}
25async function getUploadURL(): Promise<string> {
26 const data = await (await fetch("https://www.val.town/api/trpc/generateImageUploadUrl", {
27 "headers": {
28 "content-type": "application/json",
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));
9 let reason: string;
10 try {
11 const res = await fetch(URL, { redirect: "follow" });
12 if (res.status !== 200) {
13 reason = `(status code: ${res.status})`;
15 }
16 } catch (e) {
17 reason = `couldn't fetch: ${e}`;
18 ok = false;
19 }
1import { fetch as fetch_ } from "https://esm.town/v/std/fetch?v=4";
2import { fetch } from "https://esm.town/v/vladimyr/fetch";
3import { createFetch } from "npm:ofetch";
4
5const ofetch = createFetch({ fetch });
6const ip = await ofetch("https://httpbun.com/ip.json");
7console.log(ip);
8
9{
10 console.log();
11 const ofetch = createFetch({ fetch: fetch_ });
12 const ip = await ofetch("https://httpbun.com/ip.json");
13 console.log(ip);
14 const wip = await ofetch("https://httpbun.com/ip.json");
15 console.log(wip);
16}
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/iamseeley/resetStyle";
15import { passwordAuth } from "https://esm.town/v/pomdtr/password_auth?v=70";
16import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
17import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
18import { Hono } from "npm:hono";
19import type { FC } from "npm:hono/jsx";
174});
175
176export const handler = app.fetch;
177export default iframeHandler(modifyFetchHandler(passwordAuth(handler)));
9
10export async function emojiData(): Promise<Emoji[]> {
11 const res = await fetch("https://www.unicode.org/Public/draft/emoji/emoji-test.txt");
12 const text = await res.text();
13 const lines = text.split("\n");