the home of serif.blue
5
fork

Configure Feed

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

feat: fetch all data not just first 50

+37 -6
+37 -6
bluesky-community-verifications.user.js
··· 60 60 // Use Promise.all to fetch all verification data in parallel 61 61 const verificationPromises = trustedUsers.map(async (trustedUser) => { 62 62 try { 63 - const response = await fetch( 64 - `https://bsky.social/xrpc/com.atproto.repo.listRecords?repo=${trustedUser}&collection=app.bsky.graph.verification`, 65 - ); 66 - const data = await response.json(); 63 + // Helper function to fetch all verification records with pagination 64 + const fetchAllVerifications = async (user) => { 65 + let allRecords = []; 66 + let cursor = null; 67 + let hasMore = true; 68 + 69 + while (hasMore) { 70 + const url = cursor 71 + ? `https://bsky.social/xrpc/com.atproto.repo.listRecords?repo=${user}&collection=app.bsky.graph.verification&cursor=${cursor}` 72 + : `https://bsky.social/xrpc/com.atproto.repo.listRecords?repo=${user}&collection=app.bsky.graph.verification`; 73 + 74 + const response = await fetch(url); 75 + const data = await response.json(); 76 + 77 + if (data.records && data.records.length > 0) { 78 + allRecords = [...allRecords, ...data.records]; 79 + } 80 + 81 + if (data.cursor) { 82 + cursor = data.cursor; 83 + } else { 84 + hasMore = false; 85 + } 86 + } 87 + 88 + return allRecords; 89 + }; 90 + 91 + // Fetch all verification records for this trusted user 92 + const records = await fetchAllVerifications(trustedUser); 93 + 94 + console.log(`Received verification data from ${trustedUser}`, { 95 + records, 96 + }); 67 97 68 98 // Check if this trusted user has verified the current profile 69 - if (data.records && data.records.length > 0) { 70 - for (const record of data.records) { 99 + if (records.length > 0) { 100 + for (const record of records) { 71 101 if (record.value && record.value.subject === profileDid) { 72 102 console.log( 73 103 `${profileDid} is verified by trusted user ${trustedUser}`, ··· 75 105 76 106 // Add to verifiers list 77 107 profileVerifiers.push(trustedUser); 108 + break; // Once we find a verification, we can stop checking 78 109 } 79 110 } 80 111 }