1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 return fetch(new URL(url.pathname + url.search, "https://vtwn_36ywGmYjcDL4HJKfTSmGbJKVWNny--charmaine.web.val.run/"), {
4 method: req.method,
5 headers: req.headers,
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 return fetch(new URL(url.pathname + url.search, "https://vtwn_36ywGmYjcDL4HJKfTSmGbJKVWNny--charmaine.web.val.run/"), {
4 method: req.method,
5 headers: req.headers,
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 return fetch(new URL(url.pathname + url.search, "https://vtwn_36ywGmYjcDL4HJKfTSmGbJKVWNny--charmaine.web.val.run/"), {
4 method: req.method,
5 headers: req.headers,
1import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
2import { form } from "https://esm.town/v/stevekrouse/date_me_form";
3import browse from "https://esm.town/v/stevekrouse/dateme_browse";
13app.get("/faq", faq);
14app.get("/rss.xml", c => dateMeRSS(c.req as unknown as Request));
15export default modifyFetchHandler(app.fetch, {
16 style: `@media (max-width: 500px) {
17 .github-fork-ribbon {
47 console.log("Sending conversion request with vals:", urls);
48
49 const response = await fetch("/convert", {
50 method: "POST",
51 headers: {
88 console.log("Sending redirect request with vals:", originalVals);
89
90 const response = await fetch("/redirect", {
91 method: "POST",
92 headers: {
43});
44
45export default app.fetch;
50 try {
51 const aliasUrl = `https://api.val.town/v1/alias/${valOwner}/${valName}`;
52 console.log(`Fetching val ID from alias: ${aliasUrl}`);
53
54 aliasResponse = await fetch(aliasUrl, {
55 headers: {
56 "Authorization": `Bearer ${apiKey}`,
92 console.log(`Updating val at: ${updateUrl} using PUT method`);
93
94 updateResponse = await fetch(updateUrl, {
95 method: "PUT",
96 headers: {
38
39 // Create a new project
40 const projectResponse = await fetch("https://api.val.town/v1/projects", {
41 method: "POST",
42 headers: {
64 const importedVals = {};
65
66 // First pass: fetch all vals and track them
67 const convertedVals = [];
68 for (const valInfo of vals) {
69 try {
70 // Fetch the val details
71 const valResponse = await fetch(`https://api.val.town/v1/alias/${valInfo.username}/${valInfo.valName}`, {
72 headers: { "Authorization": `Bearer ${apiKey}` },
73 });
78 ...valInfo,
79 success: false,
80 error: `Failed to fetch val: ${errorText}`,
81 });
82 continue;
114 const encodedPath = encodeURIComponent(filePath);
115
116 const fileResponse = await fetch(`https://api.val.town/v1/projects/${project.id}/files/${encodedPath}`, {
117 method: "POST",
118 headers: {
139 // Generate and add README.md
140 const readmeContent = generateReadme(project.name, vals, convertedVals);
141 await fetch(`https://api.val.town/v1/projects/${project.id}/files/README.md`, {
142 method: "POST",
143 headers: {
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const discordWebhook = async ({
8 content: string;
9}) => {
10 const res = await fetch(url, {
11 method: "POST",
12 redirect: "follow",
19 : Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
20
21 // Fetch and log tweets
22 const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23 console.log("Response from socialDataSearch:", response);