perseveringAmaranthChipmunkmain.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;
uploadImagemain.tsx2 matches
10image,
11);
12const data = await (await fetch(await getUploadURL(), {
13"body": fd,
14"method": "POST",
24}
25async function getUploadURL(): Promise<string> {
26const data = await (await fetch("https://www.val.town/api/trpc/generateImageUploadUrl", {
27"headers": {
28"content-type": "application/json",
sanguineAquaReptilemain.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));
affableMagentaPlanarianmain.tsx15 matches
51}
5253// Link Fetching Helper
54export class LinkFetcher {
55static filteredUrls = [];
5660}
6162static async fetchLinksFromWebsite(websiteUrl) {
63currentProgress = {
64phase: "fetching",
65processedPages: 0,
66totalLinks: 0,
74while (pagesToProcess.length > 0) {
75currentProgress = {
76phase: "fetching",
77processedPages: processedPages.size,
78totalLinks: allLinks.size,
8687try {
88const response = await fetch(pageUrl, {
89headers: {
90"User-Agent":
134} catch (error) {
135console.error(`Error processing page ${pageUrl}:`, error);
136this.logFilteredUrl(pageUrl, `Fetch error: ${error.message}`);
137}
138});
218for (let attempt = 0; attempt < retries; attempt++) {
219try {
220const response = await fetch(url, {
221method: "GET",
222headers: {
362export async function findBrokenLinks(websiteUrl) {
363try {
364const links = await LinkFetcher.fetchLinksFromWebsite(websiteUrl);
365const totalPages = new Set(links.map(link =>
366new URL(link.link, websiteUrl).origin + new URL(link.link, websiteUrl).pathname
376linkChecker.getElapsedTime(),
377totalPages,
378LinkFetcher.filteredUrls,
379);
380} catch (error) {
397intervalId = setInterval(async () => {
398try {
399const response = await fetch("/api/progress");
400if (!response.ok) {
401throw new Error(`HTTP error! status: ${response.status}`);
413}
414} catch (e) {
415console.error("Error fetching progress:", e);
416setError(`Error fetching progress: ${e.message}`);
417}
418}, 1000);
429setBrokenLinks([]);
430try {
431const response = await fetch("/api/check-links", {
432method: "POST",
433headers: {
478<h2>Progress</h2>
479<p>Phase: {progress.phase}</p>
480{progress.phase === "fetching" && (
481<p>
482Processed Pages: {progress.processedPages}
methodicalOliveSparrowmain.tsx2 matches
1/** @jsxImportSource npm:hono/jsx */
2import { blob } from "https://esm.town/v/std/blob";
3import { fetch } from "https://esm.town/v/std/fetch";
4import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
5import { pushRandomData, schedulePurge, schedulePush, scheduleRead } from "https://esm.town/v/temptemp/radiodb";
7374// Export the app
75export default app.fetch;
ambitiousBronzeBandicootmain.tsx10 matches
23}
2425async function fetchAndCacheData() {
26try {
27console.log("Fetching URL:", url);
28const response = await fetch(url, {
29headers: {
30'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'
56return bootstrapData;
57} catch (error) {
58console.error("Error fetching and caching data:", error);
59const cachedData = await blob.getJSON(cacheKey);
60if (cachedData) {
61console.log("Using cached data from:", cachedData.timestamp);
62return { ...cachedData.data, _cachedAt: cachedData.timestamp, _cacheNotice: "This is cached data. Live fetching failed." };
63}
64throw error;
6768async function getFullData() {
69const data = await fetchAndCacheData();
70return Response.json(data);
71}
7273async function getDonationProgress() {
74const data = await fetchAndCacheData();
75const donationGoal = data.checkoutLink.checkout_link_data.donation_goal;
76return Response.json({
8687async function getCheckoutDetails() {
88const data = await fetchAndCacheData();
89return Response.json({
90checkoutTitle: data.checkoutTitle,
9596async function getCampaignInfo() {
97const data = await fetchAndCacheData();
98const linkData = data.checkoutLink.checkout_link_data;
99return Response.json({
106107async function getHtmlView() {
108const data = await fetchAndCacheData();
109const linkData = data.checkoutLink.checkout_link_data;
110const donationGoal = linkData.donation_goal;
30setIsLoading(true);
31try {
32const response = await fetch("/generate", {
33method: "POST",
34headers: { "Content-Type": "application/json" },
professionalFuchsiaSmeltmain.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;