From bdd069907e1140d22c52ae90dab05e8504035a37 Mon Sep 17 00:00:00 2001 From: maelstrom Date: Sun, 3 May 2026 16:25:50 +0200 Subject: [PATCH] resolve profile errors --- src/lib/profile.ts | 16 ++++++++-------- src/lib/query/feed.ts | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lib/profile.ts b/src/lib/profile.ts index 216f0c5..e6b06bf 100644 --- a/src/lib/profile.ts +++ b/src/lib/profile.ts @@ -17,14 +17,14 @@ export async function resolveProfile(identifier: string) { if (profile === undefined) { console.log(`Resolving doc from slingshot: ${identifier}`) // TODO: Fix this - // const { did, handle, pds } = await Slingshot.call(blue.microcosm.identity.resolveMiniDoc, { - // identifier: identifier as AtIdentifierString - // }) - const response = await (await fetch(`https://plc.directory/${identifier}`)).json() - console.log(response) - const did = response.id - const pds = response.service[0].serviceEndpoint // This is not guaranteed to be a PDS, don't rely on it - const handle = response.alsoKnownAs[0].substring(5) + const { did, handle, pds } = await Slingshot.call(blue.microcosm.identity.resolveMiniDoc, { + identifier: identifier as AtIdentifierString + }) + // const response = await (await fetch(`https://plc.directory/${identifier}`)).json() + // console.log(response) + // const did = response.id + // const pds = response.service[0].serviceEndpoint // This is not guaranteed to be a PDS, don't rely on it + // const handle = response.alsoKnownAs[0].substring(5) profile = { did: did, handle: handle, diff --git a/src/lib/query/feed.ts b/src/lib/query/feed.ts index 5db9a90..8a7557a 100644 --- a/src/lib/query/feed.ts +++ b/src/lib/query/feed.ts @@ -46,14 +46,14 @@ export async function fetchPost(uri: AtUriString) { // collection: atUri.collection as any, // rkey: atUri.rkey, // }); - const pdsAgent = getAgent((await resolveProfile(atUri.did)).pds) + const pdsAgent = getAgent((await resolveProfile(atUri.did))!.pds) const { data: record } = await pdsAgent.com.atproto.repo.getRecord({ repo: atUri.did, collection: atUri.collection as any, rkey: atUri.rkey, }); - const authorProfile = await resolveProfile(atUri.did); + const authorProfile = (await resolveProfile(atUri.did))!; const post = parsePost( authorProfile, @@ -92,7 +92,7 @@ export async function fetchPostThread( // collection: atUri.collection as any, // rkey: atUri.rkey, // }); - const pdsAgent = getAgent((await resolveProfile(atUri.did)).pds) + const pdsAgent = getAgent((await resolveProfile(atUri.did))!.pds) const { data: record } = await pdsAgent.com.atproto.repo.getRecord({ repo: atUri.did, collection: atUri.collection as any, @@ -103,7 +103,7 @@ export async function fetchPostThread( const authorProfile = await getOrInsertAsync( profileCache, atUri.did, - async (did) => await resolveProfile(did), + async (did) => (await resolveProfile(did))!, ); const threadPost = { -- 2.51.2