Windsurfprojectcontext8 matches
5152useEffect(() => {
53fetchState();
54}, []);
5556/**
57* Fetches the current state from the server
58*/
59const fetchState = async () => {
60setIsLoading(true);
61setError(null);
62try {
63const response = await fetch("/api/state");
64if (!response.ok) throw new Error("Failed to fetch state");
65const data = await response.json();
66setState(data);
80setError(null);
81try {
82const response = await fetch("/api/state", {
83method: "POST",
84headers: { "Content-Type": "application/json" },
86});
87if (!response.ok) throw new Error("Failed to update state");
88await fetchState();
89} catch (err) {
90setError(err.message);
565if (webhookUrl) {
566try {
567await fetch(webhookUrl, {
568method: "POST",
569headers: { "Content-Type": "application/json" },
prolificPinkGullmain.ts1 match
7countPath(app);
89export default app.fetch;
trackESMContentmain.tsx3 matches
10const TABLE_NAME = `${KEY}_versions_v1`;
1112async function fetchContent(url: string) {
13const response = await fetch(url);
14return await response.text();
15}
3031for (const url of URLS) {
32const content = await fetchContent(url);
33const latestVersion = await sqlite.execute(
34`SELECT blob_key FROM ${TABLE_NAME} WHERE url = ? ORDER BY timestamp DESC LIMIT 1`,
prolificPinkGulltest.ts1 match
11const supabase = createClient(supabaseUrl, supabaseKey)
1213// Disable prefetch as it is not supported for "Transaction" pool mode
14export const client = postgres(connectionString, { prepare: false })
blob_admin_migratedmain.tsx23 matches
234const [isDragging, setIsDragging] = useState(false);
235236const fetchBlobs = useCallback(async () => {
237setLoading(true);
238try {
239const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
240const data = await response.json();
241setBlobs(data);
242} catch (error) {
243console.error("Error fetching blobs:", error);
244} finally {
245setLoading(false);
248249useEffect(() => {
250fetchBlobs();
251}, [fetchBlobs]);
252253const handleSearch = (e) => {
264setBlobContentLoading(true);
265try {
266const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
267const content = await response.text();
268setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
269setEditContent(content);
270} catch (error) {
271console.error("Error fetching blob content:", error);
272} finally {
273setBlobContentLoading(false);
278const handleSave = async () => {
279try {
280await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
281method: "PUT",
282body: editContent,
290const handleDelete = async (key) => {
291try {
292await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
293setBlobs(blobs.filter(b => b.key !== key));
294if (selectedBlob && selectedBlob.key === key) {
307const key = `${searchPrefix}${file.name}`;
308formData.append("key", encodeKey(key));
309await fetch("/api/blob", { method: "POST", body: formData });
310const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
311setBlobs([newBlob, ...blobs]);
315}
316}
317fetchBlobs();
318};
319329try {
330const fullKey = `${searchPrefix}${key}`;
331await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
332method: "PUT",
333body: "",
344const handleDownload = async (key) => {
345try {
346const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
347const blob = await response.blob();
348const url = window.URL.createObjectURL(blob);
363if (newKey && newKey !== oldKey) {
364try {
365const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
366const content = await response.blob();
367await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
368method: "PUT",
369body: content,
370});
371await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
372setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
373if (selectedBlob && selectedBlob.key === oldKey) {
383const newKey = `__public/${key}`;
384try {
385const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
386const content = await response.blob();
387await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
388method: "PUT",
389body: content,
390});
391await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
392setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
393if (selectedBlob && selectedBlob.key === key) {
402const newKey = key.slice(9); // Remove "__public/" prefix
403try {
404const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
405const content = await response.blob();
406await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
407method: "PUT",
408body: content,
409});
410await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
411setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
412if (selectedBlob && selectedBlob.key === key) {
826});
827828export default lastlogin((request: Request) => app.fetch(request));
sqliteExplorerAppmain.tsx4 matches
1/** @jsxImportSource https://esm.sh/hono@latest/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 { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
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 })));
OpenTowniesystem_prompt.txt2 matches
155* The main App component is rendered on the client.
156* No server-side-specific code should be included in the App.
157* Use fetch to communicate with the backend server portion.
158*/
159function App() {
178* Server-only code
179* Any code that is meant to run on the server should be included in the server function.
180* This can include endpoints that the client side component can send fetch requests to.
181*/
182export default async function server(request: Request): Promise<Response> {
OpenTownieindex1 match
2627try {
28const response = await fetch("/", {
29method: "POST",
30headers: { "authorization": "Bearer " + bearerToken },
OpenTowniegenerateCode1 match
2627export async function generateCodeAnthropic(messages: Message[]): Promise<ValResponse | null> {
28const system = await (await fetch(`${import.meta.url.split("/").slice(0, -1).join("/")}/system_prompt.txt`)).text();
2930const openai = new OpenAI({
URLReceiverurlCrawlerComponent4 matches
75try {
76console.log(`Checking URL: ${url}`);
77const response = await fetch(url, {
78method: "GET",
79headers: {
137private async extractUrlsFromPage(url: string): Promise<string[]> {
138try {
139const response = await fetch(url);
140if (!response.ok) {
141console.log(`Failed to fetch ${url}: ${response.status} ${response.statusText}`);
142return [];
143}
193return uniqueUrls;
194} catch (error) {
195console.error(`Error fetching ${url}:`, error);
196return [];
197}