mirror of
https://github.com/dergigi/boris.git
synced 2025-12-24 01:54:19 +01:00
debug: add comprehensive logging for bunker reconnection and signing
- Add detailed logs for active account changes and bunker detection - Log signer status (listening, isConnected, hasRemote) - Log each step of reconnection process - Add signing attempt logs in highlightCreationService - This will help diagnose where the signing process hangs
This commit is contained in:
28
src/App.tsx
28
src/App.tsx
@@ -223,22 +223,42 @@ function App() {
|
|||||||
|
|
||||||
// Reconnect bunker signers when active account changes
|
// Reconnect bunker signers when active account changes
|
||||||
const bunkerReconnectSub = accounts.active$.subscribe(async (account) => {
|
const bunkerReconnectSub = accounts.active$.subscribe(async (account) => {
|
||||||
|
console.log('👤 Active account changed:', {
|
||||||
|
hasAccount: !!account,
|
||||||
|
type: account?.type,
|
||||||
|
id: account?.id
|
||||||
|
})
|
||||||
|
|
||||||
if (account && account.type === 'nostr-connect') {
|
if (account && account.type === 'nostr-connect') {
|
||||||
const nostrConnectAccount = account as Accounts.NostrConnectAccount<unknown>
|
const nostrConnectAccount = account as Accounts.NostrConnectAccount<unknown>
|
||||||
|
console.log('🔐 Bunker account detected. Status:', {
|
||||||
|
listening: nostrConnectAccount.signer.listening,
|
||||||
|
isConnected: nostrConnectAccount.signer.isConnected,
|
||||||
|
hasRemote: !!nostrConnectAccount.signer.remote
|
||||||
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Ensure the signer is listening for responses
|
// Ensure the signer is listening for responses
|
||||||
if (!nostrConnectAccount.signer.listening) {
|
if (!nostrConnectAccount.signer.listening) {
|
||||||
|
console.log('🔐 Opening bunker signer subscription...')
|
||||||
await nostrConnectAccount.signer.open()
|
await nostrConnectAccount.signer.open()
|
||||||
console.log('🔐 Opened bunker signer subscription')
|
console.log('✅ Bunker signer subscription opened')
|
||||||
|
} else {
|
||||||
|
console.log('✅ Bunker signer already listening')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reconnect with permissions if not already connected
|
// Reconnect with permissions if not already connected
|
||||||
if (!nostrConnectAccount.signer.isConnected) {
|
if (!nostrConnectAccount.signer.isConnected) {
|
||||||
await nostrConnectAccount.signer.connect(undefined, getDefaultBunkerPermissions())
|
console.log('🔐 Reconnecting bunker signer with permissions...')
|
||||||
console.log('🔐 Reconnected bunker signer with permissions')
|
const permissions = getDefaultBunkerPermissions()
|
||||||
|
console.log('🔐 Permissions:', permissions)
|
||||||
|
await nostrConnectAccount.signer.connect(undefined, permissions)
|
||||||
|
console.log('✅ Bunker signer reconnected successfully')
|
||||||
|
} else {
|
||||||
|
console.log('✅ Bunker signer already connected')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('⚠️ Failed to reconnect bunker signer:', error)
|
console.error('❌ Failed to reconnect bunker signer:', error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -116,7 +116,9 @@ export async function createHighlight(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sign the event
|
// Sign the event
|
||||||
|
console.log('🖊️ Signing highlight event...', { kind: highlightEvent.kind, tags: highlightEvent.tags.length })
|
||||||
const signedEvent = await factory.sign(highlightEvent)
|
const signedEvent = await factory.sign(highlightEvent)
|
||||||
|
console.log('✅ Highlight signed successfully!', { id: signedEvent.id.slice(0, 8) })
|
||||||
|
|
||||||
// Use unified write service to store and publish
|
// Use unified write service to store and publish
|
||||||
await publishEvent(relayPool, eventStore, signedEvent)
|
await publishEvent(relayPool, eventStore, signedEvent)
|
||||||
|
|||||||
Reference in New Issue
Block a user