5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({
18});
19
20export default app.fetch;
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({
25 }
26
27 const response = await fetch(`/fork?url=${encodeURIComponent(projectUrl)}`, {
28 method: "POST",
29 headers: {
21});
22
23// HTTP vals expect an exported "fetch handler"
24// This is how you "run the server" in Val Town with Hono
25export default app.fetch;
43});
44
45// HTTP vals expect an exported "fetch handler"
46// This is how you "run the server" in Val Town with Hono
47export default app.fetch;
39 try {
40 setLoading(true);
41 const response = await fetch("/generate-image", {
42 method: "POST",
43 headers: {
226 uploadButton.disabled = true;
227 uploadButton.textContent = "Uploading...";
228 const response = await fetch("https://todepond-spagUpload.web.val.run", {
229 method: "POST",
230 body,
246 );
247
248 async function fetchUploads() {
249 const response = await fetch("https://todepond-spagList.web.val.run");
250 const data = await response.json();
251 return data.rows;
256 previewAllButton.hidden = true;
257 refreshButton.textContent = "Refreshing...";
258 const uploads = await fetchUploads();
259 renderUploads(uploads);
260 refreshButton.textContent = "Refresh";
306 previewContainer.innerHTML = "";
307 try {
308 fetch(`https://spag.cc/${upload.name}`).then(async (response) => {
309 if (!response.ok) {
310 const textElement = document.createElement("p");
390 deleteButton.disabled = true;
391 deleteButton.textContent = "Deleting...";
392 const response = await fetch(
393 `https://todepond-spagDelete.web.val.run`,
394 {