hackerNewsDigestmain.tsx8 matches
3import { email } from "https://esm.town/v/std/email";
45async function fetchStories(type: string, count: number) {
6const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7const storyIds = await response.json();
8const stories = await Promise.all(
9storyIds.slice(0, count).map(async (id: number) => {
10const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
11return storyResponse.json();
12}),
120export default async function server(req: Request) {
121try {
122const topStories = await fetchStories("top", 10);
123const newStories = await fetchStories("new", 5);
124const showStories = await fetchStories("show", 3);
125const askStories = await fetchStories("ask", 3);
126const jobStories = await fetchStories("job", 3);
127128const emailContent = createEmailContent(topStories, newStories, showStories, askStories, jobStories);
hackerNewsDigestmain.tsx8 matches
3import { email } from "https://esm.town/v/std/email";
45async function fetchStories(type: string, count: number) {
6const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7const storyIds = await response.json();
8const stories = await Promise.all(
9storyIds.slice(0, count).map(async (id: number) => {
10const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
11return storyResponse.json();
12}),
120export default async function server(req: Request) {
121try {
122const topStories = await fetchStories("top", 10);
123const newStories = await fetchStories("new", 5);
124const showStories = await fetchStories("show", 3);
125const askStories = await fetchStories("ask", 3);
126const jobStories = await fetchStories("job", 3);
127128const emailContent = createEmailContent(topStories, newStories, showStories, askStories, jobStories);
3233useEffect(() => {
34fetchContributions();
35}, []);
3637const fetchContributions = async () => {
38setError(null);
39setContributionData(null);
40setUserData(null);
41try {
42const response = await fetch("/contributions", {
43method: "POST",
44headers: { "Content-Type": "application/json" },
45body: JSON.stringify({ username }),
46});
47if (!response.ok) throw new Error("Failed to fetch contributions");
48const data = await response.json();
49console.log("Fetched data:", data);
50setContributionData(data.contributionCalendar);
51setUserData(data.user);
52} catch (err) {
53console.error("Error fetching contributions:", err);
54setError(err.message);
55}
248const handleKeyPress = (event) => {
249if (event.key === "Enter") {
250fetchContributions();
251}
252};
272placeholder="Enter GitHub username"
273/>
274<button onClick={fetchContributions}>Fetch Commits</button>
275</div>
276{error && <p className="error">{error}</p>}
331if (request.method === "POST" && new URL(request.url).pathname === "/contributions") {
332const { username } = await request.json();
333const contributionData = await fetchGitHubContributions(username);
334return new Response(JSON.stringify(contributionData), {
335headers: { "Content-Type": "application/json" },
359}
360361async function fetchGitHubContributions(username: string) {
362const query = `
363query($username: String!) {
381`;
382383const response = await fetch("https://api.github.com/graphql", {
384method: "POST",
385headers: {
391392if (!response.ok) {
393throw new Error("Failed to fetch GitHub data");
394}
395
14await blob.setJSON(genKey(key), url);
15}
16return new Response((await fetch(url)).body, { headers: { "content-type": "image/jpg" } });
17}
1Migrated from folder: fanficSearcher/BrowserBaseAttempt/BrowserbaseFetcherFromURL
sqliteExplorerAppmain.tsx4 matches
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
23import { 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});
176177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));
excaliGridmain.tsx4 matches
3940useEffect(() => {
41const fetchSvg = async () => {
42try {
43const response = await fetch(svgUrl);
44const svgContent = await response.text();
45setSvg(svgContent);
46} catch (error) {
47console.error("Error fetching SVG:", error);
48}
49};
5051fetchSvg();
52}, [svgUrl]);
53
102tokenUrl.searchParams.set("state", store.state);
103104const tokenResp = await fetch(tokenUrl.toString());
105if (!tokenResp.ok) {
106throw new Error(await tokenResp.text());
111};
112113const resp = await fetch("https://lastlogin.io/userinfo", {
114headers: {
115Authorization: `Bearer ${access_token}`,
blob_adminmain.tsx2 matches
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
23import { 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});
138139export default modifyFetchHandler(passwordAuth(app.fetch));
dependentHarlequinTigermain.tsx7 matches
23console.log("Searching for threadmark buttons...");
24const buttons = document.querySelectorAll(
25"div.structItem-cell--main[data-xf-click=\"threadmark-fetcher\"]",
26);
27console.log(`Found ${buttons.length} potential threadmark buttons.`);
29let newButtonsClicked = false;
30for (let button of buttons) {
31const fetchUrl = button.dataset.fetchurl;
32const originalTitle = button.getAttribute("data-original-title");
3334if (
35fetchUrl && fetchUrl.includes("threadmarks-load-range")
36&& fetchUrl.includes("min") && fetchUrl.includes("max")
37&& originalTitle && originalTitle.includes("hidden")
38&& !clickedButtons.has(fetchUrl)
39) {
40console.log(`Clicking threadmark button with fetchUrl: ${fetchUrl}`);
41button.click();
42await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for load
43clickedButtons.add(fetchUrl);
44newButtonsClicked = true;
45totalClicked++;