blob_adminmain.tsx6 matches
1516// Public route without authentication
17app.get("/api/public/:id", async (c) => {
18const key = `__public/${c.req.param("id")}`;
19const { blob } = await import("https://esm.town/v/std/blob");
133};
134135app.get("/api/blobs", checkAuth, async (c) => {
136const prefix = c.req.query("prefix") || "";
137const limit = parseInt(c.req.query("limit") || "20", 10);
142});
143144app.get("/api/blob", checkAuth, async (c) => {
145const key = c.req.query("key");
146if (!key) return c.text("Missing key parameter", 400);
150});
151152app.put("/api/blob", checkAuth, async (c) => {
153const key = c.req.query("key");
154if (!key) return c.text("Missing key parameter", 400);
159});
160161app.delete("/api/blob", checkAuth, async (c) => {
162const key = c.req.query("key");
163if (!key) return c.text("Missing key parameter", 400);
167});
168169app.post("/api/blob", checkAuth, async (c) => {
170const { file, key } = await c.req.parseBody();
171if (!file || !key) return c.text("Missing file or key", 400);
blob_adminapp.tsx19 matches
70const menuRef = useRef(null);
71const isPublic = blob.key.startsWith("__public/");
72const publicUrl = isPublic ? `${window.location.origin}/api/public/${encodeURIComponent(blob.key.slice(9))}` : null;
7374useEffect(() => {
234setLoading(true);
235try {
236const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
237const data = await response.json();
238setBlobs(data);
261setBlobContentLoading(true);
262try {
263const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
264const content = await response.text();
265setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
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]);
326try {
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) {
554onClick={() =>
555copyToClipboard(
556`${window.location.origin}/api/public/${encodeURIComponent(selectedBlob.key.slice(9))}`,
557)}
558className="text-blue-400 hover:text-blue-300 text-sm"
577>
578<img
579src={`/api/blob?key=${encodeKey(selectedBlob.key)}`}
580alt="Blob content"
581className="max-w-full h-auto"
MiniAppStarterneynar.ts2 matches
1const baseUrl = "https://api.neynar.com/v2/farcaster/";
23export async function fetchNeynarGet(path: string) {
7"Content-Type": "application/json",
8"x-neynar-experimental": "true",
9"x-api-key": "NEYNAR_API_DOCS",
10},
11});
MiniAppStarterindex.tsx2 matches
19}));
2021app.get("/api/counter/get", async c => c.json(await db.get("counter")));
22app.get("/api/counter/increment", async c => c.json(await db.set("counter", (await db.get("counter") || 0) + 1)));
2324app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
MiniAppStarterimage.tsx3 matches
8485const loadEmoji = (code) => {
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
MiniAppStarterApp.tsx3 matches
53<div className="">✷ Farcaster mini app manifest + webhook + embed metadata</div>
54<div className="">✷ Farcaster notifications (storing tokens, sending recurring notifications, ...)</div>
55<div className="">✷ Neynar API integration for Farcaster data</div>
56<div className="">✷ Hosted on Val Town (instant deployments on save)</div>
57<div className="">
6768function Database() {
69const queryFn = () => fetch("/api/counter/get").then((r) => r.json());
70const { data, refetch } = useQuery({ queryKey: ["counter"], queryFn });
71return (
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>
65<p>Votre offre : ${getLastEvtResponse.data.offre}</p>
66<p>
67<a href="mailto:serviceclient@labellenergie.fr?subject=${numClient}%20-%20Demande%20d'application%20des%20nouvelles%20conditions%20tarifaires&body=Bonjour%2C%0A%0APuis-je%20b%C3%A9n%C3%A9ficier%20des%20nouvelles%20conditions%20tarifaires%20${date}pour%20${wordingContrat}%2C%20svp%20%3F%0A%0AMon%20n%C2%B0%20de%20client%20est%20le%20${numClient}.%0A%0ABien%20cordialement%2C%0APierre-Olivier%20Mauguet">
68Envoyer la demande à La Belle Énergie
69</a>
Bates_bottesttelegram2 matches
78const message = "Hello from Bates_bot! This is a test message.";
9const url = `https://api.telegram.org/bot${token}/sendMessage`;
1011try {
2223const data = await response.json();
24console.log("Telegram API response:", data);
25return data;
26} catch (error) {
sqliteExplorerAppREADME.md1 match
13## Authentication
1415Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
1617## Todos / Plans
sqliteExplorerAppmain.tsx2 matches
27<head>
28<title>SQLite Explorer</title>
29<link rel="preconnect" href="https://fonts.googleapis.com" />
3031<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32<link
33href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34rel="stylesheet"
35/>