diff --git a/src/composables/useNostrChat.ts b/src/composables/useNostrChat.ts index 7df01d9..c0e1861 100644 --- a/src/composables/useNostrChat.ts +++ b/src/composables/useNostrChat.ts @@ -1,7 +1,7 @@ import { ref, computed, readonly } from 'vue' -import { nip04, finalizeEvent, type EventTemplate, generateSecretKey, getPublicKey } from 'nostr-tools' -import { hexToBytes, bytesToHex } from '@/lib/utils/crypto' +import { nip04, finalizeEvent, type EventTemplate } from 'nostr-tools' +import { hexToBytes } from '@/lib/utils/crypto' import { getAuthToken } from '@/lib/config/lnbits' import { config } from '@/lib/config' import { useRelayHub } from './useRelayHub' @@ -516,52 +516,7 @@ export function useNostrChat() { return unsubscribe } - // Load historical messages for a peer - const loadHistoricalMessages = async (peerPubkey: string, myPubkey: string) => { - console.log('Loading historical messages for peer:', peerPubkey) - console.log('My pubkey:', myPubkey) - - const relayConfigs = getRelays() - console.log('Using relays:', relayConfigs.map(r => r.url)) - - const filters = [ - { - kinds: [4], - authors: [peerPubkey], - '#p': [myPubkey] - }, - { - kinds: [4], - authors: [myPubkey], - '#p': [peerPubkey] - } - ] - - console.log('Historical query filters:', filters) - - const unsubscribe = relayHub.subscribe({ - id: `historical-${peerPubkey}-${Date.now()}`, - filters, - relays: relayConfigs.map(r => r.url), - onEvent: (event: any) => { - console.log('Received historical event:', { - id: event.id, - author: event.pubkey, - isSentByMe: event.pubkey === myPubkey, - contentLength: event.content.length - }) - handleIncomingMessage(event, peerPubkey) - }, - onEose: () => { - console.log('Historical query completed for peer:', peerPubkey) - } - }) - // Wait a bit for historical messages to load - await new Promise(resolve => setTimeout(resolve, 3000)) - unsubscribe() - console.log('Historical query closed for peer:', peerPubkey) - } // Handle incoming message const handleIncomingMessage = async (event: any, peerPubkey: string) => {