mirror of
https://github.com/dergigi/boris.git
synced 2025-12-17 06:34:24 +01:00
feat: add debugging for private bookmark decryption
- Added detailed logging to understand why getHiddenBookmarks returns undefined - Check bookmark list content and encryption format - Verify account has decryption capabilities - Pass full account object with extension capabilities to applesauce helpers - This will help diagnose the NIP-44 vs NIP-04 encryption issue
This commit is contained in:
@@ -16,6 +16,7 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
|
||||
const [bookmarks, setBookmarks] = useState<Bookmark[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const activeAccount = Hooks.useActiveAccount()
|
||||
const accountManager = Hooks.useAccountManager()
|
||||
|
||||
// Use ProfileModel to get user profile information
|
||||
const profile = useEventModel(Models.ProfileModel, activeAccount ? [activeAccount.pubkey] : null)
|
||||
@@ -45,7 +46,9 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
|
||||
setLoading(false)
|
||||
}, 15000) // 15 second timeout
|
||||
|
||||
await fetchBookmarks(relayPool, activeAccount, setBookmarks, setLoading, timeoutId)
|
||||
// Get the full account object with extension capabilities
|
||||
const fullAccount = accountManager.getActive()
|
||||
await fetchBookmarks(relayPool, fullAccount || activeAccount, setBookmarks, setLoading, timeoutId)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ interface ApplesauceBookmarks {
|
||||
urls?: BookmarkData[]
|
||||
}
|
||||
|
||||
interface AccountWithExtension {
|
||||
pubkey: string
|
||||
[key: string]: unknown // Allow other properties from the full account object
|
||||
}
|
||||
|
||||
|
||||
const processBookmarks = (
|
||||
bookmarks: unknown,
|
||||
activeAccount: ActiveAccount,
|
||||
@@ -75,9 +81,10 @@ const processApplesauceBookmarks = (
|
||||
return processBookmarks(bookmarks, activeAccount, isPrivate)
|
||||
}
|
||||
|
||||
|
||||
export const fetchBookmarks = async (
|
||||
relayPool: RelayPool,
|
||||
activeAccount: ActiveAccount,
|
||||
activeAccount: AccountWithExtension, // Full account object with extension capabilities
|
||||
setBookmarks: (bookmarks: Bookmark[]) => void,
|
||||
setLoading: (loading: boolean) => void,
|
||||
timeoutId: number
|
||||
@@ -114,6 +121,14 @@ export const fetchBookmarks = async (
|
||||
console.log('Public bookmarks:', publicBookmarks)
|
||||
console.log('Private bookmarks:', privateBookmarks)
|
||||
|
||||
// Debug the bookmark list event content
|
||||
console.log('Bookmark list content:', bookmarkListEvent.content)
|
||||
console.log('Bookmark list content type:', typeof bookmarkListEvent.content)
|
||||
console.log('Has encrypted content:', bookmarkListEvent.content && bookmarkListEvent.content.includes(':'))
|
||||
console.log('Account type:', typeof activeAccount)
|
||||
console.log('Account has decrypt method:', typeof activeAccount.decrypt)
|
||||
|
||||
|
||||
// Process bookmarks using DRY helper function
|
||||
// Handle the structure that applesauce returns: {notes: [], articles: [], hashtags: [], urls: []}
|
||||
const publicItems = processApplesauceBookmarks(publicBookmarks, activeAccount, false)
|
||||
|
||||
Reference in New Issue
Block a user