Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/?q=fetch&page=56&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 15666 results for "fetch"(3249ms)

ZenServertest-frontend-client.tsx25 matches

@ianmenethilUpdated 1 week ago
334 const [currentNonce, setCurrentNonce] = useState(null);
335 const [attemptCount, setAttemptCount] = useState(0);
336 const [prefetchedNonce, setPrefetchedNonce] = useState(null);
337 const [isPrefetching, setIsPrefetching] = useState(false);
338 const [step, setStep] = useState(0);
339 const [selectedTour, setSelectedTour] = useState(null);
436
437 let nonce = '';
438 if (prefetchedNonce) {
439 console.log('♻️ Using prefetched nonce:', prefetchedNonce);
440 nonce = prefetchedNonce;
441 setPrefetchedNonce(null);
442 setAttemptCount(prev => prev + 1);
443 } else {
450 };
451
452 const nonceResponse = await fetch(NONCE_ENDPOINT, {
453 method: 'POST',
454 headers: {
494 console.log('🔍 Fingerprint payload for hash:', fingerprintPayload);
495
496 const apiResponse = await fetch(HASH_ENDPOINT, {
497 method: 'POST',
498 headers: {
529 console.error('❌ Hash API failed:', msg);
530 setIsProcessing(false);
531 prefetchNewNonce();
532 return;
533 }
572 console.error('❌ ZenPay payment failed:', msg);
573 setIsProcessing(false);
574 prefetchNewNonce();
575 }
576 }, [formData, bookingId, prefetchedNonce, fingerprintPayload]);
577
578 const prefetchNewNonce = useCallback(async () => {
579 if (isPrefetching || attemptCount >= 5) return;
580
581 setIsPrefetching(true);
582 console.log('🔄 Pre-fetching new nonce for retry...');
583
584 try {
589 };
590
591 const nonceResponse = await fetch(NONCE_ENDPOINT, {
592 method: 'POST',
593 headers: {
602 if (nonceResponse.ok) {
603 const nonceData = await nonceResponse.json();
604 setPrefetchedNonce(nonceData.nonce);
605 console.log('✅ Pre-fetched nonce ready:', nonceData.nonce);
606 }
607 } catch (e) {
608 console.error('⚠️ Failed to pre-fetch nonce:', e);
609 } finally {
610 setIsPrefetching(false);
611 }
612 }, [bookingId, formData.email_verify, attemptCount, isPrefetching]);
613
614 if (step === 0) {
1013 ]),
1014
1015 isPrefetching && React.createElement('div', {
1016 key: 'prefetch-status',
1017 className: "mt-4"
1018 }, React.createElement(Alert, {
1081 },
1082 className: "w-full",
1083 disabled: isPrefetching
1084 }, isPrefetching ? 'Preparing retry...' : (prefetchedNonce ? 'Try Again (Ready)' : 'Try Again')),
1085 React.createElement(Button, {
1086 key: 'refresh',

ZenServerDOCUMENTATION.md9 matches

@ianmenethilUpdated 1 week ago
178 S->>DB: Validate Token (exists, not expired)
179 S->>DB: Get Booking ID from Token
180 S->>DB: Fetch Booking Details
181 S-->>U: Return Booking Information
182```
254```javascript
255// Frontend Usage
256const response = await fetch(`/booking/${token}`);
257const { booking } = await response.json();
258```
265```javascript
266// Admin Usage
267const response = await fetch('/api/generate-booking-token', {
268 method: 'POST',
269 headers: {
285```javascript
286// Frontend Usage
287const response = await fetch('/api/create-payment-nonce', {
288 method: 'POST',
289 headers: { 'Content-Type': 'application/json' },
300```javascript
301// Frontend Usage - CRITICAL SECURITY
302const response = await fetch('/api/create-payment-hash', {
303 method: 'POST',
304 headers: {
325```javascript
326// Frontend Usage - After Payment Failure
327const response = await fetch('/api/v1/payment/refresh', {
328 method: 'POST',
329 headers: { 'Content-Type': 'application/json' },
342```javascript
343// Frontend Usage
344const response = await fetch('/api/v1/turnstile/verify', {
345 method: 'POST',
346 headers: { 'Content-Type': 'application/json' },
388 try {
389 // Step 1: Generate nonce
390 const nonceResponse = await fetch('/api/create-payment-nonce', {
391 method: 'POST',
392 headers: { 'Content-Type': 'application/json' },
396
397 // Step 2: Create payment hash with dual authentication
398 const hashResponse = await fetch('/api/create-payment-hash', {
399 method: 'POST',
400 headers: {

ZenBackendturnstileHandler.ts1 match

@ianmenethilUpdated 1 week ago
42 }
43
44 const verificationResponse = await fetch('https://challenges.cloudflare.com/turnstile/v0/siteverify', {
45 method: 'POST',
46 headers: {

ZenBackendtest-frontend-client.tsx25 matches

@ianmenethilUpdated 1 week ago
334 const [currentNonce, setCurrentNonce] = useState(null);
335 const [attemptCount, setAttemptCount] = useState(0);
336 const [prefetchedNonce, setPrefetchedNonce] = useState(null);
337 const [isPrefetching, setIsPrefetching] = useState(false);
338 const [step, setStep] = useState(0);
339 const [selectedTour, setSelectedTour] = useState(null);
436
437 let nonce = '';
438 if (prefetchedNonce) {
439 console.log('♻️ Using prefetched nonce:', prefetchedNonce);
440 nonce = prefetchedNonce;
441 setPrefetchedNonce(null);
442 setAttemptCount(prev => prev + 1);
443 } else {
450 };
451
452 const nonceResponse = await fetch(NONCE_ENDPOINT, {
453 method: 'POST',
454 headers: {
494 console.log('🔍 Fingerprint payload for hash:', fingerprintPayload);
495
496 const apiResponse = await fetch(HASH_ENDPOINT, {
497 method: 'POST',
498 headers: {
529 console.error('❌ Hash API failed:', msg);
530 setIsProcessing(false);
531 prefetchNewNonce();
532 return;
533 }
572 console.error('❌ ZenPay payment failed:', msg);
573 setIsProcessing(false);
574 prefetchNewNonce();
575 }
576 }, [formData, bookingId, prefetchedNonce, fingerprintPayload]);
577
578 const prefetchNewNonce = useCallback(async () => {
579 if (isPrefetching || attemptCount >= 5) return;
580
581 setIsPrefetching(true);
582 console.log('🔄 Pre-fetching new nonce for retry...');
583
584 try {
589 };
590
591 const nonceResponse = await fetch(NONCE_ENDPOINT, {
592 method: 'POST',
593 headers: {
602 if (nonceResponse.ok) {
603 const nonceData = await nonceResponse.json();
604 setPrefetchedNonce(nonceData.nonce);
605 console.log('✅ Pre-fetched nonce ready:', nonceData.nonce);
606 }
607 } catch (e) {
608 console.error('⚠️ Failed to pre-fetch nonce:', e);
609 } finally {
610 setIsPrefetching(false);
611 }
612 }, [bookingId, formData.email_verify, attemptCount, isPrefetching]);
613
614 if (step === 0) {
1013 ]),
1014
1015 isPrefetching && React.createElement('div', {
1016 key: 'prefetch-status',
1017 className: "mt-4"
1018 }, React.createElement(Alert, {
1081 },
1082 className: "w-full",
1083 disabled: isPrefetching
1084 }, isPrefetching ? 'Preparing retry...' : (prefetchedNonce ? 'Try Again (Ready)' : 'Try Again')),
1085 React.createElement(Button, {
1086 key: 'refresh',

ZenBackendDOCUMENTATION.md9 matches

@ianmenethilUpdated 1 week ago
178 S->>DB: Validate Token (exists, not expired)
179 S->>DB: Get Booking ID from Token
180 S->>DB: Fetch Booking Details
181 S-->>U: Return Booking Information
182```
254```javascript
255// Frontend Usage
256const response = await fetch(`/booking/${token}`);
257const { booking } = await response.json();
258```
265```javascript
266// Admin Usage
267const response = await fetch('/api/generate-booking-token', {
268 method: 'POST',
269 headers: {
285```javascript
286// Frontend Usage
287const response = await fetch('/api/create-payment-nonce', {
288 method: 'POST',
289 headers: { 'Content-Type': 'application/json' },
300```javascript
301// Frontend Usage - CRITICAL SECURITY
302const response = await fetch('/api/create-payment-hash', {
303 method: 'POST',
304 headers: {
325```javascript
326// Frontend Usage - After Payment Failure
327const response = await fetch('/api/v1/payment/refresh', {
328 method: 'POST',
329 headers: { 'Content-Type': 'application/json' },
342```javascript
343// Frontend Usage
344const response = await fetch('/api/v1/turnstile/verify', {
345 method: 'POST',
346 headers: { 'Content-Type': 'application/json' },
388 try {
389 // Step 1: Generate nonce
390 const nonceResponse = await fetch('/api/create-payment-nonce', {
391 method: 'POST',
392 headers: { 'Content-Type': 'application/json' },
396
397 // Step 2: Create payment hash with dual authentication
398 const hashResponse = await fetch('/api/create-payment-hash', {
399 method: 'POST',
400 headers: {

ESP32-FirmwareFlasherapi.ts14 matches

@canstralianUpdated 1 week ago
13
14 /**
15 * Generic fetch wrapper with error handling
16 */
17 private async fetchWithErrorHandling<T>(
18 endpoint: string,
19 options: RequestInit = {}
20 ): Promise<{ success: boolean; data?: T; error?: string }> {
21 try {
22 const response = await fetch(`${this.baseUrl}${endpoint}`, {
23 ...options,
24 headers: {
51 */
52 async getFirmwareList(): Promise<{ success: boolean; data?: FirmwareInfo[]; error?: string }> {
53 return this.fetchWithErrorHandling<FirmwareInfo[]>('/api/firmware');
54 }
55
58 */
59 async getFirmwareByCategory(category: string): Promise<{ success: boolean; data?: FirmwareInfo[]; error?: string }> {
60 return this.fetchWithErrorHandling<FirmwareInfo[]>(`/api/firmware/category/${encodeURIComponent(category)}`);
61 }
62
65 */
66 async searchFirmware(query: string): Promise<{ success: boolean; data?: FirmwareInfo[]; error?: string }> {
67 return this.fetchWithErrorHandling<FirmwareInfo[]>(`/api/firmware/search?q=${encodeURIComponent(query)}`);
68 }
69
72 */
73 async getFirmwareInfo(name: string): Promise<{ success: boolean; data?: FirmwareInfo; error?: string }> {
74 return this.fetchWithErrorHandling<FirmwareInfo>(`/api/firmware/${encodeURIComponent(name)}/info`);
75 }
76
80 async downloadFirmware(name: string): Promise<{ success: boolean; data?: ArrayBuffer; error?: string }> {
81 try {
82 const response = await fetch(`${this.baseUrl}/api/firmware/${encodeURIComponent(name)}/download`);
83
84 if (!response.ok) {
113 formData.append('chipType', chipType);
114
115 const response = await fetch(`${this.baseUrl}/api/serial/convert`, {
116 method: 'POST',
117 body: formData,
145 formData.append('elf', elfFile);
146
147 const response = await fetch(`${this.baseUrl}/api/serial/validate`, {
148 method: 'POST',
149 body: formData,
173 */
174 async getChipTypes(): Promise<{ success: boolean; data?: string[]; error?: string }> {
175 return this.fetchWithErrorHandling<string[]>('/api/serial/chip-types');
176 }
177
180 */
181 async getDeviceConfig(chipType: string): Promise<{ success: boolean; data?: any; error?: string }> {
182 return this.fetchWithErrorHandling(`/api/serial/device-config/${encodeURIComponent(chipType)}`);
183 }
184
187 */
188 async getServiceStatus(): Promise<{ success: boolean; data?: any; error?: string }> {
189 return this.fetchWithErrorHandling('/api/serial/status');
190 }
191
194 */
195 async getFirmwareStats(): Promise<{ success: boolean; data?: any; error?: string }> {
196 return this.fetchWithErrorHandling('/api/firmware/stats');
197 }
198}

ESP32-FirmwareFlasherindex.ts2 matches

@canstralianUpdated 1 week ago
87
88 // For non-API routes, serve the main app (SPA routing)
89 return staticRoutes.fetch(new Request(c.req.url.replace(path, "/")));
90});
91
128
129// Export the app for Val Town
130export default app.fetch;

marqueemain.tsx3 matches

@joinUpdated 1 week ago
173
174 try {
175 const response = await fetch(API_ENDPOINT, {
176 method: 'POST',
177 headers: { 'Content-Type': 'application/json' },
183 applyUpdates(data);
184 } catch (error) {
185 console.error('Fetch error:', error);
186 reasoningEl.textContent = 'An error occurred. The artistic muse must be sleeping. Please try again.';
187 }
300});
301
302export default app.fetch;

Astra-Productionmain.ts2 matches

@LiemarUpdated 1 week ago
33
34 if (path === "/users" && method === "GET") {
35 const res = await fetch(`${ASTRA_URL}/api/rest/v2/namespaces/${KEYSPACE}/collections/${COLLECTION}`, {
36 method: "GET",
37 headers,
44 try {
45 const body = await req.json();
46 const res = await fetch(`${ASTRA_URL}/api/rest/v2/namespaces/${KEYSPACE}/collections/${COLLECTION}`, {
47 method: "POST",
48 headers,

wordstreammain.tsx1 match

@joinUpdated 1 week ago
199 try {
200 statusDisplay.textContent = 'Requesting next journey...';
201 const response = await fetch(\`\${API_URL}?action=getJourney&after_id=\${lastSeenJourneyId}\`, {
202 method: 'POST'
203 });

manual-fetcher

@mizUpdated 3 days ago

fake-https1 file match

@blazemcworldUpdated 1 week ago
simple proxy to fetch http urls using https