tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
27
pulls
pipelines
add bsky-leaflet-quotes feed to generator
awarm.space
5 months ago
bec1208d
685651dc
+24
-1
1 changed file
expand all
collapse all
unified
split
feeds
index.ts
+24
-1
feeds/index.ts
···
42
42
let feedAtURI = new AtUri(feed);
43
43
let posts;
44
44
let query;
45
45
+
if (feedAtURI.rkey == "bsky-leaflet-quotes") {
46
46
+
let query = supabaseServerClient
47
47
+
.from("document_mentions_in_bsky")
48
48
+
.select("*")
49
49
+
.order("indexed_at", { ascending: false })
50
50
+
.order("uri", { ascending: false })
51
51
+
.limit(25);
52
52
+
if (parsedCursor)
53
53
+
query = query.or(
54
54
+
`indexed_at.lt.${parsedCursor.date},and(indexed_at.eq.${parsedCursor.date},uri.lt.${parsedCursor.uri})`,
55
55
+
);
56
56
+
57
57
+
let { data, error } = await query;
58
58
+
let posts = data || [];
59
59
+
60
60
+
let lastPost = posts[posts.length - 1];
61
61
+
let newCursor = lastPost ? `${lastPost.indexed_at}::${lastPost.uri}` : null;
62
62
+
return c.json({
63
63
+
cursor: newCursor || cursor,
64
64
+
feed: posts.flatMap((p) => {
65
65
+
return { post: p.uri };
66
66
+
}),
67
67
+
});
68
68
+
}
45
69
if (feedAtURI.rkey === "bsky-follows-leaflets") {
46
46
-
console.log(cursor);
47
70
if (!cursor) {
48
71
console.log("Sending event");
49
72
await inngest.send({ name: "feeds/index-follows", data: { did: auth } });