A decentralized music tracking and discovery platform built on AT Protocol 🎵
0
fork

Configure Feed

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

Resolve PDS URL and repo from DID

Call extractPdsFromDid(repo) to obtain the PDS base URL and pass it to
AtpAgent instead of using the hardcoded https://bsky.social. Compute the
repo once from trackWithUri.uri and reuse it for getRecord.

+9 -2
+9 -2
apps/api/src/lovedtracks/lovedtracks.service.ts
··· 13 13 import artists from "../schema/artists"; 14 14 import lovedTracks from "../schema/loved-tracks"; 15 15 import tracks from "../schema/tracks"; 16 + import extractPdsFromDid from "lib/extractPdsFromDid"; 16 17 17 18 export async function likeTrack( 18 19 ctx: Context, ··· 248 249 249 250 if (trackWithUri?.uri) { 250 251 const rkey = TID.nextStr(); 252 + const repo = trackWithUri.uri 253 + .split("/") 254 + .slice(0, 3) 255 + .join("/") 256 + .split("at://")[1]; 257 + const pds = await extractPdsFromDid(repo); 251 258 const subjectAgent = new AtpAgent({ 252 - service: new URL("https://bsky.social"), 259 + service: new URL(pds), 253 260 }); 254 261 const subjectRecord = await subjectAgent.com.atproto.repo.getRecord({ 255 - repo: trackWithUri.uri.split("/").slice(0, 3).join("/").split("at://")[1], 262 + repo, 256 263 collection: "app.rocksky.song", 257 264 rkey: trackWithUri.uri.split("/").pop(), 258 265 });