diff --git a/src/components/Bookmarks.tsx b/src/components/Bookmarks.tsx index d84e873d..ce6c186b 100644 --- a/src/components/Bookmarks.tsx +++ b/src/components/Bookmarks.tsx @@ -16,6 +16,7 @@ const Bookmarks: React.FC = ({ relayPool, onLogout }) => { const [bookmarks, setBookmarks] = useState([]) 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 = ({ 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) } diff --git a/src/services/bookmarkService.ts b/src/services/bookmarkService.ts index 068870ca..8cf3fb39 100644 --- a/src/services/bookmarkService.ts +++ b/src/services/bookmarkService.ts @@ -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)