feat: render some real content

This commit is contained in:
Julien Calixte
2026-02-11 03:12:52 +01:00
parent 95b4eb7c44
commit 683187b4d1
10 changed files with 131 additions and 90 deletions

View File

@@ -1,5 +1,22 @@
const correspondanceCache = new Map<string, string>()
export const getUniqueAka = async (did: string) => {
if (correspondanceCache.has(did)) {
return correspondanceCache.get(did) as string
}
const response = await fetch(`https://plc.directory/${did}`)
const {
alsoKnownAs: [aka],
} = await response.json()
const alias = aka.replace("at://", "")
correspondanceCache.set(did, alias)
return alias
}
export const getAka = async (dids: Set<string>) => {
const correspondance = await Promise.all(
[...dids].map(async (did) => {

View File

@@ -1,10 +1,24 @@
export const getUrl = async ({ did, rkey }: { did: string; rkey: string }) => {
const endpointCache = new Map<string, string>()
const getEndpoint = async (did: string) => {
if (endpointCache.has(did)) {
return endpointCache.get(did)
}
const response = await fetch(`https://plc.directory/${did}`)
const {
service: [{ serviceEndpoint }],
} = await response.json()
const url = new URL("/xrpc/com.atproto.repo.getRecord", serviceEndpoint)
endpointCache.set(did, serviceEndpoint)
return serviceEndpoint as string
}
export const getUrl = async ({ did, rkey }: { did: string; rkey: string }) => {
const url = new URL(
"/xrpc/com.atproto.repo.getRecord",
await getEndpoint(did),
)
url.searchParams.set("repo", did)
url.searchParams.set("collection", "space.litenote.note")
url.searchParams.set("rkey", rkey)