1import { blob } from "https://esm.town/v/std/blob";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4const PAGE_SIZE = 50;
15 while (hasMore) {
16 const pagePromises = [];
17 for (let i = 0; i < 5 && hasMore; i++) { // Fetch 5 pages at a time
18 pagePromises.push(
19 fetch(`${baseUrl}?page=${currentPage + i}&per=${PAGE_SIZE}`)
20 .then(res => res.json()),
21 );
1import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
2import { dateMeRSS } from "https://esm.town/v/stevekrouse/dateMeRSS";
3import { form } from "https://esm.town/v/vawogbemi/date_me_form";
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 {
1import { fetch } from "https://esm.town/v/std/fetch";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4// Get the title of the top story on Hacker News
5export async function hnTopStory() {
6 const topStories: Number[] = await fetch(
7 "https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty",
8 ).then((res) => res.json());
15 score: number;
16 by: string;
17 } = await fetchJSON(
18 `https://hacker-news.firebaseio.com/v0/item/${id}.json`,
19 );
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138
139export default modifyFetchHandler(passwordAuth(app.fetch));
82async function list(prefix?: string): Promise<{ key: string; size: number; lastModified: string }[]> {
83 let querystring = prefix ? `?prefix=${encodeURIComponent(prefix)}` : "";
84 const res = await fetch(`${API_URL}/v1/blob${querystring}`, {
85 headers: {
86 Authorization: `Bearer ${Deno.env.get("valtown")}`,
95
96async function delete_(key: string) {
97 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
98 method: "DELETE",
99 headers: {
108
109async function get(key: string) {
110 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
111 headers: {
112 Authorization: `Bearer ${Deno.env.get("valtown")}`,
124
125async function set(key: string, value: BodyInit) {
126 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
127 method: "POST",
128 headers: {
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138
139export default modifyFetchHandler(passwordAuth(app.fetch));
32 const fontPromises = fontsConfig.map(async (font) => {
33 const fontUrl = "https://cdn.jsdelivr.net/npm/@tamagui/font-inter@1.108.3/otf/" + font.fontFile
34 const fontArrayBuf = await fetch(fontUrl).then((res) => res.arrayBuffer())
35 return { name: font.name, data: fontArrayBuf, weight: font.weight }
36 })
43 // const api = `https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${code.toLowerCase()}.svg`
44 const api = `https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${code.toLowerCase()}_color.svg`
45 return fetch(api).then((r) => r.text())
46}
196 ));
197
198export default app.fetch;
2
3todo:
4- fetch and persist data on regular basis
5- display data from cache
6- calendar endpoint
6
7const app = new Hono()
8export default app.fetch
9
10const baseUrl = "https://moe-spacex.web.val.run"