From bec1208d0c5bfb1977c1b649849bcbc230006830 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Fri, 17 Oct 2025 12:22:22 -0400 Subject: [PATCH] add bsky-leaflet-quotes feed to generator --- feeds/index.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/feeds/index.ts b/feeds/index.ts index 55456a2e..22d0b1b2 100644 --- a/feeds/index.ts +++ b/feeds/index.ts @@ -42,8 +42,31 @@ app.get("/xrpc/app.bsky.feed.getFeedSkeleton", async (c) => { let feedAtURI = new AtUri(feed); let posts; let query; + if (feedAtURI.rkey == "bsky-leaflet-quotes") { + let query = supabaseServerClient + .from("document_mentions_in_bsky") + .select("*") + .order("indexed_at", { ascending: false }) + .order("uri", { ascending: false }) + .limit(25); + if (parsedCursor) + query = query.or( + `indexed_at.lt.${parsedCursor.date},and(indexed_at.eq.${parsedCursor.date},uri.lt.${parsedCursor.uri})`, + ); + + let { data, error } = await query; + let posts = data || []; + + let lastPost = posts[posts.length - 1]; + let newCursor = lastPost ? `${lastPost.indexed_at}::${lastPost.uri}` : null; + return c.json({ + cursor: newCursor || cursor, + feed: posts.flatMap((p) => { + return { post: p.uri }; + }), + }); + } if (feedAtURI.rkey === "bsky-follows-leaflets") { - console.log(cursor); if (!cursor) { console.log("Sending event"); await inngest.send({ name: "feeds/index-follows", data: { did: auth } }); -- 2.51.2