Skip to main content

Module bookmarks

Module bookmarks 

Source
Expand description

Bookmark message handlers for Avestruz: what the account has bookmarked, and bookmarking a note or taking its bookmark off.

The bookmarks are the account’s bookmark list (see crate::nostr::bookmarks), and part of it is encrypted: reading it takes the account’s key. They are asked for when the popup opens, not when the applet starts, so that a remote signer is not reached for, nor whoever keeps it asked anything, before the account is looked at; and again each time it opens after a while, for what was bookmarked elsewhere since. The store answers first and the relays after. A list that was read once is not decrypted again.

A bookmark shows at once and goes out behind it: the newest list, asked of the relays just then, written again with that one change. One at a time, since each change is made to the list the last one left. If it does not go out, the note shows as it was, with the reason.

An account whose relays have no list of its own is told so the first time, and nothing is written: a first list replaces any list kept on relays that are not asked here. Bookmarking again writes it.

The bookmarks page shows the notes bookmarked, and looks them up by id a page at a time, in the store and then on the relays, as its list is scrolled. Which notes it shows is taken from the bookmarks when it opens, and again when they turn out to be others than they were, if its list is at its top: further down it is being read, and stays as it is. A bookmark put on or taken off here changes nothing on a page that is open, for the same reason.

Constants§

BOOKMARKS_FRESH 🔒
How long the bookmarks are taken as known, before the popup opening has them asked for again.
BOOKMARKS_PAGE 🔒
How many bookmarked notes the bookmarks page looks up at a time.