1import { blob } from "https://esm.town/v/std/blob";
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3import { TABLE_NAME } from "./updateTable";
4
5export default async function(req: Request): Promise<Response> {
129 const lastSunday = today.startOf("week").minus({ days: 1 });
130
131 // Fetch relevant memories using the utility function
132 const memories = await getRelevantMemories();
133
63});
64
65// HTTP vals expect an exported "fetch handler"
66// This is how you "run the server" in Val Town with Hono
67export default app.fetch;
66 const fontPromises = fontsConfig.map(async (font) => {
67 const fontUrl = "https://cdn.jsdelivr.net/npm/@tamagui/font-inter@1.108.3/otf/" + font.fontFile;
68 const fontArrayBuf = await fetch(fontUrl).then((res) => res.arrayBuffer());
69 return { name: font.name, data: fontArrayBuf, weight: font.weight };
70 });
77 // const api = `https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${code.toLowerCase()}.svg`
78 const api = `https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${code.toLowerCase()}_color.svg`;
79 return fetch(api).then((r) => r.text());
80};
81
1const baseUrl = "https://api.neynar.com/v2/farcaster/";
2
3export async function fetchNeynarGet(path: string) {
4 const res = await fetch(baseUrl + path, {
5 method: "GET",
6 headers: {
14}
15
16export function fetchUser(username: string) {
17 return fetchNeynarGet(`user/by_username?username=${username}`).then(r => r.user);
18}
19export function fetchUsersById(fids: string) {
20 return fetchNeynarGet(`user/bulk?fids=${fids}`).then(r => r.users);
21}
22
23export function fetchUserFeed(fid: number) {
24 return fetchNeynarGet(
25 `feed?feed_type=filter&filter_type=fids&fids=${fid}&with_recasts=false&with_replies=false&limit=100&cursor=`,
26 ).then(r => r.casts);
27}
28
29export function fetchChannel(channelId: string) {
30 return fetchNeynarGet(`channel?id=${channelId}`).then(r => r.channel);
31}
32
33export function fetchChannelFeed(channelId: string) {
34 return fetchNeynarGet(
35 `feed/channels?channel_ids=${channelId}&with_recasts=false&limit=100`,
36 ).then(r => r.casts);
37}
38
39export function fetchChannelsFeed(channelIds: array) {
40 return fetchNeynarGet(
41 `feed/channels?channel_ids=${channelIds.join(",")}&with_recasts=false&limit=100`,
42 ).then(r => r.casts);
7
8import { Button, Input, Section } from "../components/ui.tsx";
9import { fetchUsersById } from "../util/neynar.ts";
10
11export function Home() {
41
42async function sendNotification(notificationDetails: any, payload: any) {
43 return await fetch(notificationDetails.url, {
44 method: "POST",
45 headers: { "Content-Type": "application/json" },
21});
22
23// HTTP vals expect an exported "fetch handler"
24// This is how you "run the server" in Val Town with Hono
25export default app.fetch;
172const app = new Hono();
173app.get("/", AreYouSolvingtheRightProblems);
174export default app.fetch;
175
176{
135 const lastSunday = today.startOf("week").minus({ days: 1 });
136
137 // Fetch relevant memories using the utility function
138 const memories = await getRelevantMemories();
139