diff --git a/src/lib/atproto/methods.ts b/src/lib/atproto/methods.ts index 2b92187..abbbc05 100644 --- a/src/lib/atproto/methods.ts +++ b/src/lib/atproto/methods.ts @@ -93,7 +93,11 @@ export async function getDetailedProfile(data?: { did?: Did; client?: Client }) params: { actor: data.did } }); - if (!response.ok) return; + if (!response.ok || response.data.handle === 'handle.invalid') { + // fall back to describe repo + const repo = await describeRepo({ did: data.did, client: data.client }); + return { handle: repo?.handle ?? 'handle.invalid', did: data.did }; + } return response.data; } diff --git a/src/lib/cards/SpecialCards/UpdatedBlentos/index.ts b/src/lib/cards/SpecialCards/UpdatedBlentos/index.ts index a935ce3..6615ecc 100644 --- a/src/lib/cards/SpecialCards/UpdatedBlentos/index.ts +++ b/src/lib/cards/SpecialCards/UpdatedBlentos/index.ts @@ -30,7 +30,15 @@ export const UpdatedBlentosCardDefitition = { for (const did of Array.from(uniqueDids)) { const profile = getDetailedProfile({ did }); profiles.push(profile); - if (profiles.length > 20) break; + if (profiles.length > 30) break; + } + + for (let i = existingUsersArray.length - 1; i >= 0; i--) { + // if handle is handle.invalid, remove from existing users and add to profiles to refresh + if (existingUsersArray[i].handle === 'handle.invalid') { + const removed = existingUsersArray.splice(i, 1)[0]; + profiles.push(getDetailedProfile({ did: removed.did })); + } } const result = [...(await Promise.all(profiles)), ...existingUsersArray];