150
151 try {
152 const res = await fetch(location.href, {
153 method: "POST",
154 headers: { "content-type": "application/json" },
1/** @jsxImportSource npm:hono/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176
177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));
123 const timeoutId = setTimeout(() => controller.abort(), 25000); // 25 second timeout
124
125 const response = await fetch(`${this.baseUrl}/chat/completions`, {
126 method: 'POST',
127 headers,
539(function() {
540 // SOLUTION: Use an empty string for the API_URL.
541 // This makes fetch requests relative to the current domain.
542Â Â const API_URL = "";
543Â Â let sessionId = 'sess_' + Date.now() + Math.random().toString(36).substr(2, 9);
582
583Â Â Â Â try {
584Â Â Â Â Â Â const res = await fetch(\`\${API_URL}/build-world\`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ description, sessionId }) });
585Â Â Â Â Â Â const data = await res.json();
586Â Â Â Â Â Â if (!res.ok || !data.ok) throw new Error(data.error || 'The AI architect needs a moment. Please try again.');
624
625Â Â Â Â try {
626Â Â Â Â Â Â const res = await fetch(\`\${API_URL}/command\`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-session-id': sessionId }, body: JSON.stringify({ cmd, args }) });
627Â Â Â Â Â Â const data = await res.json();
628Â Â Â Â Â Â if (!res.ok || !data.ok) throw new Error(data.error || 'The robot encountered an issue. Try a different command!');
727}
728
729export default app.fetch;
4 let pushTokens: string[] = [];
5 try{
6 const res = await fetch("https://sct--c04a76ea75d611f08a410224a6c84d84.web.val.run",{
7 method: "GET",
8 });
9 if(!res.ok) throw new Error("Failed to fetch tokens");
10 pushTokens = await res.json();
11
25 }));
26 try {
27 const res = await fetch("https://exp.host/--/api/v2/push/send",{
28 method: "POST",
29 headers: {"Content-Type": "application/json"},
21
22 // Send POST request to the webhook
23 const webhookResponse = await fetch(
24 'https://webhooks.tasklet.ai/v1/public/webhook?token=a6bb800345cb4fc36d216a674e70de8c',
25 {
4import { generatePKCE } from "./dpop.ts";
5import { OAUTH_CONFIG } from "./config.ts";
6import { BlueskyProfileFetcher } from "../utils/profile-resolver.ts";
7import { setupOAuthWithSlingshot } from "./slingshot-resolver.ts";
8import { cleanupExpiredOAuthSessions } from "./session-cleanup.ts";
522 }
523
524 // Fetch user's profile to get avatar and display name
525 const profileFetcher = new BlueskyProfileFetcher();
526 const userProfile = await profileFetcher.fetchProfile(did);
527
528 // Set secure session cookie
972
973 // Get user profile for mobile response
974 const profileFetcher = new BlueskyProfileFetcher();
975 const profile = await profileFetcher.fetchProfile(sessionRow.did as string);
976
977 // Update profile info in database
76 sessionStorage.setItem("pkce_code_verifier", codeVerifier);
77
78 const response = await fetch("/api/auth/mobile-start", {
79 method: "POST",
80 headers: {
33
34```ts
35fetch("https://YOUR_ENDPOINT_HERE/push", {
36 method: "POST",
37 headers: {
13 }
14 let clientSubscription = await registration.pushManager.getSubscription();
15 let serverSubscription = await (await fetch("/subscription")).json();
16
17 if (clientSubscription === null) {
47 button.disabled = true;
48 button.textContent = await (
49 await fetch("/subscription", {
50 method: "PUT",
51 body: JSON.stringify(
55 userVisibleOnly: true,
56 applicationServerKey: await (
57 await fetch("/vapidPublicKey")
58 ).text(),
59 }),