Hopefully made it show profiles without profile

This commit is contained in:
Casey 2025-05-12 21:53:58 +03:00
parent 67af67ef49
commit cda82035d9
No known key found for this signature in database

View file

@ -133,6 +133,13 @@ const getAccountMetadata = async (
did: `did:${string}:${string}`,
) => {
// gonna assume self exists in the app.bsky.actor.profile
const account: AccountMetadata = {
did: did,
handle: "",
displayName: "",
avatarCid: null,
};
try {
const { data } = await rpc.get("com.atproto.repo.getRecord", {
params: {
@ -142,21 +149,22 @@ const getAccountMetadata = async (
},
});
const value = data.value as AppBskyActorProfile.Record;
const handle = await blueskyHandleFromDid(did);
const account: AccountMetadata = {
did: did,
handle: handle,
displayName: value.displayName || "",
avatarCid: null,
};
account.displayName = value.displayName || "";
if (value.avatar) {
account.avatarCid = value.avatar.ref["$link"];
}
return account;
} catch (e) {
console.error(`Error fetching metadata for ${did}:`, e);
console.warn(`Error fetching profile for ${did}:`, e);
}
try {
account.handle = await blueskyHandleFromDid(did);
} catch (e) {
console.error(`Error fetching handle for ${did}:`, e);
return null;
}
return account;
};
const getAllMetadataFromPds = async (): Promise<AccountMetadata[]> => {