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
`SELECT a.uri, a.indexed_at FROM posts a
56
INNER JOIN authors b ON a.author = b.did
57
WHERE b.pds = ?1
58
-
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?2;`
59
),
60
cursor: db.prepare(
61
`SELECT a.uri, a.indexed_at FROM posts a
62
INNER JOIN authors b ON a.author = b.did
63
WHERE b.pds = ?1
64
AND a.indexed_at < ?2
65
-
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?3;`
66
),
67
pds: true,
68
},
···
72
INNER JOIN authors b ON a.author = b.did
73
WHERE b.pds_base != 'bsky.network'
74
AND b.pds_base != 'brid.gy'
75
-
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?1;`
76
),
77
cursor: db.prepare(
78
`SELECT a.uri, a.indexed_at FROM posts a
···
80
WHERE b.pds_base != 'bsky.network'
81
AND b.pds_base != 'brid.gy'
82
AND a.indexed_at < ?1
83
-
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?2;`
84
),
85
pds: false,
86
},
···
88
89
const requireAuth = async (
90
request: Request,
91
-
lxm: Nsid
92
): Promise<VerifiedJwt> => {
93
const auth = request.headers.get("authorization");
94
if (auth === null) {
···
205
},
206
});
207
208
-
export default app;
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
55
`SELECT a.uri, a.indexed_at FROM posts a
56
INNER JOIN authors b ON a.author = b.did
57
WHERE b.pds = ?1
58
+
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?2;`,
59
),
60
cursor: db.prepare(
61
`SELECT a.uri, a.indexed_at FROM posts a
62
INNER JOIN authors b ON a.author = b.did
63
WHERE b.pds = ?1
64
AND a.indexed_at < ?2
65
+
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?3;`,
66
),
67
pds: true,
68
},
···
72
INNER JOIN authors b ON a.author = b.did
73
WHERE b.pds_base != 'bsky.network'
74
AND b.pds_base != 'brid.gy'
75
+
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?1;`,
76
),
77
cursor: db.prepare(
78
`SELECT a.uri, a.indexed_at FROM posts a
···
80
WHERE b.pds_base != 'bsky.network'
81
AND b.pds_base != 'brid.gy'
82
AND a.indexed_at < ?1
83
+
ORDER BY a.indexed_at DESC, a.cid DESC LIMIT ?2;`,
84
),
85
pds: false,
86
},
···
88
89
const requireAuth = async (
90
request: Request,
91
+
lxm: Nsid,
92
): Promise<VerifiedJwt> => {
93
const auth = request.headers.get("authorization");
94
if (auth === null) {
···
205
},
206
});
207
208
+
export default {
209
+
fetch(request) {
210
+
const url = new URL(request.url);
211
+
if (url.pathname === "/.well-known/did.json") {
212
+
return new Response(
213
+
JSON.stringify({
214
+
"@context": ["https://www.w3.org/ns/did/v1"],
215
+
id: baseDID,
216
+
service: [
217
+
{
218
+
id: "#bsky_fg",
219
+
type: "BskyFeedGenerator",
220
+
serviceEndpoint: `https://${hostname}`,
221
+
},
222
+
],
223
+
}),
224
+
{
225
+
headers: {
226
+
"Content-Type": "application/json",
227
+
},
228
+
},
229
+
);
230
+
} else {
231
+
return app.fetch(request);
232
+
}
233
+
},
234
+
} satisfies Deno.ServeDefaultExport;