diff --git a/src/modules/atproto/getAka.ts b/src/modules/atproto/getAka.ts index 7c92769..e83ce5d 100644 --- a/src/modules/atproto/getAka.ts +++ b/src/modules/atproto/getAka.ts @@ -1,7 +1,9 @@ -type Author = { alias: string; endpoint: string } +export type Author = { alias: string; endpoint: string } const correspondanceCache = new Map() +console.log({ correspondanceCache }) + export const getUniqueAka = async (did: string): Promise => { if (correspondanceCache.has(did)) { return correspondanceCache.get(did) as Author @@ -25,19 +27,21 @@ export const getAka = async (dids: Set) => { const correspondance = await Promise.all( [...dids].map(async (did) => { if (correspondanceCache.has(did)) { - return [did, correspondanceCache.get(did)?.alias] as [string, string] + return [did, correspondanceCache.get(did)] as [string, Author] } const response = await fetch(`https://plc.directory/${did}`) const { alsoKnownAs: [aka], + service: [{ serviceEndpoint }], } = await response.json() const alias = aka.replace("at://", "") + const author = { alias, endpoint: serviceEndpoint } - correspondanceCache.set(did, alias) + correspondanceCache.set(did, author) - return [did, alias] as [string, string] + return [did, author] as [string, Author] }), ) diff --git a/src/views/PublicNoteListView.vue b/src/views/PublicNoteListView.vue index e5a1f1a..88e5769 100644 --- a/src/views/PublicNoteListView.vue +++ b/src/views/PublicNoteListView.vue @@ -1,5 +1,5 @@