From eb282fcbb0a0de5e8a587dce53c8f4451ada519b Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 2 Oct 2025 20:38:46 +0200 Subject: [PATCH] fix: fix hidden bookmark detection by using applesauce's built-in logic - Remove custom isEncryptedContent function that was too restrictive - Use applesauce's hasHiddenContent() and hasHiddenTags() functions instead - These properly detect encrypted content regardless of format - Remove failing relay.snort.social from relay list - Add detailed logging to show hidden content detection status --- src/App.tsx | 1 - src/services/bookmarkService.ts | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index e2101dc1..d8a6e593 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -22,7 +22,6 @@ function App() { const relayUrls = [ 'wss://relay.damus.io', 'wss://nos.lol', - 'wss://relay.snort.social', 'wss://relay.nostr.band', 'wss://relay.dergigi.com', 'wss://wot.dergigi.com' diff --git a/src/services/bookmarkService.ts b/src/services/bookmarkService.ts index 4ff8bf11..b09c5c2d 100644 --- a/src/services/bookmarkService.ts +++ b/src/services/bookmarkService.ts @@ -25,12 +25,8 @@ function isAccountWithExtension(account: unknown): account is AccountWithExtensi return typeof account === 'object' && account !== null && 'pubkey' in account && typeof (account as any).pubkey === 'string' } -function isEncryptedContent(content: string | undefined): boolean { - if (!content) return false - return ( - content.startsWith('nip44:') || content.startsWith('nip04:') || content.includes('?iv=') || content.includes('?version=') - ) -} +// Note: Using applesauce's built-in hidden content detection instead of custom logic +// Encrypted content detection is handled by applesauce's hasHiddenContent() function function isHexId(id: unknown): id is string { return typeof id === 'string' && /^[0-9a-f]{64}$/i.test(id) @@ -186,11 +182,12 @@ export const fetchBookmarks = async ( contentLength: evt.content?.length || 0, contentPreview: evt.content?.slice(0, 50) + (evt.content?.length > 50 ? '...' : ''), tagsCount: evt.tags?.length || 0, - isEncrypted: isEncryptedContent(evt.content) + hasHiddenContent: Helpers.hasHiddenContent(evt), + canHaveHiddenTags: Helpers.canHaveHiddenTags(evt.kind) }) newestCreatedAt = Math.max(newestCreatedAt, evt.created_at || 0) - if (!latestContent && evt.content && !isEncryptedContent(evt.content)) latestContent = evt.content + if (!latestContent && evt.content && !Helpers.hasHiddenContent(evt)) latestContent = evt.content if (Array.isArray(evt.tags)) allTags = allTags.concat(evt.tags) // public const pub = Helpers.getPublicBookmarks(evt) @@ -201,6 +198,7 @@ export const fetchBookmarks = async ( console.log('🔒 Hidden tags locked:', Helpers.isHiddenTagsLocked(evt)) console.log('🔒 Signer candidate available:', !!signerCandidate) console.log('🔒 Signer candidate type:', typeof signerCandidate) + console.log('🔒 Event kind supports hidden tags:', Helpers.canHaveHiddenTags(evt.kind)) if (Helpers.hasHiddenTags(evt) && Helpers.isHiddenTagsLocked(evt) && signerCandidate) { try {