A decentralized music tracking and discovery platform built on AT Protocol 🎵 rocksky.app
spotify atproto lastfm musicbrainz scrobbling listenbrainz

refactor: fix formatting issues and improve error handling in avatar script

+3 -3
+3 -3
apps/api/src/scripts/avatar.ts
··· 18 18 } 19 19 20 20 const plc = await fetch(`https://plc.directory/${user.did}`).then((res) => 21 - res.json(), 21 + res.json() 22 22 ); 23 23 24 24 const serviceEndpoint = _.get(plc, "service.0.serviceEndpoint"); ··· 28 28 } 29 29 30 30 const profile = await fetch( 31 - `${serviceEndpoint}/xrpc/com.atproto.repo.getRecord?repo=${user.did}&collection=app.bsky.actor.profile&rkey=self`, 31 + `${serviceEndpoint}/xrpc/com.atproto.repo.getRecord?repo=${user.did}&collection=app.bsky.actor.profile&rkey=self` 32 32 ).then((res) => res.json()); 33 33 const ref = _.get(profile, "value.avatar.ref.$link"); 34 - const type = _.get(profile, "value.avatar.mimeType").split("/")[1]; 34 + const type = _.get(profile, "value.avatar.mimeType", "").split("/")[1]; 35 35 await ctx.db 36 36 .update(users) 37 37 .set({