cerebras_codermain.tsx1 match
182183try {
184const response = await fetch("/", {
185method: "POST",
186body: JSON.stringify({
photoEditingAIAppmain.tsx2 matches
23const formData = new FormData();
24formData.append('image', file);
25const response = await fetch('/upload', {
26method: 'POST',
27body: formData
3233const generateAIImage = async (prompt) => {
34const response = await fetch('/generate', {
35method: 'POST',
36headers: { 'Content-Type': 'application/json' },
originalTomatoLynxmain.tsx1 match
182183try {
184const response = await fetch("/", {
185method: "POST",
186body: JSON.stringify({
cerebras_codermain.tsx1 match
182183try {
184const response = await fetch("/", {
185method: "POST",
186body: JSON.stringify({
reactPinterestClonemain.tsx9 matches
116117useEffect(() => {
118async function fetchPosts() {
119try {
120const response = await fetch('/get-posts');
121if (!response.ok) {
122throw new Error('Failed to fetch posts');
123}
124const fetchedPosts = await response.json();
125setPosts(fetchedPosts);
126} catch (error) {
127setError(error.message);
128console.error('Failed to fetch posts', error);
129}
130}
131fetchPosts();
132}, []);
133134const handlePostSubmit = async (newPost) => {
135try {
136const response = await fetch('/create-post', {
137method: 'POST',
138headers: { 'Content-Type': 'application/json' },
154const handleDeletePost = async (postId) => {
155try {
156const response = await fetch(`/delete-post/${postId}`, { method: 'DELETE' });
157
158if (!response.ok) {
audioManagermain.tsx3 matches
12import { OpenAI } from "https://esm.town/v/yawnxyz/OpenAI";
3import { fetch } from "https://esm.town/v/std/fetch";
45import { getUrl } from "https://esm.town/v/yawnxyz/download";
180181182// Function to fetch audio data and return as ArrayBuffer
183async getAudioBuffer(url) {
184const response = await fetch(url);
185return await response.arrayBuffer();
186}
149150const generateQRCode = async (id: string) => {
151const qrcode = await (await fetch(`https://loading-generateqr.web.val.run/?peer=${id}`)).json();
152setQrcode(qrcode.base64Image);
153};
406});
407408// self.addEventListener('fetch', (event) => {
409// event.respondWith(
410// caches.match(event.request).then((response) => {
411// return response || fetch(event.request);
412// })
413// );
bombCycloneOutageTrackermain.tsx3 matches
2526useEffect(() => {
27async function fetchData() {
28const response = await fetch("/outages");
29const json = await response.json();
30let firstEntry: { i: number; time: number; date: Date } = { i: -1, time: Date.now(), date: new Date() };
92setOutageData(data);
93}
94fetchData();
95}, []);
96
website_Summarizermain.tsx16 matches
52}, []);
5354const fetchAndSummarize = async () => {
55if (!siteUrl) {
56setError("Please enter a valid site URL");
63setSiteInfo(null);
64setProgress(10);
65console.log("Starting fetchAndSummarize");
6667try {
68// 1) Fetch site data
69setProgress(30);
70console.log("Fetching site details");
71const siteResponse = await fetch(`/site-data?url=${encodeURIComponent(siteUrl)}`);
72if (!siteResponse.ok) {
73throw new Error(`Failed to fetch site details: ${siteResponse.statusText}`);
74}
75const siteData = await siteResponse.json();
76setSiteInfo(siteData);
77console.log("Site details fetched", siteData);
7879// 2) Summarize site content
80setProgress(60);
81console.log("Sending summary request");
82const summaryResponse = await fetch("/summarize", {
83method: "POST",
84headers: {
102console.log("Summarization complete");
103} catch (err) {
104console.error("Fetch Error:", err);
105setError(`Error: ${err.message}`);
106setLoading(false);
111const handleKeyDown = (event) => {
112if (event.key === "Enter" && !loading) {
113fetchAndSummarize();
114}
115};
138/>
139<button
140onClick={fetchAndSummarize}
141disabled={loading}
142className="bg-orange-500 text-white p-3 rounded-r-lg hover:bg-orange-600 disabled:opacity-50 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-orange-500"
271// Scrapes the HTML and returns minimal metadata
272if (request.method === "GET" && pathname === "/site-data") {
273console.log("Fetching site data");
274const siteUrl = searchParams.get("url");
275if (!siteUrl) {
281282try {
283// Fetch the HTML from the site
284const siteResponse = await fetch(siteUrl);
285if (!siteResponse.ok) {
286throw new Error(`Failed to fetch site: ${siteResponse.statusText}`);
287}
288const siteHtml = await siteResponse.text();
310});
311} catch (error) {
312console.error("Error fetching site data:", error);
313return new Response(JSON.stringify({ error: error.message }), {
314status: 500,
1const Config = {
2repository: 'e.erw.cc',
3FETCH_TIMEOUT: 3000, // 3 seconds timeout
4CACHE_DURATION: 1000 * 60 * 60 // 1 hour cache
5};
8const EPG_CACHE = new Map();
910async function timeoutFetch(request, timeout = Config.FETCH_TIMEOUT) {
11const controller = new AbortController();
12const timeoutId = setTimeout(() => controller.abort(), timeout);
1314try {
15const response = await fetch(request, {
16signal: controller.signal,
17headers: {
18'User-Agent': 'ValTown EPG Fetcher',
19'Accept': 'application/json'
20}
66
67try {
68const res = await timeoutFetch(new Request(`https://github.com/celetor/epg/releases/download/${tag}/112114.json`, request));
69const data = await res.json();
7096return makeRes(JSON.stringify(program_info), 200, { 'content-type': 'application/json' });
97} catch (error) {
98console.error('EPG Fetch Error:', error);
99return makeRes(JSON.stringify({
100date,