petunia_chatmain.tsx6 matches
137138try {
139const response = await fetch('/chat', {
140method: 'POST',
141headers: {
260}
261262async function fetchMarketInsights() {
263try {
264const response = await fetch('/market-data', {
265method: 'GET',
266headers: { 'Accept': 'application/json' }
268269if (!response.ok) {
270throw new Error('Failed to fetch market data');
271}
272298}
299300refreshButton.addEventListener('click', fetchMarketInsights);
301</script>
302<footer>
368});
369370export default app.fetch;
forEmulated1main.tsx1 match
46setIsRefining(isInitial ? false : true);
47try {
48const response = await fetch('/generate-landing-page', {
49method: 'POST',
50headers: {
md_links_resolvermain.tsx7 matches
19try {
20isAutoProcessing.value = true;
21const response = await fetch("/resolve-links", {
22method: "POST",
23headers: { "Content-Type": "application/json" },
350351async function resolveRedirect(url: string): Promise<string> {
352const fetchOptions = {
353headers: {
354"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
357358try {
359// Method 1: Fetch with manual redirect handling
360try {
361const response = await fetch(url, {
362...fetchOptions,
363method: "HEAD",
364redirect: "manual"
373// Method 2: Full GET request for stubborn redirects
374try {
375const fullResponse = await fetch(url, {
376...fetchOptions,
377method: "GET",
378redirect: "follow"
versatileBlackKitemain.tsx3 matches
25const proxyImage = async (imageUrl: string, index: number) => {
26try {
27const response = await fetch(`/proxy-image?url=${encodeURIComponent(imageUrl)}`);
28if (response.ok) {
29const proxyUrl = await response.text();
222223try {
224const imageResponse = await fetch(imageUrl, {
225headers: {
226'User-Agent': 'Mozilla/5.0',
230231if (!imageResponse.ok) {
232return new Response('Image fetch failed', { status: imageResponse.status });
233}
234
embedVideoWebPagemain.tsx4 matches
26const proxyImage = async (imageUrl: string, index: number) => {
27try {
28const response = await fetch(`/proxy-image?url=${encodeURIComponent(imageUrl)}`, {
29headers: {
30'Cache-Control': 'no-cache' // Ensure fresh fetch
31}
32});
233234try {
235const imageResponse = await fetch(imageUrl, {
236headers: {
237'User-Agent': 'Mozilla/5.0',
242243if (!imageResponse.ok) {
244return new Response('Image fetch failed', { status: imageResponse.status });
245}
246
p5_latest_starterkitmain.tsx4 matches
5const getNpmTarball = async (scope, packageName, version = "latest") => {
6const fullPackageName = scope ? `@${scope}/${packageName}` : packageName;
7const response = await fetch(`https://registry.npmjs.org/${fullPackageName}/${version}`);
89if (!response.ok) {
10throw new Error(`Failed to fetch metadata for ${fullPackageName}`);
11}
1230const zip = new JSZip();
3132// Fetch latest versions of modules from npm registry
33const moduleContents = await Promise.all(
34modules.map(async (moduleName) => {
42const tarballUrl = await getNpmTarball(scope, packageName);
4344const tarballResponse = await fetch(tarballUrl);
4546if (!tarballResponse.ok) {
blob_adminmain.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) {
825});
826827export default lastlogin((request: Request) => app.fetch(request));
superbAzureSharkmain.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) {
825});
826827export default lastlogin((request: Request) => app.fetch(request));
cerebras_codermain.tsx7 matches
3637useEffect(() => {
38async function fetchStats() {
39const response = await fetch("/dashboard-stats");
40const data = await response.json();
41setStats(data);
42}
43fetchStats();
44}, []);
45128129useEffect(() => {
130async function fetchUsageStats() {
131const response = await fetch("/usage-stats");
132const data = await response.json();
133setUsageStats(data);
134}
135fetchUsageStats();
136}, []);
137141142try {
143const response = await fetch("/", {
144method: "POST",
145body: JSON.stringify({