···101 return response.data;
102}
103000000000000000000000000000000104/**
105 * Creates an AT Protocol client for a user's PDS.
106 * @param did - The DID of the user
···370 };
371 };
372}) {
0373 did ??= user.did;
374375 return `https://cdn.bsky.app/img/feed_thumbnail/plain/${did}/${blob.ref.$link}@webp`;
···101 return response.data;
102}
103104+export async function getBlentoOrBskyProfile(data: { did: Did; client?: Client }): Promise<
105+ Awaited<ReturnType<typeof getDetailedProfile>> & {
106+ hasBlento: boolean;
107+ }
108+> {
109+ let blentoProfile;
110+ try {
111+ // try getting blento profile first
112+ blentoProfile = await getRecord({
113+ collection: 'site.standard.publication',
114+ did: data?.did,
115+ rkey: 'blento.self',
116+ client: data?.client
117+ });
118+ } catch {
119+ console.error('error getting blento profile, falling back to bsky profile');
120+ }
121+122+ const response = await getDetailedProfile(data);
123+124+ return {
125+ did: data.did,
126+ handle: response?.handle,
127+ displayName: blentoProfile?.value?.name || response?.displayName || response?.handle,
128+ avatar: (getCDNImageBlobUrl({ did: data?.did, blob: blentoProfile?.value?.icon }) ||
129+ response?.avatar) as `${string}:${string}`,
130+ hasBlento: Boolean(blentoProfile.value)
131+ };
132+}
133+134/**
135 * Creates an AT Protocol client for a user's PDS.
136 * @param did - The DID of the user
···400 };
401 };
402}) {
403+ if (!blob || !did) return;
404 did ??= user.did;
405406 return `https://cdn.bsky.app/img/feed_thumbnail/plain/${did}/${blob.ref.$link}@webp`;