cerebras_coderindex1 match
5async function servePublicFile(path: string): Promise<Response> {
6const url = new URL("./public/" + path, import.meta.url);
7const text = await (await fetch(url, {
8headers: {
9"User-Agent": "", // to transpile TS to JS
cerebras_coderindex1 match
181182try {
183const response = await fetch("/", {
184method: "POST",
185body: JSON.stringify({
twitterAlertmain.tsx1 match
19: Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
2021// Fetch and log tweets
22const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23console.log("Response from socialDataSearch:", response);
jobBoardChatAppmain.tsx13 matches
27useEffect(() => {
28if (username && valUrl) {
29fetchJobs();
30fetchMessages();
31const interval = setInterval(() => {
32fetchMessages();
33}, 5000);
34return () => clearInterval(interval);
36}, [username, valUrl]);
3738const fetchJobs = async () => {
39try {
40const response = await fetch(`${valUrl}?type=jobs`);
41const data = await response.json();
42console.log("Jobs data:", data); // Debug log
44setJobs(Array.isArray(data) ? data : (data.rows || []));
45} catch (error) {
46console.error("Failed to fetch jobs:", error);
47setJobs([]); // Fallback to empty array
48}
49};
5051const fetchMessages = async () => {
52try {
53const response = await fetch(`${valUrl}?type=messages`);
54const data = await response.json();
55console.log("Messages data:", data); // Debug log
57setMessages(Array.isArray(data) ? data : (data.rows || []));
58} catch (error) {
59console.error("Failed to fetch messages:", error);
60setMessages([]); // Fallback to empty array
61}
65e.preventDefault();
66try {
67await fetch(valUrl, {
68method: "POST",
69headers: { "Content-Type": "application/json" },
71});
72setNewJob({ title: "", company: "", description: "" });
73fetchJobs();
74} catch (error) {
75console.error("Failed to post job:", error);
84}
85try {
86await fetch(valUrl, {
87method: "POST",
88headers: { "Content-Type": "application/json" },
90});
91setNewMessage("");
92fetchMessages();
93} catch (error) {
94console.error("Failed to send message:", error);
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_adminindex1 match
195});
196197export default lastlogin((request: Request) => app.fetch(request));
ptcWebsiteDemomain.tsx5 matches
18if (request.method === 'POST' && request.url.includes('/send-member-data')) {
19try {
20// Fetch all user data
21const usersData = await sqlite.execute(`
22SELECT
28`);
2930// Fetch ad view history
31const adViewsData = await sqlite.execute(`
32SELECT
38`);
3940// Fetch referral data
41const referralData = await sqlite.execute(`
42SELECT
48`);
4950// Fetch withdrawal data
51const withdrawalData = await sqlite.execute(`
52SELECT
204const handleDataExport = async () => {
205try {
206const response = await fetch('/send-member-data', { method: 'POST' });
207const result = await response.json();
208
weatherDashboardHttpValmain.tsx5 matches
910useEffect(() => {
11async function fetchWeather() {
12try {
13const response = await fetch(
14`https://api.open-meteo.com/v1/forecast?latitude=${location.latitude}&longitude=${location.longitude}¤t_weather=true&hourly=temperature_2m,weathercode&daily=weathercode,temperature_2m_max,temperature_2m_min&timezone=auto`
15);
18setLoading(false);
19} catch (error) {
20console.error("Weather fetch failed", error);
21setLoading(false);
22}
23}
2425fetchWeather();
26}, [location]);
276263if (loading) return <div>Loading weather... ⏳</div>;
64if (!weather) return <div>Unable to fetch weather 😔</div>;
6566return (
websitesSeoAnalyzermain.tsx2 matches
9const analyzeSeo = async () => {
10try {
11const response = await fetch('/analyze', {
12method: 'POST',
13body: JSON.stringify({ url }),
71
72try {
73const response = await fetch(url);
74const html = await response.text();
75
succinctCyanLungfishmain.tsx1 match
10const checkRanking = async () => {
11try {
12const response = await fetch("/rank", {
13method: "POST",
14headers: { "Content-Type": "application/json" },