effortlessAquamarineHookwormmain.tsx14 matches
110}
111112function Dashboard({ postCount, totalViews, posts, fetchDashboardStats }) {
113const [title, setTitle] = useState("");
114const [content, setContent] = useState("");
119120const handleApiKeySave = async () => {
121const response = await fetch('/save-api-key', {
122method: 'POST',
123headers: { 'Content-Type': 'application/json' },
133setIsGenerating(true);
134try {
135const response = await fetch('/generate-post', {
136method: 'POST',
137headers: { 'Content-Type': 'application/json' },
151const handleSubmit = async (e) => {
152e.preventDefault();
153const response = await fetch('/create-post', {
154method: 'POST',
155headers: { 'Content-Type': 'application/json' },
157});
158const newPost = await response.json();
159fetchDashboardStats();
160setTitle("");
161setContent("");
275276useEffect(() => {
277fetchPosts(pageNumber);
278fetchDashboardStats();
279}, [pageNumber]);
280290};
291292const fetchPosts = async (page) => {
293const response = await fetch(`/posts?page=${page}`);
294const data = await response.json();
295setPosts(data.posts);
297};
298299const fetchDashboardStats = async () => {
300const response = await fetch('/dashboard');
301const stats = await response.json();
302setDashboard(stats);
326totalViews={dashboard.totalViews}
327posts={posts}
328fetchDashboardStats={fetchDashboardStats}
329/>
330)}
401const { topic } = await request.json();
402
403// Fetch stored API key
404const apiKeyResult = await sqlite.execute(
405`SELECT api_key FROM ${KEY}_api_keys_${SCHEMA_VERSION} WHERE service = ?`,
414415try {
416const response = await fetch('https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent', {
417method: 'POST',
418headers: {
multilingualchatroommain.tsx21 matches
195useEffect(() => {
196if (roomId) {
197const fetchDefaultUsername = async () => {
198try {
199// First, check if there's a username in localStorage
202setUsername(storedUsername);
203} else {
204// If not, fetch a default username from the server
205const response = await fetch(`/default-username?room=${roomId}`);
206if (response.ok) {
207const defaultUsername = await response.text();
218}
219} catch (error) {
220console.error("Error fetching default username:", error);
221}
222};
223224fetchDefaultUsername();
225}
226}, [roomId]);
230const pollMessages = async () => {
231try {
232const response = await fetch(`/messages?room=${roomId}&language=${language}`);
233if (response.ok) {
234const newMessages = await response.json();
242}
243} catch (error) {
244console.error("Error fetching messages:", error);
245}
246};
247248const fetchUsers = async () => {
249try {
250const response = await fetch(`/users?room=${roomId}`);
251if (response.ok) {
252const userList = await response.json();
254}
255} catch (error) {
256console.error("Error fetching users:", error);
257}
258};
259260const fetchTypingUsers = async () => {
261try {
262const response = await fetch(`/typing-users?room=${roomId}`);
263if (response.ok) {
264const typingUsersList = await response.json();
266}
267} catch (error) {
268console.error("Error fetching typing users:", error);
269}
270};
271272pollMessages();
273fetchUsers();
274fetchTypingUsers();
275const messageIntervalId = setInterval(pollMessages, 2000);
276const userIntervalId = setInterval(fetchUsers, 5000);
277const typingIntervalId = setInterval(fetchTypingUsers, 1000);
278279return () => {
289if (language !== "en") {
290try {
291const translatedMessage = await fetch("/translate-text", {
292method: "POST",
293headers: { "Content-Type": "application/json" },
315if (inputMessage && roomId && username) {
316try {
317const response = await fetch("/send-message", {
318method: "POST",
319headers: { "Content-Type": "application/json" },
346} else {
347try {
348const response = await fetch("/update-user", {
349method: "POST",
350headers: { "Content-Type": "application/json" },
403if (roomId && username) {
404try {
405await fetch("/update-typing", {
406method: "POST",
407headers: { "Content-Type": "application/json" },
scraper_templatemain.tsx1 match
9const variable: string = await blob.getJSON(blobKey) ?? "";
1011const response = await fetch(scrapeURL);
12const body = await response.text();
13const $ = cheerio.load(body);
blob_adminmain.tsx2 matches
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
23import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138139export default modifyFetchHandler(passwordAuth(app.fetch));
pjsSearchUImain.tsx1 match
202app.get('/favicon.svg', serve(favicon, 'image/svg+xml'));
203204export default app.fetch;
HermesTresmegistusmain.tsx2 matches
248249try {
250const response = await fetch('/chat', {
251method: 'POST',
252headers: {
312});
313314export default app.fetch;
cerebras_codermain.tsx1 match
2324try {
25const response = await fetch("/", {
26method: "POST",
27body: JSON.stringify({ prompt, currentCode: code }),
webpage_summarizermain.tsx3 matches
1415try {
16const response = await fetch("/summarize", {
17method: "POST",
18body: JSON.stringify({ url }),
100const { url } = await request.json();
101102// Fetch webpage content
103const webpageResponse = await fetch(url);
104const webpageText = await webpageResponse.text();
105
mightyAmberAlbatrossmain.tsx4 matches
1import { email } from "https://esm.town/v/std/email?v=9";
23// Fetches a random joke.
4async function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",
7);
9}
1011const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;
dailyDadJokemain.tsx2 matches
1import { email } from "https://esm.town/v/std/email";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
34export async function dailyDadJoke() {
5let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6return email({
7text: punchline,