MiniAppStarterimage.tsx2 matches
75const fontPromises = fontsConfig.map(async (font) => {
76const fontUrl = "https://cdn.jsdelivr.net/npm/@tamagui/font-inter@1.108.3/otf/" + font.fontFile;
77const fontArrayBuf = await fetch(fontUrl).then((res) => res.arrayBuffer());
78return { name: font.name, data: fontArrayBuf, weight: font.weight };
79});
86// const api = `https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${code.toLowerCase()}.svg`
87const api = `https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${code.toLowerCase()}_color.svg`;
88return fetch(api).then((r) => r.text());
89};
90
MiniAppStarterHome.tsx1 match
78import { Button, Input, Section } from "../components/ui.tsx";
9import { fetchUsersById } from "../util/neynar.ts";
1011export function Home() {
4142async function sendNotification(notificationDetails: any, payload: any) {
43return await fetch(notificationDetails.url, {
44method: "POST",
45headers: { "Content-Type": "application/json" },
MiniAppStarterApp.tsx5 matches
8import { FarcasterMiniApp } from "./components/FarcasterMiniApp.tsx";
9import { Button, Section } from "./components/ui.tsx";
10import { fetchNeynarGet } from "./util/neynar.ts";
1112export function App() {
6768function Database() {
69const queryFn = () => fetch("/api/counter/get").then((r) => r.json());
70const { data, refetch } = useQuery({ queryKey: ["counter"], queryFn });
71return (
72<Section className="flex flex-col items-start gap-3 m-5">
73{/* <h2 className="font-semibold">Database Example</h2> */}
74<div className="">Counter value: {data}</div>
75<Button variant="outline" onClick={() => fetch("/api/counter/increment").then(refetch)}>
76Increment
77</Button>
82function Neynar() {
83useEffect(() => {
84fetchNeynarGet("user/by_username?username=moe").then(console.log).catch(console.error);
85}, []);
86
67import { OpenAI } from "https://esm.town/v/std/openai";
8// import { Request, Response } from "https://esm.town/v/std/fetch"; // Usually global
910interface RaceInfo {
66}));
67} catch (error) {
68console.error("Error fetching/processing from OpenAI:", error);
69return fallbackRaceData;
70}
telegramSetWebhookmain.tsx1 match
5drop_pending_updates?: boolean;
6}) {
7const res = await fetch(`https://api.telegram.org/bot${token}/setWebhook`, {
8method: "POST",
9headers: { "Content-Type": "application/json" },
3import { serveStatic } from "npm:hono/middleware";
4import { parseProject } from "https://esm.town/v/std/utils@85-main/index.ts";
5import { fetchPlayerData } from "./services/manifold-api.ts";
6import { styleSheet } from "./ui/styles.ts";
7import { generateHtml } from "./ui/template.ts";
19app.get("/", async (c) => {
20try {
21// Fetch player data from Manifold
22const playerData = await fetchPlayerData();
23
24if (!playerData) {
25return c.text("Unable to fetch player data", 500);
26}
27
42});
4344// Export the fetch handler
45export default app.fetch;
46
artisticSapphireCoyotemain.tsx4 matches
1/** @jsxImportSource npm:hono/jsx **/
23import { 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/nbbaier/resetStyle";
16import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
17import { passwordAuth } from "https://esm.town/v/stevekrouse/amusingTealKangaroo";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));
blob_adminapp.tsx22 matches
231const [isDragging, setIsDragging] = useState(false);
232233const fetchBlobs = useCallback(async () => {
234setLoading(true);
235try {
236const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
237const data = await response.json();
238setBlobs(data);
239} catch (error) {
240console.error("Error fetching blobs:", error);
241} finally {
242setLoading(false);
245246useEffect(() => {
247fetchBlobs();
248}, [fetchBlobs]);
249250const handleSearch = (e) => {
261setBlobContentLoading(true);
262try {
263const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
264const content = await response.text();
265setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
266setEditContent(content);
267} catch (error) {
268console.error("Error fetching blob content:", error);
269} finally {
270setBlobContentLoading(false);
275const handleSave = async () => {
276try {
277await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
278method: "PUT",
279body: editContent,
287const handleDelete = async (key) => {
288try {
289await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
290setBlobs(blobs.filter(b => b.key !== key));
291if (selectedBlob && selectedBlob.key === key) {
304const key = `${searchPrefix}${file.name}`;
305formData.append("key", encodeKey(key));
306await fetch("/api/blob", { method: "POST", body: formData });
307const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
308setBlobs([newBlob, ...blobs]);
312}
313}
314fetchBlobs();
315};
316326try {
327const fullKey = `${searchPrefix}${key}`;
328await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
329method: "PUT",
330body: "",
341const handleDownload = async (key) => {
342try {
343const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
344const blob = await response.blob();
345const url = window.URL.createObjectURL(blob);
360if (newKey && newKey !== oldKey) {
361try {
362const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
363const content = await response.blob();
364await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
365method: "PUT",
366body: content,
367});
368await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
369setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
370if (selectedBlob && selectedBlob.key === oldKey) {
380const newKey = `__public/${key}`;
381try {
382const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
383const content = await response.blob();
384await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
385method: "PUT",
386body: content,
387});
388await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
389setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
390if (selectedBlob && selectedBlob.key === key) {
399const newKey = key.slice(9); // Remove "__public/" prefix
400try {
401const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
402const content = await response.blob();
403await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
404method: "PUT",
405body: content,
406});
407await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
408setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
409if (selectedBlob && selectedBlob.key === key) {
blob_adminmain.tsx1 match
199});
200201export default lastlogin((request: Request) => app.fetch(request));