Mass Block [bsky] Reposts [and more]
0
fork

Configure Feed

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

refactor: extract resolveToDid helper, drop noisy comments

Winter 604eadb1 ab143d56

+11 -12
+11 -12
index.js
··· 120 120 return input.includes("/profile/") && !input.includes("/post/"); 121 121 } 122 122 123 + async function resolveToDid(handleOrDid) { 124 + if (handleOrDid.startsWith("did:")) return handleOrDid; 125 + return resolveHandle(handleOrDid); 126 + } 127 + 123 128 async function resolveProfileTarget(input) { 124 129 const match = input.match(/\/profile\/([^/?#]+)/); 125 130 if (!match) throw new Error(`can't parse profile URL: ${input}`); 126 - const handleOrDid = match[1]; 127 - if (handleOrDid.startsWith("did:")) return handleOrDid; 128 - return resolveHandle(handleOrDid); 131 + return resolveToDid(match[1]); 129 132 } 130 133 131 134 // ── URL/URI parsing ───────────────────────────────────────────────── ··· 140 143 } 141 144 142 145 const [, handleOrDid, rkey] = urlMatch; 143 - let did = handleOrDid; 144 - if (!handleOrDid.startsWith("did:")) { 145 - did = await resolveHandle(handleOrDid); 146 - } 147 - 146 + const did = await resolveToDid(handleOrDid); 148 147 return `at://${did}/app.bsky.feed.post/${rkey}`; 149 148 } 150 149 ··· 540 539 if (mode === "profile") { 541 540 // target is a DID 542 541 if (categories.has("followers")) { 543 - fetchers.push(fetchFollowers(target).then((d) => { results.followers = [...d]; /* Set->Array */ })); 542 + fetchers.push(fetchFollowers(target).then((d) => { results.followers = [...d]; })); 544 543 } 545 544 if (categories.has("following")) { 546 545 fetchers.push( 547 546 resolvePds(target).then((pdsUrl) => 548 - fetchFollowing(target, pdsUrl).then((d) => { results.following = [...d]; /* Set->Array */ }) 547 + fetchFollowing(target, pdsUrl).then((d) => { results.following = [...d]; }) 549 548 ) 550 549 ); 551 550 } ··· 562 561 } 563 562 if (categories.has("followers")) { 564 563 const authorDid = extractAuthorDid(target); 565 - fetchers.push(fetchFollowers(authorDid).then((d) => { results.followers = [...d]; /* Set->Array */ })); 564 + fetchers.push(fetchFollowers(authorDid).then((d) => { results.followers = [...d]; })); 566 565 } 567 566 fetchers.push(fetchQuotePosters(target).then((d) => { results.quotePosters = d; })); 568 567 } ··· 578 577 for (const d of src) allCandidates.add(d); 579 578 } 580 579 581 - const quotePosters = new Set(results.quotePosters); // empty in profile mode, no-op 580 + const quotePosters = new Set(results.quotePosters); 582 581 const followedInBlockList = []; 583 582 const toBlock = []; 584 583 let skippedSelf = 0, skippedQuote = 0, skippedFollow = 0, skippedFollower = 0, skippedAlreadyBlocked = 0;