this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(registry): restore switcher avatar fallback

Resolve remembered-account avatars from user profile rows as well as project registry rows so the account switcher keeps showing avatars after CDN redirects.

Made-with: Cursor

+5 -2
+5 -2
routes/api/registry/avatar/[did].ts
··· 3 3 * the Bluesky CDN directly; this route redirects existing consumers there. 4 4 */ 5 5 import { define } from "../../../../utils.ts"; 6 + import { getAppUser } from "../../../../lib/account-types.ts"; 6 7 import { bskyCdnAvatarUrl } from "../../../../lib/avatar.ts"; 7 8 import { getProfileByDid } from "../../../../lib/registry.ts"; 8 9 import { withRateLimit } from "../../../../lib/rate-limit.ts"; ··· 11 12 GET: withRateLimit(async (ctx) => { 12 13 const did = decodeURIComponent(ctx.params.did); 13 14 const profile = await getProfileByDid(did).catch(() => null); 14 - if (!profile || !profile.avatarCid) { 15 + const avatarCid = profile?.avatarCid ?? 16 + (await getAppUser(did).catch(() => null))?.avatarCid; 17 + if (!avatarCid) { 15 18 return new Response("not found", { status: 404 }); 16 19 } 17 20 return new Response(null, { 18 21 status: 302, 19 22 headers: { 20 - location: bskyCdnAvatarUrl(did, profile.avatarCid), 23 + location: bskyCdnAvatarUrl(did, avatarCid), 21 24 "cache-control": 22 25 "public, max-age=300, s-maxage=3600, stale-while-revalidate=3600", 23 26 },