+6
-2
landing/landing.ts
+6
-2
landing/landing.ts
···
1
import css from "./css.css" with { type: "text" };
2
import heading from "./heading.txt" with { type: "text" };
3
4
-
Deno.serve({ port: 8000 }, (req) => {
5
switch (new URL(req.url).pathname) {
6
case "/css":
7
return new Response(css, {
···
26
// type cast because no point validating for smthn like this
27
// real type has more info; not needed here
28
.then((res) => res.json() as Promise<{ repos: { did: string }[] }>)
29
.then((res) =>
30
// get display name, handle, and did for each user
31
res.repos.map((repo) => ({
···
33
`http://pi:8000/xrpc/com.atproto.repo.getRecord?repo=${repo.did}&collection=app.bsky.actor.profile&rkey=self`
34
)
35
.then((res) => res.json())
36
-
.then((profile) => profile?.value?.displayName),
37
// dont validate handles because I'm Lazy + trust myself
38
handle: fetch(
39
repo.did.startsWith("did:plc")
···
1
import css from "./css.css" with { type: "text" };
2
import heading from "./heading.txt" with { type: "text" };
3
4
+
Deno.serve({ port: 8910 }, (req) => {
5
switch (new URL(req.url).pathname) {
6
case "/css":
7
return new Response(css, {
···
26
// type cast because no point validating for smthn like this
27
// real type has more info; not needed here
28
.then((res) => res.json() as Promise<{ repos: { did: string }[] }>)
29
+
.then((res) => {
30
+
console.log(res);
31
+
return res;
32
+
})
33
.then((res) =>
34
// get display name, handle, and did for each user
35
res.repos.map((repo) => ({
···
37
`http://pi:8000/xrpc/com.atproto.repo.getRecord?repo=${repo.did}&collection=app.bsky.actor.profile&rkey=self`
38
)
39
.then((res) => res.json())
40
+
.then((profile) => profile?.value?.displayName ?? repo),
41
// dont validate handles because I'm Lazy + trust myself
42
handle: fetch(
43
repo.did.startsWith("did:plc")