This repository has no description
0

Configure Feed

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

fix

+42 -21
+42 -21
src/components/Verifier/Verifier.js
··· 328 328 const initialStatuses = {}; 329 329 TRUSTED_VERIFIERS.forEach(id => { initialStatuses[id] = 'checking'; }); 330 330 setOfficialVerifiersStatus(initialStatuses); 331 - const publicAgent = new Agent({ service: 'https://public.api.bsky.app' }); 331 + // No need for publicAgent instance here 332 + // const publicAgent = new Agent({ service: 'https://public.api.bsky.app' }); 332 333 333 334 await Promise.all(TRUSTED_VERIFIERS.map(async (verifierIdentifier) => { 334 335 let verifierDid = null; 335 336 let verifierHandle = verifierIdentifier; 336 337 let currentStatus = 'checking'; 337 338 try { 339 + // Resolve handle using direct fetch if necessary 338 340 if (!verifierIdentifier.startsWith('did:')) { 339 - const resolveResult = await publicAgent.api.com.atproto.identity.resolveHandle({ handle: verifierIdentifier }); 340 - verifierDid = resolveResult.data.did; 341 + const resolveUrl = `https://public.api.bsky.app/xrpc/com.atproto.identity.resolveHandle?handle=${encodeURIComponent(verifierIdentifier)}`; 342 + const resolveResponse = await fetch(resolveUrl); 343 + if (!resolveResponse.ok) throw new Error(`Resolve handle failed: ${resolveResponse.status}`); 344 + const resolveData = await resolveResponse.json(); 345 + verifierDid = resolveData.did; 341 346 } else { 342 347 verifierDid = verifierIdentifier; 348 + // Optionally fetch profile handle for display using direct fetch 343 349 try { 344 - const profileRes = await publicAgent.api.app.bsky.actor.getProfile({ actor: verifierDid }); 345 - verifierHandle = profileRes.data.handle; 350 + const profileUrl = `https://public.api.bsky.app/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(verifierDid)}`; 351 + const profileResponse = await fetch(profileUrl); 352 + if (profileResponse.ok) { 353 + const profileData = await profileResponse.json(); 354 + verifierHandle = profileData.handle; 355 + } 346 356 } catch { /* ignore */ } 347 357 } 358 + 348 359 if (!verifierDid) throw new Error('Could not resolve identifier'); 349 360 const pdsEndpoint = await getPdsEndpoint(verifierDid); 350 361 if (!pdsEndpoint) throw new Error('Could not find PDS'); 351 362 352 363 let listRecordsCursor = undefined; 353 364 let foundMatch = false; 354 - const tempPublicAgent = new Agent({ service: pdsEndpoint }); 355 - 365 + // No agent needed here, use fetch 356 366 do { 357 367 try { 358 - const response = await tempPublicAgent.api.com.atproto.repo.listRecords({ 359 - repo: verifierDid, 360 - collection: 'app.bsky.graph.verification', 361 - limit: 100, 362 - cursor: listRecordsCursor 363 - }); 364 - const records = response.data.records || []; 368 + const listParams = new URLSearchParams({ repo: verifierDid, collection: 'app.bsky.graph.verification', limit: '100' }); 369 + if (listRecordsCursor) listParams.set('cursor', listRecordsCursor); 370 + // *** Use direct fetch for listRecords *** 371 + const listRecordsUrl = `${pdsEndpoint}/xrpc/com.atproto.repo.listRecords?${listParams.toString()}`; 372 + const listResponse = await fetch(listRecordsUrl); 373 + 374 + if (!listResponse.ok) { 375 + if (listResponse.status !== 400) { 376 + console.warn(`Failed fetch for ${verifierHandle}: ${listResponse.status}`); 377 + throw new Error(`Fetch failed with status ${listResponse.status}`); 378 + } 379 + break; // Stop on 400 or other errors 380 + } 381 + 382 + const listData = await listResponse.json(); 383 + const records = listData.records || []; 365 384 const matchingRecord = records.find(record => record.value?.subject === session.did); 366 385 if (matchingRecord) { 367 386 currentStatus = 'verified'; 368 387 foundMatch = true; 369 388 break; 370 389 } 371 - listRecordsCursor = response.data.cursor; 390 + listRecordsCursor = listData.cursor; 372 391 } catch (err) { 373 392 console.warn(`Could not listRecords for ${verifierDid} on ${pdsEndpoint}:`, err.message); 374 393 listRecordsCursor = undefined; ··· 400 419 } 401 420 setIsFetchingSuggestions(true); 402 421 try { 403 - const publicAgent = new Agent({ service: 'https://public.api.bsky.app' }); 404 - const response = await publicAgent.api.app.bsky.actor.searchActorsTypeahead({ 405 - q: query, 406 - limit: 5 407 - }); 408 - setSuggestions(response.data.actors || []); 422 + // *** Use direct fetch *** 423 + const url = new URL('https://public.api.bsky.app/xrpc/app.bsky.actor.searchActorsTypeahead'); 424 + url.searchParams.append('q', query); 425 + url.searchParams.append('limit', '5'); 426 + const response = await fetch(url.toString()); 427 + if (!response.ok) throw new Error(`Suggestions fetch failed: ${response.status}`); 428 + const data = await response.json(); 429 + setSuggestions(data.actors || []); 409 430 } catch (error) { 410 431 console.error('Failed to fetch suggestions:', error); 411 432 setSuggestions([]);