feat: ensure purplepag.es relay is used for profile lookups

Add logic to check if purplepag.es is in the active relay pool when fetching
profiles. If not, add it temporarily to ensure we query this relay for
profile metadata. This should help find profiles that might not be available
on other relays.

Also adds debug logging to show which active relays are being queried.
This commit is contained in:
Gigi
2025-11-02 21:41:03 +01:00
parent c1877a40e9
commit 5ce13c667d

View File

@@ -231,6 +231,20 @@ export const fetchProfiles = async (
const { local: localRelays, remote: remoteRelays } = partitionRelays(prioritized)
console.log(`[fetch-profiles] Querying ${localRelays.length} local relays and ${remoteRelays.length} remote relays`)
console.log(`[fetch-profiles] Active relays:`, relayUrls)
const hasPurplePages = relayUrls.some(url => url.includes('purplepag.es'))
if (!hasPurplePages) {
console.warn(`[fetch-profiles] purplepag.es not in active relay pool, adding it temporarily`)
// Add purplepag.es if it's not in the pool (it might not have connected yet)
const purplePagesUrl = 'wss://purplepag.es'
if (!relayPool.relays.has(purplePagesUrl)) {
relayPool.group([purplePagesUrl])
}
// Ensure it's included in the remote relays for this fetch
if (!remoteRelays.includes(purplePagesUrl)) {
remoteRelays.push(purplePagesUrl)
}
}
let eventCount = 0
const fetchedPubkeys = new Set<string>()