fullWebsiteVersionmain.tsx4 matches
11console.log(`Checking URL: ${url}`);
12try {
13const response = await fetch(url, { method: "HEAD" });
1415if (!response.ok) {
16console.log(`Attempting GET request as fallback for: ${url}`);
17const getResponse = await fetch(url, { method: "GET" });
18return { ok: getResponse.ok, status: getResponse.status };
19}
72`;
7374const lsdResponse = await fetch(
75`https://lsd.so/api?query=${encodeURIComponent(query)}`,
76);
8081if (!lsdResponse.ok) {
82console.error(`Failed to fetch links from ${currentUrl}`);
83continue;
84}
BBslackScoutmain.tsx8 matches
20for (const topic of KEYWORDS) {
21const results = await Promise.allSettled([
22fetchHackerNewsResults(topic),
23fetchTwitterResults(topic),
24fetchRedditResults(topic),
25]);
2649}
5051// Fetch Hacker news, Twitter, and Reddit results
52async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
53return hackerNewsSearch({
54query: topic,
58}
5960async function fetchTwitterResults(topic: string): Promise<Website[]> {
61return twitterSearch({
62query: topic,
67}
6869async function fetchRedditResults(topic: string): Promise<Website[]> {
70return redditSearch({ query: topic });
71}
84}
8586const response = await fetch(slackWebhookUrl, {
87method: "POST",
88headers: { "Content-Type": "application/json" },
falProxyRequestmain.tsx1 match
4const headers = new Headers(req.headers);
5headers.set("x-proxy-authorization", `Bearer ${Deno.env.get("valtown")}`);
6return fetch("https://fal-faltownproxy.web.val.run/api/faltown/proxy", {
7method,
8headers,
cerebras_codermain.tsx1 match
2324try {
25const response = await fetch("/", {
26method: "POST",
27body: JSON.stringify({ prompt, currentCode: code }),
reqEvaltownmain.tsx1 match
32const url = new URL("." + pathname, "http://localhost:" + port);
33url.search = search;
34const resp = await fetch(url, {
35method: req.method,
36headers: req.headers,
valtowntownmain.tsx1 match
172});
173174export default app.fetch.bind(app);
175176const css = `
discordActivityClientmain.tsx6 matches
51// /.proxy/ is prepended here in compliance with CSP
52// see https://discord.com/developers/docs/activities/development-guides#construct-a-full-url
53const response = await fetch("/.proxy/api/token", {
54method: "POST",
55headers: {
7374/**
75* This function fetches the current voice channel over RPC. It then creates a
76* text element that displays the voice channel's name
77*/
106* This function utilizes RPC and HTTP apis, in order show the current guild's avatar
107* Here are the steps:
108* 1. From RPC fetch the currently selected voice channel, which contains the voice channel's guild id
109* 2. From the HTTP API fetch a list of all of the user's guilds
110* 3. Find the current guild's info, including its "icon"
111* 4. Append to the UI an img tag with the related information
117}
118119// 1. From the HTTP API fetch a list of all of the user's guilds
120const guilds = await fetch(
121"https://discord.com/api/users/@me/guilds",
122{
blobbyFacemain.tsx18 matches
2import { blobby } from "https://esm.town/v/yawnxyz/blobby";
3import { fileTypeFromBuffer } from 'npm:file-type';
4import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
5import { cors } from "npm:hono/cors";
6757677// Endpoint to fetch blob by key
78app.get("/blob/:key", async (c) => {
79const key = c.req.param('key');
219this.blobs[key] = {isLoading: true};
220
221const response = await fetch('/blob/' + key);
222const contentType = response.headers.get('Content-Type');
223blob.type = contentType || 'text/plain';
249let blob = this.blobs[key];
250try {
251const response = await fetch('/create/' + key, {
252method: 'POST',
253headers: {
273274// Send a delete request to the server
275const response = await fetch('/delete/' + key, { method: 'GET' });
276277// Check the response status
343
344try {
345const response = await fetch('/upload/' + key, {
346method: 'POST',
347body: formData,
368
369try {
370const response = await fetch('/uploadUrl' + '?key=' + key + '&url=' + url);
371
372if (!response.ok) {
391if (!this.newKeyName) return;
392try {
393const response = await fetch('/rename?key='+key+'&newKey='+this.newKeyName);
394if (!response.ok) {
395throw new Error('Failed to rename blob');
559async loadBlob() {
560this.isLoading = true;
561const response = await fetch('/blob/' + this.key);
562const contentType = response.headers.get('Content-Type');
563this.blobType = contentType || 'text/plain';
583async updateCreate() {
584try {
585const response = await fetch('/create/' + this.key, {
586method: 'POST',
587headers: {
606607try {
608const response = await fetch('/upload/' + this.key, {
609method: 'POST',
610body: formData,
626if (this.uploadUrl) {
627try {
628const response = await fetch('/uploadUrl?key=' + this.key + '&url=' + this.uploadUrl);
629630if (!response.ok) {
643if (!this.newKeyName) return;
644try {
645const response = await fetch('/rename?key=' + this.key + '&newKey=' + this.newKeyName);
646if (!response.ok) {
647throw new Error('Failed to rename blob');
661}
662try {
663const response = await fetch('/delete/' + this.key, { method: 'GET' });
664if (!response.ok) {
665throw new Error('Failed to delete blob');
763764765export default app.fetch;
766767// import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
770771772// export default passwordAuth(app.fetch);
773774// export default passwordAuth(app.fetch, { verifyPassword: verifyToken });
775// export default passwordAuth(app.fetch, { verifyPassword: (password) => password == "yespleasetakealook" });
776// }, { verifyPassword: (password) => password == Deno.env.get("VAL_PASSWORD") });
777
6465try {
66const response = await fetch('${httpEndpoint}', {
67method: 'POST',
68body: code,
fearlessVioletAnteatermain.tsx5 matches
42e.preventDefault();
43const finalAmount = showCustomAmount ? parseFloat(customAmount) : amount;
44const response = await fetch("/create-checkout-session", {
45method: "POST",
46headers: { "Content-Type": "application/json" },
205206useEffect(() => {
207fetchPayments();
208const urlParams = new URLSearchParams(window.location.search);
209if (urlParams.get('success') === 'true') {
212}, []);
213214const fetchPayments = async () => {
215const response = await fetch('/get-payments');
216const data = await response.json();
217setPayments(data);
223<div className="w-full max-w-[90%] flex flex-col md:flex-row gap-8">
224<div className="w-full md:w-1/2 order-2 md:order-1">
225<TippingForm onPaymentSuccess={fetchPayments} />
226</div>
227<div className="w-full md:w-1/2 order-1 md:order-2">