···
287
287
setNetworkStatusMessage("Fetching network lists (mutuals, follows)...");
288
288
289
289
try {
290
290
-
console.log("checkNetworkVerifications: Fetching follows (public) and mutuals (authenticated)...");
290
290
+
console.log("checkNetworkVerifications: Fetching follows (public) and attempting direct getKnownFollowers...");
291
291
292
292
-
// *** Fetch follows using direct fetch ***
292
292
+
// Fetch follows using direct fetch
293
293
const followsUrl = `https://public.api.bsky.app/xrpc/app.bsky.graph.getFollows`;
294
294
const followsParams = { actor: session.did, limit: 100 };
295
295
+
const follows = await fetchAllPaginated(null, null, followsParams, true, followsUrl);
295
296
296
296
-
// *** Fetch known followers using authenticated agent ***
297
297
-
const knownFollowersMethod = agent.api.app.bsky.graph.getKnownFollowers.bind(agent.api.app.bsky.graph);
298
298
-
const knownFollowersParams = { actor: session.did, limit: 100 };
297
297
+
// *** Fetch Known Followers Directly (First Page Only for Test) ***
298
298
+
let mutuals = [];
299
299
+
try {
300
300
+
const knownFollowersResponse = await agent.api.app.bsky.graph.getKnownFollowers({
301
301
+
actor: session.did,
302
302
+
limit: 100 // Fetch first page
303
303
+
});
304
304
+
if (knownFollowersResponse?.data?.followers) {
305
305
+
mutuals = knownFollowersResponse.data.followers;
306
306
+
console.log(`Direct getKnownFollowers call successful, got ${mutuals.length} mutuals.`);
307
307
+
} else {
308
308
+
console.warn("Direct getKnownFollowers call returned unexpected structure:", knownFollowersResponse);
309
309
+
}
310
310
+
} catch (knownFollowersError) {
311
311
+
console.error("Direct getKnownFollowers call failed:", knownFollowersError);
312
312
+
// Set status message to indicate failure for this part
313
313
+
setNetworkStatusMessage("Failed to fetch mutuals/known followers.");
314
314
+
// Optionally, proceed without mutuals or stop the check
315
315
+
// For now, let's continue with just follows if mutuals failed
316
316
+
}
299
317
300
300
-
const [follows, mutuals] = await Promise.all([
301
301
-
fetchAllPaginated(null, null, followsParams, true, followsUrl),
302
302
-
fetchAllPaginated(agent, knownFollowersMethod, knownFollowersParams)
303
303
-
]);
318
318
+
// Now mutuals contains only the first page, or is empty on error.
319
319
+
// The rest of the logic will proceed, but mutuals data might be incomplete or missing.
304
320
305
305
-
console.log(`checkNetworkVerifications: Fetched ${follows.length} follows, ${mutuals.length} mutuals.`);
306
306
-
setNetworkStatusMessage(`Processing ${follows.length} follows and ${mutuals.length} mutuals...`);
321
321
+
console.log(`checkNetworkVerifications: Fetched ${follows.length} follows, ${mutuals.length} known followers (first page).`);
322
322
+
setNetworkStatusMessage(`Processing ${follows.length} follows and ${mutuals.length} known followers...`);
307
323
setNetworkVerifications(prev => ({ ...prev, fetchedMutualsCount: mutuals.length, fetchedFollowsCount: follows.length }));
308
324
309
325
const followsSet = new Set(follows.map(f => f.did));