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 })));
60// Example client-side code for submitting feedback
61async function submitFeedback(rating, comment) {
62 const response = await fetch('https://username-submitFeedback.web.val.run', {
63 method: 'POST',
64 headers: {
88const submitFeedback = async (apiKey, rating, comment) => {
89 try {
90 const response = await fetch('https://username-submitFeedback.web.val.run', {
91 method: 'POST',
92 headers: {
33app.get("/10gb", s(get10gb));
34
35export default app.fetch;
36
37function fromB64(str: string): Uint8Array {
15 const start = performance.now();
16 try {
17 res = await fetch(url);
18 end = performance.now();
19 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 }
48 },
49 vertexShader:`varying vec2 vUv; void main(){vUv=uv;gl_Position=vec4(position,1.);}`,
50 fragmentShader: await (await fetch('data:text/plain,'+encodeURIComponent(`
51/* WGSL-like GLSL fragment shader: traces one null geodesic per pixel */
52/* Kerr–Newman metric helpers ------------------------------------------- */
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({
37
38 this.initializeDOM();
39 this.fetchExploredNeighborhoods();
40 }
41
102 }
103
104 async fetchExploredNeighborhoods() {
105 try {
106 const response = await fetch("/get-explored-neighborhoods");
107 const data = await response.json();
108 this.exploredNeighborhoods = data.explored;
109 this.updateUI();
110 } catch (error) {
111 console.error("Failed to fetch explored neighborhoods", error);
112 }
113 }
134 async toggleNeighborhood(neighborhoodName) {
135 try {
136 const response = await fetch("/toggle-neighborhood", {
137 method: "POST",
138 headers: { "Content-Type": "application/json" },
98 async function loadExploredNeighborhoods() {
99 try {
100 const response = await fetch(GET_ENDPOINT);
101 const data = await response.json();
102 knownNeighborhoods = data.neighborhoods || [];
120 };
121
122 await fetch(UPDATE_ENDPOINT, {
123 method: 'POST',
124 headers: {
239 try {
240 // Load Berlin neighborhood data
241 const response = await fetch('https://raw.githubusercontent.com/madisonwalker/berlin-neighbourhoods/main/berlin_neighbourhoods.geojson');
242 const data = await response.json();
243
65 const { startDate, endDate } = getYesterdayDateRange();
66
67 const response = await fetch("https://api.linear.app/graphql", {
68 method: "POST",
69 headers: {
80
81 if (data.errors) {
82 console.error("Error fetching data from Linear API:", data.errors);
83 Deno.exit(1);
84 }
86 const issues = data.data.viewer.assignedIssues.nodes;
87
88 // Group issues by team and fetch issue history
89 const issuesByTeam: { [teamName: string]: any[] } = {};
90 for (const issue of issues) {
94 }
95
96 const historyResponse = await fetch("https://api.linear.app/graphql", {
97 method: "POST",
98 headers: {
110 if (historyData.errors) {
111 console.error(
112 `Error fetching history for issue ${issue.id}:`,
113 historyData.errors,
114 );
190 }
191
192 const slackResponse = await fetch("https://slack.com/api/chat.postMessage", {
193 method: "POST",
194 headers: {
65 const { startDate, endDate } = getYesterdayDateRange();
66
67 const response = await fetch("https://api.linear.app/graphql", {
68 method: "POST",
69 headers: {
80
81 if (data.errors) {
82 console.error("Error fetching data from Linear API:", data.errors);
83 Deno.exit(1);
84 }
86 const issues = data.data.viewer.assignedIssues.nodes;
87
88 // Group issues by team and fetch issue history
89 const issuesByTeam: { [teamName: string]: any[] } = {};
90 for (const issue of issues) {
94 }
95
96 const historyResponse = await fetch("https://api.linear.app/graphql", {
97 method: "POST",
98 headers: {
110 if (historyData.errors) {
111 console.error(
112 `Error fetching history for issue ${issue.id}:`,
113 historyData.errors,
114 );
190 }
191
192 const slackResponse = await fetch("https://slack.com/api/chat.postMessage", {
193 method: "POST",
194 headers: {