tangled
alpha
login
or
join now
essem.space
/
pds-feedgen
2
fork
atom
A couple of Bluesky feeds focused around PDSes
2
fork
atom
overview
issues
pulls
pipelines
Expose DID record for feed
essem.space
1 month ago
8c67d41f
d9203d3b
+32
-6
1 changed file
expand all
collapse all
unified
split
feedgen.ts
+32
-6
feedgen.ts
···
55
55
`SELECT a.uri, a.indexed_at FROM posts a
56
56
INNER JOIN authors b ON a.author = b.did
57
57
WHERE b.pds = ?1
58
58
-
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?2;`
58
58
+
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?2;`,
59
59
),
60
60
cursor: db.prepare(
61
61
`SELECT a.uri, a.indexed_at FROM posts a
62
62
INNER JOIN authors b ON a.author = b.did
63
63
WHERE b.pds = ?1
64
64
AND a.indexed_at < ?2
65
65
-
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?3;`
65
65
+
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?3;`,
66
66
),
67
67
pds: true,
68
68
},
···
72
72
INNER JOIN authors b ON a.author = b.did
73
73
WHERE b.pds_base != 'bsky.network'
74
74
AND b.pds_base != 'brid.gy'
75
75
-
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?1;`
75
75
+
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?1;`,
76
76
),
77
77
cursor: db.prepare(
78
78
`SELECT a.uri, a.indexed_at FROM posts a
···
80
80
WHERE b.pds_base != 'bsky.network'
81
81
AND b.pds_base != 'brid.gy'
82
82
AND a.indexed_at < ?1
83
83
-
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?2;`
83
83
+
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?2;`,
84
84
),
85
85
pds: false,
86
86
},
···
88
88
89
89
const requireAuth = async (
90
90
request: Request,
91
91
-
lxm: Nsid
91
91
+
lxm: Nsid,
92
92
): Promise<VerifiedJwt> => {
93
93
const auth = request.headers.get("authorization");
94
94
if (auth === null) {
···
205
205
},
206
206
});
207
207
208
208
-
export default app;
208
208
+
export default {
209
209
+
fetch(request) {
210
210
+
const url = new URL(request.url);
211
211
+
if (url.pathname === "/.well-known/did.json") {
212
212
+
return new Response(
213
213
+
JSON.stringify({
214
214
+
"@context": ["https://www.w3.org/ns/did/v1"],
215
215
+
id: baseDID,
216
216
+
service: [
217
217
+
{
218
218
+
id: "#bsky_fg",
219
219
+
type: "BskyFeedGenerator",
220
220
+
serviceEndpoint: `https://${hostname}`,
221
221
+
},
222
222
+
],
223
223
+
}),
224
224
+
{
225
225
+
headers: {
226
226
+
"Content-Type": "application/json",
227
227
+
},
228
228
+
},
229
229
+
);
230
230
+
} else {
231
231
+
return app.fetch(request);
232
232
+
}
233
233
+
},
234
234
+
} satisfies Deno.ServeDefaultExport;