debug(bunker): log signer publish/subscribe calls and relay connectivity

- Wrap NostrConnectSigner publish/subscription to log relays and filters
- Log relayPool connectivity snapshot before bookmark decryption
- Helps diagnose decrypt requests not reaching Amber
This commit is contained in:
Gigi
2025-10-17 00:17:00 +02:00
parent 53400334b2
commit ec45fbc5e8
2 changed files with 21 additions and 1 deletions

View File

@@ -301,6 +301,19 @@ function App() {
// Replace the signer on the account
nostrConnectAccount.signer = recreatedSigner
console.log('[bunker] ✅ Signer recreated with pool context')
// Debug: log publish/subscription calls made by signer (decrypt/sign requests)
const originalPublish = (recreatedSigner as any).publishMethod
;(recreatedSigner as any).publishMethod = (relays: string[], event: any) => {
try { console.log('[bunker] publish via signer:', { relays, kind: event?.kind, tags: event?.tags?.length }) } catch {}
return originalPublish(relays, event)
}
const originalSubscribe = (recreatedSigner as any).subscriptionMethod
;(recreatedSigner as any).subscriptionMethod = (relays: string[], filters: any[]) => {
try { console.log('[bunker] subscribe via signer:', { relays, filters }) } catch {}
return originalSubscribe(relays, filters)
}
// Just ensure the signer is listening for responses - don't call connect() again
// The fromBunkerURI already connected with permissions during login

View File

@@ -107,7 +107,14 @@ export const fetchBookmarks = async (
console.log('[bunker] 🔑 Signer has nip04:', hasNip04Decrypt(signerCandidate))
console.log('[bunker] 🔑 Signer has nip44:', hasNip44Decrypt(signerCandidate))
}
const { publicItemsAll, privateItemsAll, newestCreatedAt, latestContent, allTags } = await collectBookmarksFromEvents(
// Debug relay connectivity for bunker relays
try {
const urls = Array.from(relayPool.relays.values()).map(r => ({ url: r.url, connected: (r as any).connected }))
console.log('[bunker] Relay connections:', urls)
} catch {}
const { publicItemsAll, privateItemsAll, newestCreatedAt, latestContent, allTags } = await collectBookmarksFromEvents(
bookmarkListEvents,
activeAccount,
signerCandidate