feat: Enhance Nostr chat functionality and debugging

- Improve console logging in ChatComponent and useNostrChat for better tracking of message sending, user authentication, and key management.
- Update user authentication checks to ensure valid Nostr keypairs are available before sending messages.
- Refactor message handling logic to streamline subscription and processing of incoming messages, enhancing overall chat experience.
This commit is contained in:
padreug 2025-08-10 12:35:47 +02:00
parent 8e94216c02
commit 390f77539e
3 changed files with 108 additions and 194 deletions

View file

@ -541,15 +541,16 @@ const sendMessage = async () => {
console.log('🔍 ChatComponent: Attempting to send message...')
console.log('🔍 ChatComponent: Selected peer:', selectedPeer.value)
console.log('🔍 ChatComponent: Message content:', messageInput.value)
// Check authentication status
const keyStatus = nostrChat.getNostrKeyStatus()
console.log('🔍 ChatComponent: Nostr key status:', keyStatus)
// Check if user is logged in
console.log('🔍 ChatComponent: Is logged in:', nostrChat.isLoggedIn.value)
console.log('🔍 ChatComponent: Is authenticated:', nostrChat.isLoggedIn.value)
console.log('🔍 ChatComponent: Current user:', nostrChat.currentUser.value)
console.log('🔍 ChatComponent: Has Nostr keys:', nostrChat.hasNostrKeys.value)
await sendNostrMessage(selectedPeer.value.pubkey, messageInput.value)
messageInput.value = ''