226});
227
228export default app.fetch;
83 const form = event.target;
84 const formData = new FormData(form);
85 const response = await fetch('/api', {
86 method: 'POST',
87 headers: {
83 const form = event.target;
84 const formData = new FormData(form);
85 const response = await fetch('/api', {
86 method: 'POST',
87 headers: {
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
2import { load } from "npm:cheerio";
3import { format } from "npm:date-fns";
44};
45
46const fetchAndParsePage = async (url: string) => {
47 const html = await fetchText(url);
48 const $ = load(html);
49
51 if (url == onThisDayUrl) {
52 // pull all <ul>'s out and combine together
53 // this is fetching all 3 major sections (Events, Births, Deaths) but I really only care about Events
54 parsedBody = $(".mw-content-ltr > ul").text();
55 // FIXME this isn't quite working but is what I want...
83 }
84
85 const data = await fetchAndParsePage(url);
86 if (format == "json") {
87 return Response.json({ data: data.split("\n") });
1/** @jsxImportSource https://esm.sh/hono@latest/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 })));
1// This val provides an HTML interface for uploading a CSV file of URLs, validates them,
2// and returns a downloadable CSV file with the results.
3// It uses the Fetch API to check each URL's status and generates a CSV report.
4// We'll use the built-in URL constructor for basic URL validation and the native fetch for HTTP requests.
5// The UI is now styled using Tailwind CSS and shadcn UI components for a more polished look.
6// Added functionality to show the selected filename in the UI.
70 try {
71 new URL(url); // Basic URL validation
72 const response = await fetch(url, { method: "HEAD" });
73 return { url, valid: response.ok, status: response.status };
74 } catch {
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));