fix: use user's relay list exclusively when logged in

When logged in:
- If user has relay list (kind:10002): use ONLY user relays + bunker + localhost
- If user has NO relay list: fall back to hardcoded RELAYS

This ensures the relay list changes when you log in based on your NIP-65 relay list.

Added debug logging to show user relay list, blocked relays, and final relay set.
This commit is contained in:
Gigi
2025-10-20 19:31:21 +02:00
parent 8c0a4cac16
commit 2e844fc26b

View File

@@ -621,6 +621,9 @@ function App() {
loadBlockedRelays(pool, pubkey)
])
console.log('[relay-init] User relay list (10002):', userRelayList.length, 'relays', userRelayList.map(r => r.url))
console.log('[relay-init] Blocked relays (10006):', blockedRelays.length, 'relays', blockedRelays)
// Get bunker relays if this is a nostr-connect account
let bunkerRelays: string[] = []
if (account.type === 'nostr-connect') {
@@ -628,15 +631,18 @@ function App() {
const signerData = nostrConnectAccount.toJSON().signer
bunkerRelays = signerData.relays || []
}
console.log('[relay-init] Bunker relays:', bunkerRelays.length, 'relays', bunkerRelays)
// Compute final relay set
// When logged in: use user's relays ONLY (not hardcoded)
// If user has no relay list, fall back to hardcoded relays
const finalRelays = computeRelaySet({
hardcoded: RELAYS,
hardcoded: userRelayList.length > 0 ? [] : RELAYS,
bunker: bunkerRelays,
userList: userRelayList,
blocked: blockedRelays,
alwaysIncludeLocal: ALWAYS_LOCAL_RELAYS
})
console.log('[relay-init] Final relay set:', finalRelays.length, 'relays', finalRelays)
// Apply to pool
applyRelaySetToPool(pool, finalRelays)