Expand description
What Avestruz does, feature by feature, in full. Documentation only.
The README names each of these in a line. Here is the rest of it: what
each does as whoever uses it sees it, and how far it goes. Under each
is where its code is, whose own documentation says how it is done and
why. How the pieces go together is in crate::guide::architecture
and crate::guide::flows; what is not there, and what is not meant
to be, is in crate::guide::decisions.
- Panel applet
- Signing in
- The feed
- From the keyboard
- Global shortcut
- Stable scroll position
- Long notes
- Relays
- Threads
- Profiles
- Following
- Settings
- Your relays
- Local store
- Built-in relay
- Search
- Writing
- Attaching
- Metadata stripped
- Media servers
- Replies, reposts, reactions and zaps
- Who reacted
- Reacting
- Emoji
- Reposting and quoting
- Reposts in the feed
- Highlights
- Quoted notes
- Notifications
- Bookmarks
- Browsing bookmarks
- Copying a picture
- Share links
- Seen on
- Zapping
- Authors
- Note content
- Markdown
- Link previews
- Videos
- YouTube videos
- What is asked of whom
§Panel applet
a button in the panel opens the popup. A view with a long list in it, as the feed is, makes the popup as tall as the screen it opens on has room: all of it, but the panel and a gap at either end. A view with little in it makes it as tall as that. How much room the screen has is asked of the compositor when the client starts and each time the popup opens, so a display plugged in or out is taken up the next time. Escape closes the popup, as a click outside it does, and nothing in it is lost for that; with a menu open, it puts the menu away first.
Where the desktop blurs what is behind a window, the compositor is
told to blur behind the popup and not behind the four bits of its
surface outside its round corners, where what was blurred showed as a
smudge (handle_surface_sized).
Keep the window open, in the settings, has the popup stay where it
is when something else is clicked: over the other windows, as before,
and without the keyboard until it is clicked again, so that the keys
go to whatever is being worked in. It then closes only when told to:
by Escape while it has the keyboard, by its button in the panel, or by
the key that opens it. That key, pressed while the popup is open
without the keyboard, gives it the keyboard back and leaves it open;
pressed again, it closes it
(handle_shortcut_pressed).
While it has the keyboard, a popup that is kept open has an outline,
as the window that has the keyboard has: it is no window, and the
desktop draws it none. It is in the colour of the desktop’s own: the
one chosen for the window hint, or the accent if none was. The outline
is over what the popup shows and takes no room.
It is off unless turned on.
Where: crate::handlers::navigation, crate::button, crate::screen.
§Signing in
with an nsec (full access), an npub (read-only) or a
bunker:// address (full access through a remote signer, NIP-46, where
the key stays). What is secret is kept in the system keyring (Secret
Service) and nowhere else: the nsec, or the bunker’s address, and the
key each remote signer knows Avestruz by. That key stays the same for a
signer, signing out included, so a signer that only answers clients it
was told about is told once: when it turns a sign-in down, Avestruz shows
the key to authorize there (for nak bunker, --authorized-keys).
Where: crate::nostr::account, crate::handlers::auth.
§The feed
what the people the account follows (its contact list) post, newest first: their notes, what they repost and the passages they highlight (see Reposts in the feed and Highlights), in a scroller that only ever builds the notes on screen. What was seen before shows at once from the local event store; scrolling towards the end fetches older notes. At the top, Notes shows the notes that start a conversation, with the reposts and the highlights; + Replies shows those with the replies among them; and Articles shows the articles alone (see Articles). The choice is kept, and holds for the notes on a profile too. Comments (kind 1111, NIP-22), which answer what is not a text note, count as replies. Articles are few among many notes, so they are asked for by themselves: choosing them, or leaving them, starts each list over from its top as a list of the other, from the event store first.
Where: crate::nostr::feed, crate::handlers::feed, crate::views::components::virtual_list.
§From the keyboard
in the feed, in a thread, among the notes of a profile, the bookmarks, the notes a search found, and what the account is told of:
| Key | What it does |
|---|---|
j | The next note: marked, and put at the top of what is in view |
k | The one before |
| Home | The very top, and its first note |
| Page Down, Page Up | A page down what is on show, and up: most of what is in view, in any view that scrolls, the settings and the like too |
l or Enter | Open the marked note: its thread; a folded answer in a thread, in full |
y | Copy a share link to the marked note |
| Space | Play the marked note’s video, or hold it. It is for the first thing the note links to, pictures apart: if that is not a video, it is opened in the browser |
| → and ← | Show all of the marked note, if it is a long one, and cut it again |
h or Backspace | Back, as the arrow at the top left does: out of a thread, a profile, the settings |
| Backspace | Out of the composer too: at once with nothing written, and with something written only after asking whether to keep it as a draft (Enter), discard it (Backspace again) or go on writing (Escape). In the text it rubs out as it does anywhere, and leaves once there is nothing left to rub out and it has been let go |
c | Write a new note |
r | Reply to the marked note |
R | Repost or quote the marked note: its menu opens, the arrows up and down choose which, and Enter does it |
z | Zap the marked note |
b | Bookmark the marked note, or take its bookmark off |
B | Show the bookmarks |
s | Search: a page to search on, with the keyboard where the search is typed |
n | Show the notifications |
p | Show your own profile |
a | Show the profile of the marked note’s author, as a click on their picture does: of a reposted note, who wrote it; of a reaction, a repost or a zap in the notifications, who did it |
. | Show the notes that wait, as the button over the list does |
? | Show what the keys do |
| Ctrl+P | In the composer: what is being written as it will show, and back to writing it |
| Alt+B, Alt+F | In the composer: back a word, forward a word |
| Alt+Backspace, Ctrl+Backspace, Ctrl+W | In the composer: rub out the word before the cursor |
| Alt+D, Ctrl+Delete | In the composer: rub out the word after the cursor |
| Ctrl+U, Ctrl+K | In the composer: rub out up to the start of the line, or up to its end |
| Ctrl+E | In the composer: to the end of the line |
: | In the composer, with two letters or more of an emoji’s short code after it: offers the emoji; the arrows up and down mark one, Enter or Tab takes it, Esc puts them away |
| Ctrl+Shift+S | Save a picture of the popup, as it shows, to your pictures folder (avestruz-<date>_<time>.png) |
The note the keyboard is at has a short bar beside it, in the accent
colour, in the margin: it touches nothing of the note. It is there
from the first, before any key is pressed: on the note at the top of
what is in view, and in a thread on the note it was opened for. A
list keeps its mark: back from a thread, the note it was opened from
is marked still, and j goes on from there. Scrolling by hand leaves
the mark where it was; once it is out of view, Enter, y and Space
are for the note at the top of what is in view, and opening the popup
again puts the mark there. On a
profile, who they are is the first place, above their first note.
The keys are the text’s where something is being typed. What the
keys do, and what a right click does, is listed in a view of its own,
which ? opens, as Keyboard and mouse in the menu above the feed
does; and said where the
pointer rests on what a key does: the way back, a note’s actions,
and the button for new notes.
Where: crate::handlers::keys.
§Global shortcut
cosmic-applet-avestruz --toggle opens the
popup, or closes it, as a press of the panel button does, but for a
popup that is kept open and is behind what is being typed in, which it
brings the keyboard back to: it says so
to the client that is running, at a socket in the session’s runtime
directory, and leaves. Bound to a key in COSMIC’s Settings, under
Keyboard, Shortcuts, Custom shortcuts, that key opens Avestruz from
anywhere. In ~/.config/cosmic/com.system76.CosmicSettings.Shortcuts/v1/custom
the same shortcut is:
(modifiers: [], key: "F12", description: Some("Avestruz")): Spawn("cosmic-applet-avestruz --toggle"),A key bound this way is the desktop’s, and no other application is given it.
Where: crate::button, crate::app.
§Stable scroll position
what the feed shows, and how far it is scrolled, are the reader’s: closing the popup and opening it again changes neither. The feed is looked at for new notes every minute while the popup is open, every five while it is closed, and when it opens. What turned up waits behind a Show n new notes button over the list, and nothing moves until that, or Refresh, is pressed: the new notes then show, from the top.
Where: crate::nostr::feed, crate::views::components::scroll_position.
§Long notes
a note longer than six hundred characters is cut there and marked with an ellipsis. Show more, under what is shown of it, shows the rest where the note is: the row grows down from its place, and nothing above it moves. Show less, under all of it, cuts it again; if the top of the note was scrolled out of view by then, the list is scrolled back to it, so that what is left to see is the note. From the keyboard, the arrow to the right shows the rest of the marked note and the one to the left cuts it again. Pictures, videos and quoted notes are under the text either way. Which notes show in full is each list’s own, and kept while the list is. A note quoted in another stays cut: its own thread has the rest.
Where: crate::nostr::content, crate::state::Expanded.
§Relays
the account’s own relays are those its relay list
(NIP-65, kind 10002) says it writes to, eight of them at most. They are
asked about everything, and what the account writes goes to them. The
relays the config names are where an account is until then: where its
lists are looked for, and what it reads and writes with while it has no
relay list, or none of whose relays connects. Once one of its own is
connected they stand down, neither asked nor written to, and are hung
up on; except those on this machine or this network, which no relay
list would name and which stay in use. Other people are read where they
write as well (the outbox model): the relay lists of the people followed
are asked for, kept in the event store and asked for again after an
hour, and the relays they name are asked for those people’s notes beside
the account’s own. Not all of them: each person from two relays, the
account’s own counting, and the relays that have the most people first,
twenty at most for one question. The same goes for a profile and the
notes on it, for a quoted note whose address says who wrote it or which
relay has it, and for
a thread, which is asked of the relays of whoever wrote the note opened
and of the first few people it names, where they write and where they
read. A relay somebody else names, in a relay list or in the address
of a note, is connected to only if it is
encrypted (wss) and on the open internet: not one on this machine or
this network, and no onion service. It gets two seconds to connect and
six to answer; one that doesn’t is left alone for ten
minutes, so that nothing waits for it twice, and one that says no for
as long as the applet runs. Such a connection is closed
after two minutes with nothing asked, and the relay forgotten after
fifteen.
Where: crate::guide::relays, crate::nostr::outbox.
§Threads
a click on a note opens its conversation: the note in full, the notes it answers above it and the answers to it below, each set in under the one it answers. A click on another note of the thread, or on a reference to a note in what someone wrote, opens that note’s thread over it; Back returns to where one was, in the thread or the feed. A comment opens the comments around it, under what they are about when that is an event: shown as its text, whatever kind of thing it is.
An account that names a provider of trust scores (NIP-85) has a
network: itself, those it follows, and whoever the provider ranks
high enough. An answer from outside it shows folded: one line
with who wrote it, “Outside your network”, and how many answers are
under it, and nothing of what it says; a click, or l or Enter with
the keyboard at it, shows it in full. The note the thread was opened
for is never folded, nor what it answers, nor anything whoever
started the thread wrote, nor an answer that somebody in the network
answered. Without such a provider nothing is folded. The settings say
which provider there is.
An answer by somebody the provider was never asked about shows when it has answered, folded or in full: not before, to be folded a moment later. Whoever it had no card for is remembered from one run to the next, for a month, and their answers are folded from the start.
Where: crate::nostr::thread, crate::nostr::trust,
crate::handlers::thread,
folded_reply.
§Profiles
a note’s author, by their picture or name, and the account’s own picture above the feed, open a profile: the picture across its top, who they are, what they say of themselves, their website and Lightning address, and under that their notes. The key can be copied. A name at a domain (NIP-05) shows only once that domain has said it is theirs, which it is asked when the profile opens. A note there opens its thread, and Back returns to the profile where it was left.
Where: crate::handlers::profile, crate::nostr::nip05.
§Following
with full access, a profile has Follow or Unfollow. The account’s contact list is asked of the relays again, changed by that one person and nothing else, and sent out; the feed starts over with who is followed then. If no relay has a list of the account’s, a first one is only written after saying so: it would replace a list kept elsewhere. And not at all while one of the relays doesn’t answer: it may be the one that has the list.
Where: crate::nostr::contacts.
§Settings
behind the cog above the feed, which opens a menu with the bookmarks, the relays, the media servers, what the keys do, and the settings: who is signed in, signing out, how large notes are set, whether the popup stays open when something else is clicked, whether what is published names the client, who works out the account’s network (which is read from the account, and not set here), for how long other people’s notes are kept on this machine (a week, a month, three months, a year, or for good), whether to check for a newer release, and how much is written to the journal. Over them is the logo, with the version that is running, which is what a report of something wrong is to say; under them, a link to where the source is, which opens in the browser.
Check for updates has Avestruz ask GitHub, once each time it starts, whether a release newer than the one running is out. If one is, a line over whatever the popup shows says so, with a link to what is new in it, until it is dismissed. It is on unless it is turned off; a check that fails says nothing.
Where: crate::handlers::settings, crate::config,
crate::update_check.
§Your relays
Relays, in the same menu, shows the relays the
account says are its own, in seven sets. The outbox relays it
writes to and the inbox relays it reads are its relay list (NIP-65,
kind 10002). The others are each a list of relay tags (NIP-51), those
said to anyone and those the list keeps to itself, encrypted (NIP-44):
the relays direct messages go to (NIP-17, kind 10050), the
search relays (kind 10007), the indexer relays (kind 10086),
the trusted relays (kind 10089) and the blocked relays (kind
10006). The list of private relays (kind 10013) is not among them, and
is neither read nor written: what is written here and not published is
kept on this machine. A relay is added by its address, with or without
wss://, moved up or down with the arrows beside it, and taken out with the bin;
nothing is written until Save, and what was changed is still there
if the popup closes first. Under a relay this is connected to it says
whether it is now, how much came from it and went to it since the
applet started, how many connections worked, and how long it takes to
answer. Four of the sets ask something of a relay that not every
relay does. A search relay has to search (NIP-50). A relay direct
messages are sent to should give them only to whom they are for, which
takes knowing who is asking (NIP-17, by NIP-42). The inbox relays and
the relays direct messages are sent to are where other people write to
reach the account, so they have to take what anyone writes. And the
outbox relays are where other people read the account’s notes, so
they have to let anyone read. While the page shows, the relays of
those sets are asked what they say of themselves (NIP-11), and what
one says that gets in the way is said under its name: that it names
the NIPs it supports and not the one needed; for a relay others write
to, that it takes notes only from some or has to be paid; and, for an
inbox or an outbox relay, that whoever connects has to say who they
are first. One that doesn’t answer is not said anything of, and
neither is a relay on this machine or network, which is not asked.
Save asks the relays for each list again and writes it with its relays
replaced and everything else in it as it was: a relay stays where it
was, public or private, and a new one goes where the list keeps its
relays, or, in a first list, where lists of its kind do. A changed
relay list goes to the relays the account wrote to before as well as to
those it writes to now. Nothing can be changed until the relays have
said what the lists are, a first list is only written after saying so,
and a list whose private part can’t be read is never written over. With
read-only access the relays show, and can’t be changed.
Four of the sets are gone by: the outbox relays are the account’s own
(see Relays), the search relays are the ones searched, the indexer
relays are asked for the profiles and relay lists the account’s own
relays don’t have, and a blocked relay is never connected to because a
relay list, a note’s address or a bookmark names it. The other two
are kept for the clients that go by them. What a list keeps to itself
takes the key to read, so it is read when it is needed: the blocked and
indexer relays when the popup opens, the search relays when a search
page does, the rest on this page.
Where: crate::nostr::relay_lists, crate::nostr::relay_info, crate::handlers::relays.
§Local store
Avestruz has one event store, a database file on this machine, and every event it keeps is in it. What the relays answer with is kept there, and a feed, a thread or a profile is read from it first, which is why each shows at once the second time. The relay Avestruz runs itself (see Built-in relay, next) is a way into this same store, not another one. Once a day the store lets go of what is older than the settings say, a month unless they say otherwise, going by the date each event was written: other people’s notes, comments, highlights, reposts, reactions and zap receipts, which are asked of the relays again when they are looked at. What the account wrote stays, and so do the notes it bookmarked, and everything there is one of for each person, whose date says nothing of whether it still holds: profiles, follow lists, relay lists. The first time is when the bookmarks have been read, which is when the popup first opens; while they can’t be read, nothing goes. The store’s file doesn’t get smaller for it: the room is used for what comes next.
Where: crate::nostr::sweep, crate::handlers::store.
§Built-in relay
Avestruz runs a relay itself, over its local store (see Local store, above), for what is the account’s alone. The store is where events are; the relay is one way in and out of it, by the protocol any relay speaks. Other people’s notes do not go through it: they are saved to the store as they arrive and read from it directly. It listens nowhere: on no port, and on no socket file. A connection to it is a pipe made inside Avestruz, so there is nothing for another program to open, and Avestruz is the only client it has. It takes the events of the account signed in and no others. That is the relay; the event store under it is a file, which whatever can read the user’s files can read, and what is written and not published is encrypted in it. What it keeps there today is drafts (NIP-37, kind 31234): when the composer is left, what was written is encrypted to the account itself (NIP-44), signed, and sent to this relay and to no other; a draft that was published or cleared is kept as one that is done with. Drafts are read back when the popup first opens, which takes the key. If the relay can’t be given the draft of a new note (the signer said no), that draft goes to a file instead, as it did before.
Where: crate::nostr::private_relay, crate::nostr::kept_drafts.
§Search
the magnifier above the feed opens a page to search on,
for people by what their profile says and for notes and articles by
what they say (NIP-50). The relays asked are the account’s search relays and no
others: there are none built in, and with none set the page says where
to set them. People and notes are searched for at once, and the page
shows one or the other, best match first as the relays ranked them,
the answers of several relays taken a rank at a time; among the people,
those the account follows come first and are marked, since a name is
anyone’s to take. An article is among the notes, as its card. A person
opens their profile, a note its thread, and
Back returns to what was found, and each person has Follow or Unfollow
beside them. An npub, nprofile, note or nevent typed there is
opened rather than searched for, and no search relay is told; so is
the naddr of an article, which is looked for where its address says. A name at a
domain (ana@example.com, NIP-05) is asked of its domain, and the
profile of whoever the domain says it is opens. The address of a relay
said in full (wss://…) shows the notes that relay got last, under
what it says of itself (NIP-11): its name, a line about it, and whether
it searches. The notes before those are asked of the relay as the end
of the list comes near, a page at a time, until it has no more, which
the list says. An nsec or a bunker:// address is cleared and sent
nowhere. Nothing of a search is kept: there are no recent searches,
the words are not written to the journal at any level, and what was
typed and found is gone when the page is left. What is found is kept
in the event store, as every event received is.
Where: crate::nostr::search, crate::handlers::search.
§Writing
with full access, a new note from the feed, a reply from
a thread and a quote from under any note, in a composer of their own;
Ctrl+Enter publishes. Preview, above the text, or Ctrl+P, shows
what is written as it will show once it is out: Markdown, pictures,
videos, the page it links to, the people it names and the notes it
quotes, under your name and picture; Write, or Ctrl+P again, goes
back to the text. It can be published from either. Cancel, beside
Publish, leaves the composer and keeps nothing: no draft is left,
and files on their way to be attached are called off. A note is
signed with the key from the keyring, which is read for each signature
and not held, or by the remote signer, and counts as published once a
relay has taken it; until then the text stays in the composer. Notes,
replies, comments, reposts and reactions go to the account’s own relays and,
for the people they name, to the relays those people read, as their
relay lists say (NIP-65): two for each. Hashtags
and people mentioned are tagged, and a reply names its conversation as
NIP-10 says; an answer to a comment, or to what comments are about, goes
out as a comment (NIP-22). With Say it was written with Avestruz
turned on in the settings, notes, replies and comments carry a client
tag with the client’s name (NIP-89), which other clients show as “via
Avestruz”; reposts and reactions never do, and it is off unless turned
on. After the name the tag has the address of the event in which
Avestruz says what it is, its name, icon and website (kind 31990),
for a client that would show those; just handler publishes that
event from resources/handler.json
(client_tag). A note that
carries such a tag, whoever wrote it and with whatever,
shows the name in small print after its author’s: “via” and the name,
on one line, cut where the two don’t fit, and made fit to show first,
since it is a stranger’s to write
(client_of). Where the tag also
has the address of the client’s handler event, the name shows in the
accent, as a link does, and a press on it shows what the client says
of itself there in a card under it, over the list: its picture, its
name, its website and the line about it, read as a profile is. The
store is read and the relays are asked at once: the account’s own,
those whoever signed the event writes to, and the one the tag names,
if it names one; the newest counts, and what was found is the
store’s from then on (crate::handlers::via). What is written
and not published is kept:
leaving the composer, or the popup, loses nothing, and a draft, of a
new note, a reply or a quote, is still there after a restart: see Its
own relay.
The keys that move and rub out where a command line is typed do so in the text as well, which the editor has no keys of its own for: by the word with Alt, and to an end of the line with Ctrl (see the keys). Ctrl+A selects everything, as it does in any text. The fields of one line, where an address or what to search for is typed, are the toolkit’s, and have its keys: Ctrl+Backspace and Ctrl+Delete rub out a word there, and the rest are not theirs.
An emoji is written by its short code, too: a colon and two letters
or more of it (:ta) offers the emoji that may be meant in a list
under the text, those whose code starts so first and of those the
ones reacted with most; the arrows up and down mark one, Enter, Tab
or a click takes it, and Esc puts the list away. A short code typed
whole between two colons (:tada:) is its emoji at once. The short
codes are GitHub’s. A colon in a time, in an address or after a
letter starts none (crate::handlers::completing).
Text pasted into a new note from a page in a browser comes with the
page’s address, where the browser says it (Firefox and Chromium do,
each in a kind of its own on the clipboard). It is then asked what is
meant, with the address shown: a highlight of that page (Enter); the
text alone (Backspace); or nothing (Esc). As a highlight, the passage
is not in the text: it shows over it, behind a bar, with the page it
is from and a way to take it out again, and what is written is what
is said of it, which may be nothing. What goes out is a highlight
(NIP-84, kind 9802): the passage, the page as its source, and the
text as its comment. The passage is kept with the draft. Text that is
an address by itself, that comes from anywhere else, or that is
pasted into a reply or a quote, is pasted as ever. Firefox says only
the site a passage is from, not the page, until it is set to say more
(clipboard.copyFullSourceURL, from Firefox 163).
Where: crate::handlers::compose, crate::nostr::compose, crate::handlers::pasting.
§Attaching
the paperclip under the text picks pictures, videos
and sounds in the desktop’s file chooser, and Ctrl+V attaches files
copied in a file manager or a picture copied as one. The popup closes
while the chooser is open, and opens again on the composer. Each file
is sent to the account’s media servers (Blossom): to the first that
takes it (BUD-02), after asking whether it would (BUD-06), and the
others are asked to fetch a copy from there (BUD-04), so that it is
still to be found when one of them is gone. Every request carries an
authorization the account signs for that one file (BUD-11, kind
24242). While a file is on its way it shows under the text with how
far it has got, and can be called off; when it is there its address
goes at the end of the text, and the note says of it what kind of file
it is, its hash, its size and a picture’s width and height (imeta,
NIP-92). Taking the address out of the text takes the file out of the
note. Files of up to 100 MB are attached.
Where: crate::handlers::media, crate::nostr::blossom.
§Metadata stripped
before a JPEG, a PNG or a WebP is sent, everything in the file that is not the picture is left out: where and when it was taken (EXIF, GPS), with what, what it was edited with, who it is credited to (XMP, IPTC, content credentials), comments, embedded thumbnails and second pictures, and whatever follows the end of the picture. The picture data is not touched, so nothing of the picture is lost; its colour profile, transparency and animation stay, and so does which way up it is, alone. A picture whose file can’t be taken apart this way is not sent. Videos and other files are sent as they are: a video may say where it was taken.
Where: crate::media.
§Media servers
Media servers, behind the cog above the feed,
shows the account’s server list (BUD-03, kind 10063): the one files
are sent to first at the top. Servers are added, taken out and moved
there, and nothing is written until Save; a first list is only written
after saying so, since it replaces any such list kept elsewhere. No
server is built in: with none set, attaching opens this page instead.
Only https servers are used.
Where: crate::nostr::blossom, crate::handlers::media.
§Replies, reposts, reactions and zaps
under every note, how many answered it, how many reposted it, how many reacted to it and how many sats it was zapped, counted from what the relays send and kept in the event store. With full access, the speech bubble opens a reply and the heart offers what to react with (see Reacting).
Where: crate::nostr::engagement, crate::handlers::engagement.
§Who reacted
a click with the right button on a note’s reposts, its reactions or its zaps lists who they were under it: who reposted it, the last first; who reacted and with what; who zapped it and how many sats in all, the most first. A click on one of them opens their profile; a click anywhere else, or Escape, puts the list away. It is read from the event store, as the counts are, so who is listed is who was counted. Who zapped is who the zap request inside the receipt was signed by (NIP-57): a zap whose request is missing or does not hold is listed as someone who does not say. A hundred are shown at the most.
Where: crate::nostr::engagement, crate::handlers::engagement.
§Reacting
the heart under a note opens a row: a like, the emoji you react with most, and a way to all the others (NIP-25). That way opens every emoji there is, by group, with a field to find one by what it is called. The reaction shows at once, in the heart’s place, and is taken back if no relay accepts it; a note is reacted to once. The emoji you use are remembered, how often and when last, and the most used are offered first the next time; a few common ones fill the row until there are enough. That is kept in the settings of this machine and published nowhere. Custom emoji (NIP-30) are not offered, and a reaction that is one counts as a like.
Where: crate::emoji, crate::views::components::reaction_menu.
§Emoji
drawn in colour, in notes and to react with, by the
system’s emoji font, which is looked in before any text font that has a
few emoji of its own. Colour glyphs that are bitmaps can be drawn; the
ones made of gradients (COLR version 1), which is how some
distributions ship Noto Color Emoji, can’t. Such a font is left out, and
emoji then show in one colour, if a font for that is installed (Noto
Emoji, for one). just emoji-font-setup puts that right: the
README says what it fetches, under Building.
Where: crate::fonts.
§Reposting and quoting
the two arrows under a note open a menu. Repost passes the note on as it is (NIP-18): it shows at once, as a like does, and is done once. The repost carries the note whole and names a relay that has it, which is asked for first. Quote opens the composer with the note on show under the text; what is written goes out as a note of the account’s own with the quoted note’s address under it, and may be nothing at all.
Where: crate::nostr::engagement, crate::nostr::compose.
§Reposts in the feed
what the people followed repost is listed with what they write, in the feed and among the notes on a profile, as a note of its own under Notes whatever it answers: where they reposted it, with who did in small print over it, which leads to their profile. The note is its author’s, with its own time, and everything under it is about the note. A note is listed once: of those who reposted it, and of the note itself if its author is followed too, the newest listing is the one shown, and one that is being read stays where it is when it is reposted again. A repost carries the note it passes on as text, which anybody can write: it is shown only if it is signed as its author signed it and is the note the repost names, and looked for by that name otherwise (where the repost says it is, and where its author writes); one that nobody has is left out.
Where: crate::nostr::engagement::reposted, crate::nostr::feed.
§Highlights
a passage one of the people followed marked in something they read (NIP-84, kind 9802) is listed with their notes, in the feed and on their profile: the passage, slanted behind a bar, as somebody else’s words; over it, whatever they said of it, read as a note is; and under it, in small print, where it is from. A page on the web is named by its site and path, which opens it, and is previewed as a linked page is; a note shows under it as a quoted note does; an article is named by who wrote it; a book or a talk by what the highlight calls it. The passage is shown as it was marked: nothing in it is a link, a mention or a mark, and one that goes on for pages is cut. It can be answered (with a comment, NIP-22), reposted, reacted to and zapped as a note can. One is written by pasting a passage from a page on the web into a new note: see Writing.
Where: crate::nostr::content::parse_highlight, crate::nostr::compose::highlight.
§Articles
a piece of long-form writing (NIP-23, kind 30023) by one of the people
followed is listed with their notes, in the feed and on their profile,
as a card: its picture at the left end, and beside it how long it
takes to read, its title, and the first lines of what sums it up. The
card is the one a linked page is previewed with, and as tall whatever
the article says of itself, so its row is as tall as it was taken to
be. An article a note names by its address (nostr:naddr1…) shows
under the note as the same card, with who wrote it, found as a quoted
note is; one that was not found is a link, which looks for it again
when it is clicked.
A click on the card opens the article, as the note a thread is for: its title, how long it takes to read and when it was last changed, what sums it up, its picture as a strip across, all it says, and its topics. What it says is read as Markdown proper: a line break in a paragraph is a space, as it is not in a note, and its pictures stand where they are linked. Under it are its comments (NIP-22) and the notes that answer it, found by its address as well as by its id: an article is written again under the same address when it is changed, and what answered an older version answers the one shown.
It can be answered (with a comment), reposted, quoted, reacted to and zapped as a note can; a quote and a share link name it by its address. Articles, above a list, shows the articles alone. Articles are not written here, and one that was changed is the version the event store has until its author’s notes are listed again.
Where: crate::nostr::article, crate::views::components::article,
crate::nostr::content::parse_article.
§Quoted notes
a note another note names (NIP-18, NIP-21) shows under it as a card: who wrote it and when, what it says, its images and the preview of its link. A click on the card opens that note’s thread. The first three notes a note quotes are shown so. A page of notes comes with the notes it quotes, from the event store or else from the relays, so that a card is there when its row is first shown and doesn’t turn up under what is being read. A quoted note shows the notes it quotes the same way, a card in its card, and there it ends: a note quoted deeper than that shows as a link, and so does one that none of the relays has. A note the account’s own relays don’t have is asked of the relays its author writes to and of the relay its address names (NIP-19), where the address says either; the link to one that wasn’t found looks there again when it is clicked.
Where: crate::views::components::quoted_note, crate::nostr::content.
§Notifications
the bell above the feed opens what others did
that concerns you, newest first: replies to you, replies in a
conversation you are named in, mentions, quotes of your notes,
reactions to them (NIP-25), reposts of them (NIP-18) and zaps
(NIP-57). All of it, or one kind: Mentions, Reactions,
Zaps. What is itself a note shows as the note it is, under a line
that says which of those it is, and can be answered and reacted to
where it stands; a reaction, a repost or a zap is one short row, with
the start of the note it is about, which a click opens.
They are the events that name the account, asked of its own relays and
of the relays it reads (NIP-65), when it signs in and then as often as
the feed is looked at for new notes; scrolling towards the end asks for
older ones. A reaction or a repost shows when the note it is about is
yours, where that note can be found.
What was written since you last looked is new: the bell says how many
there are, the panel button has a dot over its corner while there are
any, and they are picked out in the list for as long as you look at
it. Opening the list is looking; when that was is kept in the
settings of this machine, for each account, and published nowhere. An
account that never looked starts with nothing new.
A zap shows once your own Lightning address has said which key its
receipts are signed with, and only if that key signed it: anyone can
write a receipt, for any amount. With no Lightning address, or one that
can’t be asked, no zap shows. Follows are not notifications here: who
follows whom can’t be told from a relay without asking for everyone’s
contact list.
A reply, a mention or a quote from somebody outside your network (see
Threads) shows folded here as there: one line with who wrote it and
when, which a click, or l or Enter, shows in full. It is not counted
as new, and lights no dot. A reaction, a repost or a zap is one line
already, and shows whoever it is from.
Where: crate::nostr::notifications, crate::handlers::notifications.
§Bookmarks
with full access, the ribbon at the right of the line under a note bookmarks it, and takes the bookmark off again. Bookmarks are private, always: they are kept in the private items of the account’s bookmark list (NIP-51, kind 10003), which are tags, as JSON, encrypted to the account itself (NIP-44), and are there for any client that reads the list as NIP-51 says. Content encrypted the older way (NIP-04) is read too. The public items of that list, its tags, are neither read nor changed: they go out with every new list as they came, and a note bookmarked only there has an empty ribbon here. Everything else among the private items stays as it was too. The list is read when the popup opens, which takes the key: from the keyring, or by asking the remote signer to decrypt it. It is asked of the relays again before every change, and, as with following, a first list is only written after saying so. A list whose private part can’t be read is never written over.
Where: crate::nostr::bookmarks, crate::handlers::bookmarks.
§Browsing bookmarks
Bookmarks, behind the cog above the feed, lists the notes bookmarked, the one bookmarked last first: the private bookmarks, which are the only ones there are here. The notes are looked up by their ids, in the event store and on the relays, twenty at a time as the list is scrolled: the account’s own, and for a note they don’t have the relay its bookmark names, and the relays its author writes to if the bookmark says who that is. Under the last note it says how many bookmarks are not shown: notes no relay has, and the articles, hashtags and links the same list can hold. A click on a note opens its thread. Taking a bookmark off there leaves the note where it is, with an empty ribbon, until the page is opened again: nothing moves under the pointer.
Where: crate::nostr::bookmarks, crate::handlers::bookmarks.
§Copying a picture
a click on a picture in a note with the right button puts it on the clipboard, and the picture says so. What is copied is the picture itself, fetched again from where it is, as a PNG, the way up it says it is: not the smaller copy that is kept for showing. It is there to paste after the popup has closed; pasted before it has arrived, the paste waits for it. Where only text is taken, what is pasted is the picture’s address.
Where: crate::handlers::images.
§Share links
the chain link under a note, beside the ribbon, copies
a link to the note that anyone can open in a browser:
https://njump.me/ and the note’s nevent (NIP-19), which names the
note, who wrote it, what kind it is, and two of the relays it was seen
on, leaving out any that only this machine or this network can reach.
The link turns into a tick once it is copied. Nothing is sent anywhere
to make one: the site in it hears of the note when someone opens the
link, and not before. A right click on the chain link opens that link
in the browser, and copies nothing. Read-only accounts have both.
Where: crate::nostr::share, crate::handlers::share.
§Seen on
at the right end of the line under a note, how many relays it was seen on: every relay that sent the note since the applet started, and those that took one written here. Each relay is asked whether it has the notes on show. A press on the count lists which relays they are under it, over the list, where it takes no room; a press on it again, one anywhere else, or Escape puts the list away. A press on one of the relays opens a page of the notes that relay got last, whoever wrote them: the page its address typed in search shows.
Where: crate::nostr::sightings, and
handle_open_relay.
§Zapping
the bolt under a note whose author has a Lightning address asks that address for an invoice of the amount chosen (NIP-57) and shows it as a QR code, to scan with a wallet, or to copy. Avestruz holds no money and pays nothing itself. While the invoice is on show it waits for the receipt, and says when the zap went through. With full access the zap is the account’s; without, it is anonymous.
Where: crate::nostr::zap, crate::handlers::zap.
§Authors
names and pictures from profiles, looked up in the event store first and on the relays second. Until a picture loads, and for people who have none, a disc in a colour of their own with their initial. A picture that was fetched is kept on disk, as it is shown, and is there at the next start with nobody asked; after a week it is asked for again, in case another is at the same address by then.
Where: crate::views::components::avatar, crate::images,
crate::disk_cache.
§Note content
links open in the browser and show as host and path; people mentioned show by name and open their profile; hashtags are picked out; images show under the text, from one edge of the note to the other and as tall as that makes them, unless they are narrower than that themselves: a picture is made smaller to fit, never larger. They keep their room while they load when the note says how large they are. A picture is kept at the size it is shown at on the screen, not as it came: a list of them scrolls at the screen’s pace, and they take a fraction of the memory. A picture that moves (a GIF, an animated WebP or PNG) moves where it is, over and over, for as long as any of it is in view; one of more frames than there is room to keep moves at its own pace in fewer steps. Avatars and the pictures beside links stay still. A click on a picture opens the note, as a click on its text does. A picture that can’t be had shows as the link it came as. Where that is because nobody answered for it (no network, a server that failed), it is asked for again when the popup next opens or Refresh is pressed; where the answer was no, or what came is no picture, it is not asked for again.
Where: crate::nostr::content, crate::views::components::note_row, crate::views::components::picture.
§Markdown
what a note marks is shown as it marks it: *slanted*
and _slanted_, **bold** and __bold__, ~~struck out~~,
`code` in a line and between two fences in lines of its own,
# headings (and a line with === under it), > what is quoted,
items behind -, * or +, boxes to tick (- [x]), a rule (---),
tables, links and pictures written [with a label](https://…),
<https://…>, <br>, and a \ before a mark that is to stay one.
A table is laid out in columns as wide as what they hold, each set
left, right or in the middle as its :---: says; one too wide for the
row is given the row and wraps what its cells hold. Nothing in a note
says whether it is Markdown, so nothing decides that for the whole of
it: each mark is taken for one only where it could be nothing else, on
the edge of a word and closed on its line. 2*3*4, snake_case,
f**k, a shrug, a lone dash before a signature and a #hashtag stay
as they were written, and so does a note that marks nothing, to the
letter. A link that is given a label shows where it goes beside
it — the docs (docs.rs) — since a label can say anything; what is
code is not read for links, mentions or hashtags, and is not tagged
when a note is published. The first three levels of heading are
larger than the text, and the room a row is given before it is drawn
counts them, tables and all. Left as written: numbered lists, which
read as what they are, code set in by four spaces, footnotes, links
whose address is given elsewhere ([label][1]), and HTML other than
<br>. Lines are not joined into paragraphs: a note’s line breaks are
its author’s.
Where: crate::nostr::markdown.
§Link previews
under a note that links to a web page, a card with what the page says of itself: the picture it is shared with, the site, its title and a few words about it. A click opens the page. The last page a note links to is the one previewed. Only the head of the page is fetched, and read for its Open Graph tags and its title; nothing of it is run. The card is always the same height, and its room is kept while the page is asked, so nothing moves when the preview arrives; a page that is gone, or says nothing of itself, gets no card. Neither does one nobody answered for (no network, a server that failed), until it is asked again: when the popup next opens or Refresh is pressed, as a picture that could not be fetched is.
Where: crate::previews, crate::views::components::link_preview.
§Videos
a link to a video plays where it is, in the note’s row,
through GStreamer. A link is a video if its address ends like one
(mp4, webm, mov, mkv, m4v, ogv, avi) or if the note says it
is one (the media type in its NIP-92 imeta tag). Nothing of a video is
fetched until it is pressed: until then there is a play button, over the
picture the note gives for it if it gives one. Then it plays with its
sound, and under it are play and pause, how far in it is and of how
long, a slider to go elsewhere in it, its sound, and the link itself, to
open in the browser. The sound is one button: pressed, it mutes and
unmutes; pointed at, it shows a slider beside it that sets how loud the
video is, on the scale a mixer shows; and its picture says how loud that
is. Moving the slider up unmutes. Both show the sound as the system has
it: where the system remembers how an app’s sound was left (PipeWire,
PulseAudio), a video starts as the last one ended, as loud and as muted,
and what a mixer does to it shows there too. Beside the sound is how
fast the video plays, which opens a menu of speeds from 0.5× to 2×; its
sound keeps its pitch. The speed chosen holds for the videos played
after it, until the applet starts again. One video plays at a time,
and only while it is on screen: scrolled out of view, with another view
in the list’s place or with the popup closed it is held where it was. Its room in the row is
settled before anything of it is known (the proportions the note says,
or 16:9, never taller than wide), so playing it moves nothing. A link
that gives nothing away and turns out to be a video when it is asked
for its preview gets a card that says so, and plays in its place once
that is pressed. Which videos play is up to the GStreamer plugins on the
machine; one that can’t be played says why. A video is read as it
comes. One that has had nothing to show for six seconds, and is not
still filling up, says it is slow to start and offers a button,
Fetch it whole: some files have all their pictures before any of
their sound, and never start read front to back. Pressed, the video is
fetched whole, as sound is, and played from that. It is never done
unasked.
Where: crate::video, crate::views::components::video_box.
§Sound
a link to sound alone, a song or something said, plays where it is as
a video does, and by the same player. A link is sound if the note says
it is (an audio/… media type in its NIP-92 imeta tag), or, the note
not calling it a video, if its address ends like a sound file’s (mp3,
m4a, ogg, oga, opus, wav, flac, aac). It has the bar a
video has, and no room over it: play and pause, how far in it is and of
how long, a slider to go elsewhere in it, its sound, how fast it plays,
and the link itself, to open in the browser. Until it is pressed the
bar has the link in short and nothing of it is fetched; that it is on
its way, and why it can’t be played if it can’t, are said on the bar.
Space plays it from the keyboard, as it does a video. One thing plays
at a time, a video or sound, and sound too plays only while its row is
on screen: scrolled out of view or with the popup closed it is held.
Pressed, it is fetched whole, into a file that is removed when
something else plays; one left behind because the applet was ended
first is removed the next time anything is played. A link that gives
nothing away, and that the note says nothing of, is not asked whether
it is sound: it stays a link.
Where: crate::video, crate::views::components::video_box,
crate::nostr::content.
§YouTube videos
a link to a YouTube video (its page, a short, a
live one, an embedded one, or the short youtu.be address) plays in
its row as any video does, in the same player: not in YouTube’s own,
which is a program for a web engine, and there is none here. Under it
is what the video is called, and over it, until it is played, the
picture YouTube keeps for it. Pressing play asks
yt-dlp, which has to be installed,
for a stream of the video, and plays that. It takes a few seconds, and
a few more when YouTube says the stream is only good to fetch a moment
later, which is waited for. The stream is the one YouTube keeps as a
single file of pictures and sound, which is small (360 lines): enough
for a row, and the link opens the video in the browser for more. A
video that is live has no such file, and is played as it comes,
pictures and sound, in a size near 720 lines if it comes in one: how
long it has gone on is shown, with no slider to go elsewhere in it
and no choice of speed. yt-dlp runs as you have set it up, its
configuration file included, so whatever it needs to get past YouTube
on your machine is said there; if it can’t find the video, what it
says is shown in the video’s place. YouTube changes what it sends
every few weeks, and a yt-dlp older than the change no longer gets its
streams: the video’s place then says that yt-dlp wants updating, which
is the way out.
Where: crate::youtube.
§What is asked of whom
Nothing is fetched that a note, a profile or the account itself did not point to, and whatever is asked of a server is seen by that server.
Pictures are fetched over https only, straight from wherever a profile or a
note points, and are kept at the size they are shown at, in memory, within
a budget, and not on disk. The pages notes link to are asked the same
way, once each for as long as the applet runs, when the note comes into
view: as with a picture, the page’s server sees the request. A video is
fetched by GStreamer, over https only, and not before it is played: its
server sees that request, and no other. Of a YouTube video, YouTube is
asked what it is called and for its picture when the note comes into view,
as any linked page is; and when it is played, yt-dlp asks YouTube for it
and GStreamer fetches the stream from there. Lightning
addresses are asked over https only as well, and an invoice is shown only
if it is for the amount chosen.
So are the domains of NIP-05 names, and only for a profile that is opened.
Relays other than the ones the config names are connected to as well: those
the account’s relay list names, those the relay lists of the people it
follows or reads name, the one a bookmark of its own names, and the one the
address of a quoted note, a repost or a highlight names, which is whatever
relay its writer chose. Each of them sees the request, and where it comes
from. A search goes to the account’s search relays, which see the words
searched for; a name at a domain typed there goes to that domain, and a
relay’s address to that relay. A file that is attached goes to the
account’s media servers, and to no other; a share link names
njump.me, which hears of nothing until somebody opens the link.
Where: crate::http, crate::images, crate::previews, crate::video, crate::guide::relays.