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

Configure Feed

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

Support did:web and warn on unsupported DIDs

+27 -8
+27 -8
apps/api/src/xrpc/app/rocksky/actor/getProfile.ts
··· 97 97 return Effect.tryPromise({ 98 98 try: async () => { 99 99 if (params.did) { 100 - return fetch(`https://plc.directory/${params.did}`) 101 - .then((res) => res.json()) 102 - .then((data) => ({ 103 - did, 104 - serviceEndpoint: _.get(data, "service.0.serviceEndpoint"), 105 - ctx, 106 - params, 107 - })); 100 + if (params.did.startsWith("did:plc:")) { 101 + return fetch(`https://plc.directory/${params.did}`) 102 + .then((res) => res.json()) 103 + .then((data) => ({ 104 + did, 105 + serviceEndpoint: _.get(data, "service.0.serviceEndpoint"), 106 + ctx, 107 + params, 108 + })); 109 + } 110 + 111 + if (params.did.startsWith("did:web:")) { 112 + return fetch( 113 + `https://${params.did.split("did:web:")[1]}/.well-known/did.json`, 114 + ) 115 + .then((res) => res.json()) 116 + .then((data) => ({ 117 + did, 118 + serviceEndpoint: _.get(data, "service.0.serviceEndpoint"), 119 + ctx, 120 + params, 121 + })); 122 + } 123 + 124 + consola.warn( 125 + `Unsupported DID method for ${params.did}, skipping service endpoint resolution.`, 126 + ); 108 127 } 109 128 return { 110 129 did,