1import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4export type Snowflake = string;
95 (async () => {
96 const data = await response;
97 const update = await fetch(
98 `https://discord.com/api/v10/webhooks/${body.application_id}/${body.token}/messages/@original`,
99 {
1import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4export type Snowflake = string;
95 (async () => {
96 const data = await response;
97 const update = await fetch(
98 `https://discord.com/api/v10/webhooks/${body.application_id}/${body.token}/messages/@original`,
99 {
918 code: newCode,
919 });
920 fetch('/save', { method: "POST", body }).then(() => {
921 document.getElementById('code-input-hidden').value = newCode;
922 document.getElementById('preview-iframe').src += '';
1284 app.post("/", mainHandler);
1285
1286 return passwordAuth(app.fetch, { verifyPassword: verifyToken });
1287}
14
15 useEffect(() => {
16 fetchTodayNote();
17 }, []);
18
19 const fetchTodayNote = async () => {
20 setLoading(true);
21 const response = await fetch("/get-note");
22 const data = await response.json();
23 setNote(data.note);
27 const generateNewNote = async () => {
28 setLoading(true);
29 await fetch("/generate-note", { method: "POST" });
30 await fetchTodayNote();
31 };
32
16
17 useEffect(() => {
18 fetchUser();
19 fetchMatches();
20 }, []);
21
22 const fetchUser = async () => {
23 const response = await fetch('/user');
24 if (response.ok) {
25 const userData = await response.json();
30 };
31
32 const fetchMatches = async () => {
33 const response = await fetch('/matches');
34 if (response.ok) {
35 const matchesData = await response.json();
44 formData.append('type', type);
45
46 const response = await fetch('/upload', {
47 method: 'POST',
48 body: formData,
13}
14
15export const fetchWikipediaImage = async (request: Request): Promise<Response> => {
16 const url = new URL(request.url);
17 const pageName = url.searchParams.get("title");
30 return formatResponse(pageData, format);
31 } catch (error) {
32 console.error("Error fetching Wikipedia image:", error);
33 return new Response("An error occurred while fetching the image", { status: 500 });
34 }
35};
44 apiUrl.searchParams.append("format", "json");
45
46 const response = await fetch(apiUrl.toString());
47 const data = await response.json();
48
73 apiUrl.searchParams.append("format", "json");
74
75 const response = await fetch(apiUrl.toString());
76 const data = await response.json();
77
141 apiUrl.searchParams.append("format", "json");
142
143 const response = await fetch(apiUrl.toString());
144 const data = await response.json();
145
212 return response;
213 });
214 return app.fetch;
215};
1const getText = async url => (await fetch(url)).text();
2
3export default async function(req: Request): Promise<Response> {
2// We'll use the built-in Request and Response objects for handling HTTP.
3// The form fields are customized for video information collection.
4// We'll add JSON API endpoints for Framer Fetch integration.
5
6import { blob } from "https://esm.town/v/std/blob";
11 const url = new URL(req.url);
12
13 // API endpoints for Framer Fetch
14 if (url.pathname === "/api/entries") {
15 if (req.method === "GET") {
13
14 try {
15 const weatherResponse = await fetch(weatherApiUrl);
16 if (!weatherResponse.ok) {
17 throw new Error(`Weather API request failed with status: ${weatherResponse.status}`);
33 });
34 } catch (err) {
35 return new Response("Error fetching weather data: " + err.message, {
36 status: 500, // Internal Server Error
37 headers: { "Content-Type": "text/plain" },