cosmic_applet_avestruz/guide/features.rs
1// SPDX-License-Identifier: MIT
2
3//! What Avestruz does, feature by feature, in full. Documentation only.
4//!
5//! The README names each of these in a line. Here is the rest of it: what
6//! each does as whoever uses it sees it, and how far it goes. Under each
7//! is where its code is, whose own documentation says how it is done and
8//! why. How the pieces go together is in [`crate::guide::architecture`]
9//! and [`crate::guide::flows`]; what is not there, and what is not meant
10//! to be, is in [`crate::guide::decisions`].
11//!
12//! 1. [Panel applet](#panel-applet)
13//! 2. [Signing in](#signing-in)
14//! 3. [The feed](#the-feed)
15//! 4. [From the keyboard](#from-the-keyboard)
16//! 5. [Global shortcut](#global-shortcut)
17//! 6. [Stable scroll position](#stable-scroll-position)
18//! 7. [Long notes](#long-notes)
19//! 8. [Relays](#relays)
20//! 9. [Threads](#threads)
21//! 10. [Profiles](#profiles)
22//! 11. [Following](#following)
23//! 12. [Settings](#settings)
24//! 13. [Your relays](#your-relays)
25//! 14. [Local store](#local-store)
26//! 15. [Built-in relay](#built-in-relay)
27//! 16. [Search](#search)
28//! 17. [Writing](#writing)
29//! 18. [Attaching](#attaching)
30//! 19. [Metadata stripped](#metadata-stripped)
31//! 20. [Media servers](#media-servers)
32//! 21. [Replies, reposts, reactions and zaps](#replies-reposts-reactions-and-zaps)
33//! 22. [Who reacted](#who-reacted)
34//! 23. [Reacting](#reacting)
35//! 24. [Emoji](#emoji)
36//! 25. [Reposting and quoting](#reposting-and-quoting)
37//! 26. [Reposts in the feed](#reposts-in-the-feed)
38//! 27. [Highlights](#highlights)
39//! 28. [Quoted notes](#quoted-notes)
40//! 29. [Notifications](#notifications)
41//! 30. [Bookmarks](#bookmarks)
42//! 31. [Browsing bookmarks](#browsing-bookmarks)
43//! 32. [Copying a picture](#copying-a-picture)
44//! 33. [Share links](#share-links)
45//! 34. [Seen on](#seen-on)
46//! 35. [Zapping](#zapping)
47//! 36. [Authors](#authors)
48//! 37. [Note content](#note-content)
49//! 38. [Markdown](#markdown)
50//! 39. [Link previews](#link-previews)
51//! 40. [Videos](#videos)
52//! 41. [YouTube videos](#youtube-videos)
53//! 42. [What is asked of whom](#what-is-asked-of-whom)
54//!
55//! # Panel applet
56//!
57//! a button in the panel opens the popup. A view with a
58//! long list in it, as the feed is, makes the popup as tall as the screen
59//! it opens on has room: all of it, but the panel and a gap at either
60//! end. A view with little in it makes it as tall as that. How much room
61//! the screen has is asked of the compositor when the client starts and
62//! each time the popup opens, so a display plugged in or out is taken up
63//! the next time. Escape closes the popup, as a click outside it
64//! does, and nothing in it is lost for that; with a menu open, it puts the
65//! menu away first.
66//!
67//! Where the desktop blurs what is behind a window, the compositor is
68//! told to blur behind the popup and not behind the four bits of its
69//! surface outside its round corners, where what was blurred showed as a
70//! smudge ([`handle_surface_sized`](crate::state::AppModel::handle_surface_sized)).
71//!
72//! **Keep the window open**, in the settings, has the popup stay where it
73//! is when something else is clicked: over the other windows, as before,
74//! and without the keyboard until it is clicked again, so that the keys
75//! go to whatever is being worked in. It then closes only when told to:
76//! by Escape while it has the keyboard, by its button in the panel, or by
77//! the key that opens it. That key, pressed while the popup is open
78//! without the keyboard, gives it the keyboard back and leaves it open;
79//! pressed again, it closes it
80//! ([`handle_shortcut_pressed`](crate::state::AppModel::handle_shortcut_pressed)).
81//! While it has the keyboard, a popup that is kept open has an outline,
82//! as the window that has the keyboard has: it is no window, and the
83//! desktop draws it none. It is in the colour of the desktop's own: the
84//! one chosen for the window hint, or the accent if none was. The outline
85//! is over what the popup shows and takes no room.
86//! It is off unless turned on.
87//!
88//! Where: [`crate::handlers::navigation`], [`crate::button`], [`crate::screen`].
89//!
90//! # Signing in
91//!
92//! with an `nsec` (full access), an `npub` (read-only) or a
93//! `bunker://` address (full access through a remote signer, NIP-46, where
94//! the key stays). What is secret is kept in the system keyring (Secret
95//! Service) and nowhere else: the `nsec`, or the bunker's address, and the
96//! key each remote signer knows Avestruz by. That key stays the same for a
97//! signer, signing out included, so a signer that only answers clients it
98//! was told about is told once: when it turns a sign-in down, Avestruz shows
99//! the key to authorize there (for `nak bunker`, `--authorized-keys`).
100//!
101//! Where: [`crate::nostr::account`], [`crate::handlers::auth`].
102//!
103//! # The feed
104//!
105//! what the people the account follows (its contact list)
106//! post, newest first: their notes, what they repost and the passages
107//! they highlight (see **Reposts in the feed** and **Highlights**), in a
108//! scroller that only ever builds the notes on screen. What was seen
109//! before shows at once from the local event store; scrolling towards the
110//! end fetches older notes. At the top, **Notes** shows the notes that
111//! start a conversation, with the reposts and the highlights;
112//! **+ Replies** shows those with the replies among them; and
113//! **Articles** shows the articles alone (see **Articles**). The choice
114//! is kept, and holds for the notes on a profile too. Comments (kind
115//! 1111, NIP-22), which answer what is not a text note, count as replies.
116//! Articles are few among many notes, so they are asked for by
117//! themselves: choosing them, or leaving them, starts each list over from
118//! its top as a list of the other, from the event store first.
119//!
120//! Where: [`crate::nostr::feed`], [`crate::handlers::feed`], [`crate::views::components::virtual_list`].
121//!
122//! # From the keyboard
123//!
124//! in the feed, in a thread, among the notes of a
125//! profile, the bookmarks, the notes a search found, and what the account
126//! is told of:
127//!
128//! | Key | What it does |
129//! |---|---|
130//! | `j` | The next note: marked, and put at the top of what is in view |
131//! | `k` | The one before |
132//! | Home | The very top, and its first note |
133//! | 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 |
134//! | `l` or Enter | Open the marked note: its thread; a folded answer in a thread, in full |
135//! | `y` | Copy a share link to the marked note |
136//! | 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 |
137//! | → and ← | Show all of the marked note, if it is a long one, and cut it again |
138//! | `h` or Backspace | Back, as the arrow at the top left does: out of a thread, a profile, the settings |
139//! | 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 |
140//! | `c` | Write a new note |
141//! | `r` | Reply to the marked note |
142//! | `R` | Repost or quote the marked note: its menu opens, the arrows up and down choose which, and Enter does it |
143//! | `z` | Zap the marked note |
144//! | `b` | Bookmark the marked note, or take its bookmark off |
145//! | `B` | Show the bookmarks |
146//! | `s` | Search: a page to search on, with the keyboard where the search is typed |
147//! | `n` | Show the notifications |
148//! | `p` | Show your own profile |
149//! | `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 |
150//! | `.` | Show the notes that wait, as the button over the list does |
151//! | `?` | Show what the keys do |
152//! | Ctrl+P | In the composer: what is being written as it will show, and back to writing it |
153//! | Alt+B, Alt+F | In the composer: back a word, forward a word |
154//! | Alt+Backspace, Ctrl+Backspace, Ctrl+W | In the composer: rub out the word before the cursor |
155//! | Alt+D, Ctrl+Delete | In the composer: rub out the word after the cursor |
156//! | Ctrl+U, Ctrl+K | In the composer: rub out up to the start of the line, or up to its end |
157//! | Ctrl+E | In the composer: to the end of the line |
158//! | `:` | 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 |
159//! | Ctrl+Shift+S | Save a picture of the popup, as it shows, to your pictures folder (`avestruz-<date>_<time>.png`) |
160//!
161//! The note the keyboard is at has a short bar beside it, in the accent
162//! colour, in the margin: it touches nothing of the note. It is there
163//! from the first, before any key is pressed: on the note at the top of
164//! what is in view, and in a thread on the note it was opened for. A
165//! list keeps its mark: back from a thread, the note it was opened from
166//! is marked still, and `j` goes on from there. Scrolling by hand leaves
167//! the mark where it was; once it is out of view, Enter, `y` and Space
168//! are for the note at the top of what is in view, and opening the popup
169//! again puts the mark there. On a
170//! profile, who they are is the first place, above their first note.
171//! The keys are the text's where something is being typed. What the
172//! keys do, and what a right click does, is listed in a view of its own,
173//! which `?` opens, as **Keyboard and mouse** in the menu above the feed
174//! does; and said where the
175//! pointer rests on what a key does: the way back, a note's actions,
176//! and the button for new notes.
177//!
178//! Where: [`crate::handlers::keys`].
179//!
180//! # Global shortcut
181//!
182//! `cosmic-applet-avestruz --toggle` opens the
183//! popup, or closes it, as a press of the panel button does, but for a
184//! popup that is kept open and is behind what is being typed in, which it
185//! brings the keyboard back to: it says so
186//! to the client that is running, at a socket in the session's runtime
187//! directory, and leaves. Bound to a key in COSMIC's Settings, under
188//! Keyboard, Shortcuts, Custom shortcuts, that key opens Avestruz from
189//! anywhere. In `~/.config/cosmic/com.system76.CosmicSettings.Shortcuts/v1/custom`
190//! the same shortcut is:
191//!
192//! ```ron
193//! (modifiers: [], key: "F12", description: Some("Avestruz")): Spawn("cosmic-applet-avestruz --toggle"),
194//! ```
195//!
196//! A key bound this way is the desktop's, and no other application is
197//! given it.
198//!
199//! Where: [`crate::button`], [`crate::app`].
200//!
201//! # Stable scroll position
202//!
203//! what the feed shows, and how far it is scrolled, are
204//! the reader's: closing the popup and opening it again changes neither.
205//! The feed is looked at for new notes every minute while the popup is open,
206//! every five while it is closed, and when it opens. What turned up waits
207//! behind a **Show n new notes** button over the list, and nothing moves
208//! until that, or Refresh, is pressed: the new notes then show, from the top.
209//!
210//! Where: [`crate::nostr::feed`], [`crate::views::components::scroll_position`].
211//!
212//! # Long notes
213//!
214//! a note longer than six hundred characters is cut
215//! there and marked with an ellipsis. **Show more**, under what is shown
216//! of it, shows the rest where the note is: the row grows down from its
217//! place, and nothing above it moves. **Show less**, under all of it, cuts
218//! it again; if the top of the note was scrolled out of view by then, the
219//! list is scrolled back to it, so that what is left to see is the note.
220//! From the keyboard, the arrow to the right shows the rest of the marked
221//! note and the one to the left cuts it again.
222//! Pictures, videos and quoted notes are under the text either way. Which
223//! notes show in full is each list's own, and kept while the list is. A
224//! note quoted in another stays cut: its own thread has the rest.
225//!
226//! Where: [`crate::nostr::content`], [`crate::state::Expanded`].
227//!
228//! # Relays
229//!
230//! the account's own relays are those its relay list
231//! (NIP-65, kind 10002) says it writes to, eight of them at most. They are
232//! asked about everything, and what the account writes goes to them. The
233//! relays the config names are where an account is until then: where its
234//! lists are looked for, and what it reads and writes with while it has no
235//! relay list, or none of whose relays connects. Once one of its own is
236//! connected they stand down, neither asked nor written to, and are hung
237//! up on; except those on this machine or this network, which no relay
238//! list would name and which stay in use. Other people are read where they
239//! write as well (the outbox model): the relay lists of the people followed
240//! are asked for, kept in the event store and asked for again after an
241//! hour, and the relays they name are asked for those people's notes beside
242//! the account's own. Not all of them: each person from two relays, the
243//! account's own counting, and the relays that have the most people first,
244//! twenty at most for one question. The same goes for a profile and the
245//! notes on it, for a quoted note whose address says who wrote it or which
246//! relay has it, and for
247//! a thread, which is asked of the relays of whoever wrote the note opened
248//! and of the first few people it names, where they write and where they
249//! read. A relay somebody else names, in a relay list or in the address
250//! of a note, is connected to only if it is
251//! encrypted (`wss`) and on the open internet: not one on this machine or
252//! this network, and no onion service. It gets two seconds to connect and
253//! six to answer; one that doesn't is left alone for ten
254//! minutes, so that nothing waits for it twice, and one that says no for
255//! as long as the applet runs. Such a connection is closed
256//! after two minutes with nothing asked, and the relay forgotten after
257//! fifteen.
258//!
259//! Where: [`crate::guide::relays`], [`crate::nostr::outbox`].
260//!
261//! # Threads
262//!
263//! a click on a note opens its conversation: the note in full,
264//! the notes it answers above it and the answers to it below, each set in
265//! under the one it answers. A click on another note of the thread, or on a
266//! reference to a note in what someone wrote, opens that note's thread over
267//! it; Back returns to where one was, in the thread or the feed. A comment
268//! opens the comments around it, under what they are about when that is an
269//! event: shown as its text, whatever kind of thing it is.
270//!
271//! An account that names a provider of trust scores (NIP-85) has a
272//! network: itself, those it follows, and whoever the provider ranks
273//! high enough. An answer from outside it shows **folded**: one line
274//! with who wrote it, "Outside your network", and how many answers are
275//! under it, and nothing of what it says; a click, or `l` or Enter with
276//! the keyboard at it, shows it in full. The note the thread was opened
277//! for is never folded, nor what it answers, nor anything whoever
278//! started the thread wrote, nor an answer that somebody in the network
279//! answered. Without such a provider nothing is folded. The settings say
280//! which provider there is.
281//!
282//! An answer by somebody the provider was never asked about shows when
283//! it has answered, folded or in full: not before, to be folded a
284//! moment later. Whoever it had no card for is remembered from one run
285//! to the next, for a month, and their answers are folded from the
286//! start.
287//!
288//! Where: [`crate::nostr::thread`], [`crate::nostr::trust`],
289//! [`crate::handlers::thread`],
290//! [`folded_reply`](mod@crate::views::components::folded_reply).
291//!
292//! # Profiles
293//!
294//! a note's author, by their picture or name, and the
295//! account's own picture above the feed, open a profile: the picture across
296//! its top, who they are, what they say of themselves, their website and
297//! Lightning address, and under that their notes. The key can be copied. A
298//! name at a domain (NIP-05) shows only once that domain has said it is
299//! theirs, which it is asked when the profile opens. A note there opens its
300//! thread, and Back returns to the profile where it was left.
301//!
302//! Where: [`crate::handlers::profile`], [`crate::nostr::nip05`].
303//!
304//! # Following
305//!
306//! with full access, a profile has Follow or Unfollow. The
307//! account's contact list is asked of the relays again, changed by that one
308//! person and nothing else, and sent out; the feed starts over with who is
309//! followed then. If no relay has a list of the account's, a first one is
310//! only written after saying so: it would replace a list kept elsewhere.
311//! And not at all while one of the relays doesn't answer: it may be the one
312//! that has the list.
313//!
314//! Where: [`crate::nostr::contacts`].
315//!
316//! # Settings
317//!
318//! behind the cog above the feed, which opens a menu with
319//! the bookmarks, the relays, the media servers, what the keys do, and
320//! the settings: who is signed in, signing out, how large notes are set,
321//! whether the popup stays open when something else is clicked,
322//! whether what is published names the client, who works out the
323//! account's network (which is read from the account, and not set here),
324//! for how long other people's notes are kept on this machine (a week, a
325//! month, three months, a year, or for good), whether to check for a
326//! newer release, and how much is written to
327//! the journal. Over them is the logo, with the version that is running,
328//! which is what a report of something wrong is to say; under them, a
329//! link to where the source is, which opens in the browser.
330//!
331//! **Check for updates** has Avestruz ask GitHub, once each time it
332//! starts, whether a release newer than the one running is out. If one
333//! is, a line over whatever the popup shows says so, with a link to what
334//! is new in it, until it is dismissed. It is on unless it is turned
335//! off; a check that fails says nothing.
336//!
337//! Where: [`crate::handlers::settings`], [`crate::config`],
338//! [`crate::update_check`].
339//!
340//! # Your relays
341//!
342//! **Relays**, in the same menu, shows the relays the
343//! account says are its own, in seven sets. The **outbox** relays it
344//! writes to and the **inbox** relays it reads are its relay list (NIP-65,
345//! kind 10002). The others are each a list of `relay` tags (NIP-51), those
346//! said to anyone and those the list keeps to itself, encrypted (NIP-44):
347//! the relays **direct messages** go to (NIP-17, kind 10050), the
348//! **search** relays (kind 10007), the **indexer** relays (kind 10086),
349//! the **trusted** relays (kind 10089) and the **blocked** relays (kind
350//! 10006). The list of private relays (kind 10013) is not among them, and
351//! is neither read nor written: what is written here and not published is
352//! kept on this machine. A relay is added by its address, with or without
353//! `wss://`, moved up or down with the arrows beside it, and taken out with the bin;
354//! nothing is written until **Save**, and what was changed is still there
355//! if the popup closes first. Under a relay this is connected to it says
356//! whether it is now, how much came from it and went to it since the
357//! applet started, how many connections worked, and how long it takes to
358//! answer. Four of the sets ask something of a relay that not every
359//! relay does. A search relay has to search (NIP-50). A relay direct
360//! messages are sent to should give them only to whom they are for, which
361//! takes knowing who is asking (NIP-17, by NIP-42). The inbox relays and
362//! the relays direct messages are sent to are where other people write to
363//! reach the account, so they have to take what anyone writes. And the
364//! outbox relays are where other people read the account's notes, so
365//! they have to let anyone read. While the page shows, the relays of
366//! those sets are asked what they say of themselves (NIP-11), and what
367//! one says that gets in the way is said under its name: that it names
368//! the NIPs it supports and not the one needed; for a relay others write
369//! to, that it takes notes only from some or has to be paid; and, for an
370//! inbox or an outbox relay, that whoever connects has to say who they
371//! are first. One that doesn't answer is not said anything of, and
372//! neither is a relay on this machine or network, which is not asked.
373//! Save asks the relays for each list again and writes it with its relays
374//! replaced and everything else in it as it was: a relay stays where it
375//! was, public or private, and a new one goes where the list keeps its
376//! relays, or, in a first list, where lists of its kind do. A changed
377//! relay list goes to the relays the account wrote to before as well as to
378//! those it writes to now. Nothing can be changed until the relays have
379//! said what the lists are, a first list is only written after saying so,
380//! and a list whose private part can't be read is never written over. With
381//! read-only access the relays show, and can't be changed.
382//! Four of the sets are gone by: the outbox relays are the account's own
383//! (see **Relays**), the search relays are the ones searched, the indexer
384//! relays are asked for the profiles and relay lists the account's own
385//! relays don't have, and a blocked relay is never connected to because a
386//! relay list, a note's address or a bookmark names it. The other two
387//! are kept for the clients that go by them. What a list keeps to itself
388//! takes the key to read, so it is read when it is needed: the blocked and
389//! indexer relays when the popup opens, the search relays when a search
390//! page does, the rest on this page.
391//!
392//! Where: [`crate::nostr::relay_lists`], [`crate::nostr::relay_info`], [`crate::handlers::relays`].
393//!
394//! # Local store
395//!
396//! Avestruz has one event store, a database file on this machine, and
397//! every event it keeps is in it. What the relays answer with is
398//! kept there, and a feed, a thread or a profile is read from it first,
399//! which is why each shows at once the second time. The relay Avestruz
400//! runs itself (see **Built-in relay**, next) is a way into this same
401//! store, not another one. Once a day the store lets go of what is older than the
402//! settings say, a month unless they say otherwise, going by the date
403//! each event was written: other people's notes, comments, highlights,
404//! reposts, reactions and zap receipts, which are asked of the relays
405//! again when they are looked at. What the account wrote stays, and so do the notes
406//! it bookmarked, and everything there is one of for each person, whose
407//! date says nothing of whether it still holds: profiles, follow lists,
408//! relay lists. The first time is when the bookmarks have been read, which
409//! is when the popup first opens; while they can't be read, nothing goes.
410//! The store's file doesn't get smaller for it: the room is used for
411//! what comes next.
412//!
413//! Where: [`crate::nostr::sweep`], [`crate::handlers::store`].
414//!
415//! # Built-in relay
416//!
417//! Avestruz runs a relay itself, over its local store (see **Local
418//! store**, above), for what is the account's alone. The store is where
419//! events are; the relay is one way in and out of it, by the protocol any
420//! relay speaks. Other people's notes do not go through it: they are
421//! saved to the store as they arrive and read from it directly. It listens nowhere: on no port, and on
422//! no socket file. A connection to it is a pipe made inside Avestruz, so
423//! there is nothing for another program to open, and Avestruz is the only
424//! client it has. It takes the events of the account signed in and no
425//! others. That is the relay; the event store under it is a file, which
426//! whatever can read the user's files can read, and what is written and
427//! not published is encrypted in it. What it keeps there today is drafts
428//! (NIP-37, kind 31234): when the composer is left, what was written is
429//! encrypted to the account itself (NIP-44), signed, and sent to this
430//! relay and to no other; a draft that was published or cleared is kept
431//! as one that is done with.
432//! Drafts are read back when the popup first opens, which takes the key.
433//! If the relay can't be given the draft of a new note (the signer said
434//! no), that draft goes to a file instead, as it did before.
435//!
436//! Where: [`crate::nostr::private_relay`], [`crate::nostr::kept_drafts`].
437//!
438//! # Search
439//!
440//! the magnifier above the feed opens a page to search on,
441//! for people by what their profile says and for notes and articles by
442//! what they say (NIP-50). The relays asked are the account's search relays and no
443//! others: there are none built in, and with none set the page says where
444//! to set them. People and notes are searched for at once, and the page
445//! shows one or the other, best match first as the relays ranked them,
446//! the answers of several relays taken a rank at a time; among the people,
447//! those the account follows come first and are marked, since a name is
448//! anyone's to take. An article is among the notes, as its card. A person
449//! opens their profile, a note its thread, and
450//! Back returns to what was found, and each person has Follow or Unfollow
451//! beside them. An `npub`, `nprofile`, `note` or `nevent` typed there is
452//! opened rather than searched for, and no search relay is told; so is
453//! the `naddr` of an article, which is looked for where its address says. A name at a
454//! domain (`ana@example.com`, NIP-05) is asked of its domain, and the
455//! profile of whoever the domain says it is opens. The address of a relay
456//! said in full (`wss://…`) shows the notes that relay got last, under
457//! what it says of itself (NIP-11): its name, a line about it, and whether
458//! it searches. The notes before those are asked of the relay as the end
459//! of the list comes near, a page at a time, until it has no more, which
460//! the list says. An `nsec` or a `bunker://` address is cleared and sent
461//! nowhere. Nothing of a search is kept: there are no recent searches,
462//! the words are not written to the journal at any level, and what was
463//! typed and found is gone when the page is left. What is found is kept
464//! in the event store, as every event received is.
465//!
466//! Where: [`crate::nostr::search`], [`crate::handlers::search`].
467//!
468//! # Writing
469//!
470//! with full access, a new note from the feed, a reply from
471//! a thread and a quote from under any note, in a composer of their own;
472//! Ctrl+Enter publishes. **Preview**, above the text, or Ctrl+P, shows
473//! what is written as it will show once it is out: Markdown, pictures,
474//! videos, the page it links to, the people it names and the notes it
475//! quotes, under your name and picture; **Write**, or Ctrl+P again, goes
476//! back to the text. It can be published from either. **Cancel**, beside
477//! **Publish**, leaves the composer and keeps nothing: no draft is left,
478//! and files on their way to be attached are called off. A note is
479//! signed with the key from the keyring, which is read for each signature
480//! and not held, or by the remote signer, and counts as published once a
481//! relay has taken it; until then the text stays in the composer. Notes,
482//! replies, comments, reposts and reactions go to the account's own relays and,
483//! for the people they name, to the relays those people read, as their
484//! relay lists say (NIP-65): two for each. Hashtags
485//! and people mentioned are tagged, and a reply names its conversation as
486//! NIP-10 says; an answer to a comment, or to what comments are about, goes
487//! out as a comment (NIP-22). With **Say it was written with Avestruz**
488//! turned on in the settings, notes, replies and comments carry a `client`
489//! tag with the client's name (NIP-89), which other clients show as "via
490//! Avestruz"; reposts and reactions never do, and it is off unless turned
491//! on. After the name the tag has the address of the event in which
492//! Avestruz says what it is, its name, icon and website (kind 31990),
493//! for a client that would show those; `just handler` publishes that
494//! event from `resources/handler.json`
495//! ([`client_tag`](crate::nostr::compose::client_tag)). A note that
496//! carries such a tag, whoever wrote it and with whatever,
497//! shows the name in small print after its author's: "via" and the name,
498//! on one line, cut where the two don't fit, and made fit to show first,
499//! since it is a stranger's to write
500//! ([`client_of`](crate::nostr::models::client_of)). Where the tag also
501//! has the address of the client's handler event, the name shows in the
502//! accent, as a link does, and a press on it shows what the client says
503//! of itself there in a card under it, over the list: its picture, its
504//! name, its website and the line about it, read as a profile is. The
505//! store is read and the relays are asked at once: the account's own,
506//! those whoever signed the event writes to, and the one the tag names,
507//! if it names one; the newest counts, and what was found is the
508//! store's from then on ([`crate::handlers::via`]). What is written
509//! and not published is kept:
510//! leaving the composer, or the popup, loses nothing, and a draft, of a
511//! new note, a reply or a quote, is still there after a restart: see **Its
512//! own relay**.
513//!
514//! The keys that move and rub out where a command line is typed do so
515//! in the text as well, which the editor has no keys of its own for: by
516//! the word with Alt, and to an end of the line with Ctrl (see the
517//! [keys](#from-the-keyboard)). Ctrl+A selects everything, as it does in any
518//! text. The fields of one line, where an address or what to search for
519//! is typed, are the toolkit's, and have its keys: Ctrl+Backspace and
520//! Ctrl+Delete rub out a word there, and the rest are not theirs.
521//!
522//! An emoji is written by its short code, too: a colon and two letters
523//! or more of it (`:ta`) offers the emoji that may be meant in a list
524//! under the text, those whose code starts so first and of those the
525//! ones reacted with most; the arrows up and down mark one, Enter, Tab
526//! or a click takes it, and Esc puts the list away. A short code typed
527//! whole between two colons (`:tada:`) is its emoji at once. The short
528//! codes are GitHub's. A colon in a time, in an address or after a
529//! letter starts none ([`crate::handlers::completing`]).
530//!
531//! Text pasted into a new note from a page in a browser comes with the
532//! page's address, where the browser says it (Firefox and Chromium do,
533//! each in a kind of its own on the clipboard). It is then asked what is
534//! meant, with the address shown: a highlight of that page (Enter); the
535//! text alone (Backspace); or nothing (Esc). As a highlight, the passage
536//! is not in the text: it shows over it, behind a bar, with the page it
537//! is from and a way to take it out again, and what is written is what
538//! is said of it, which may be nothing. What goes out is a highlight
539//! (NIP-84, kind 9802): the passage, the page as its source, and the
540//! text as its comment. The passage is kept with the draft. Text that is
541//! an address by itself, that comes from anywhere else, or that is
542//! pasted into a reply or a quote, is pasted as ever. Firefox says only
543//! the site a passage is from, not the page, until it is set to say more
544//! (`clipboard.copyFullSourceURL`, from Firefox 163).
545//!
546//! Where: [`crate::handlers::compose`], [`crate::nostr::compose`], [`crate::handlers::pasting`].
547//!
548//! # Attaching
549//!
550//! the paperclip under the text picks pictures, videos
551//! and sounds in the desktop's file chooser, and Ctrl+V attaches files
552//! copied in a file manager or a picture copied as one. The popup closes
553//! while the chooser is open, and opens again on the composer. Each file
554//! is sent to the account's media servers (Blossom): to the first that
555//! takes it (BUD-02), after asking whether it would (BUD-06), and the
556//! others are asked to fetch a copy from there (BUD-04), so that it is
557//! still to be found when one of them is gone. Every request carries an
558//! authorization the account signs for that one file (BUD-11, kind
559//! 24242). While a file is on its way it shows under the text with how
560//! far it has got, and can be called off; when it is there its address
561//! goes at the end of the text, and the note says of it what kind of file
562//! it is, its hash, its size and a picture's width and height (`imeta`,
563//! NIP-92). Taking the address out of the text takes the file out of the
564//! note. Files of up to 100 MB are attached.
565//!
566//! Where: [`crate::handlers::media`], [`crate::nostr::blossom`].
567//!
568//! # Metadata stripped
569//!
570//! before a JPEG, a PNG or a WebP is sent,
571//! everything in the file that is not the picture is left out: where and
572//! when it was taken (EXIF, GPS), with what, what it was edited with, who
573//! it is credited to (XMP, IPTC, content credentials), comments, embedded
574//! thumbnails and second pictures, and whatever follows the end of the
575//! picture. The picture data is not touched, so nothing of the picture is
576//! lost; its colour profile, transparency and animation stay, and so does
577//! which way up it is, alone. A picture whose file can't be taken apart
578//! this way is not sent. **Videos and other files are sent as they are**:
579//! a video may say where it was taken.
580//!
581//! Where: [`crate::media`].
582//!
583//! # Media servers
584//!
585//! **Media servers**, behind the cog above the feed,
586//! shows the account's server list (BUD-03, kind 10063): the one files
587//! are sent to first at the top. Servers are added, taken out and moved
588//! there, and nothing is written until Save; a first list is only written
589//! after saying so, since it replaces any such list kept elsewhere. No
590//! server is built in: with none set, attaching opens this page instead.
591//! Only `https` servers are used.
592//!
593//! Where: [`crate::nostr::blossom`], [`crate::handlers::media`].
594//!
595//! # Replies, reposts, reactions and zaps
596//!
597//! under every note, how many
598//! answered it, how many reposted it, how many reacted to it and how many
599//! sats it was zapped, counted from what the relays send and kept in the
600//! event store. With full access, the speech bubble opens a reply and the
601//! heart offers what to react with (see **Reacting**).
602//!
603//! Where: [`crate::nostr::engagement`], [`crate::handlers::engagement`].
604//!
605//! # Who reacted
606//!
607//! a click with the right button on a note's reposts,
608//! its reactions or its zaps lists who they were under it: who reposted it,
609//! the last first; who reacted and with what; who zapped it and how many
610//! sats in all, the most first. A click on one of them opens their profile;
611//! a click anywhere else, or Escape, puts the list away. It is read from
612//! the event store, as the counts are, so who is listed is who was counted.
613//! Who zapped is who the zap request inside the receipt was signed by
614//! (NIP-57): a zap whose request is missing or does not hold is listed as
615//! someone who does not say. A hundred are shown at the most.
616//!
617//! Where: [`crate::nostr::engagement`], [`crate::handlers::engagement`].
618//!
619//! # Reacting
620//!
621//! the heart under a note opens a row: a like, the emoji you
622//! react with most, and a way to all the others (NIP-25). That way opens
623//! every emoji there is, by group, with a field to find one by what it is
624//! called. The reaction shows at once, in the heart's place, and is taken
625//! back if no relay accepts it; a note is reacted to once. The emoji you
626//! use are remembered, how often and when last, and the most used are
627//! offered first the next time; a few common ones fill the row until there
628//! are enough. That is kept in the settings of this machine and published
629//! nowhere. Custom emoji (NIP-30) are not offered, and a reaction that is
630//! one counts as a like.
631//!
632//! Where: [`crate::emoji`], [`crate::views::components::reaction_menu`](mod@crate::views::components::reaction_menu).
633//!
634//! # Emoji
635//!
636//! drawn in colour, in notes and to react with, by the
637//! system's emoji font, which is looked in before any text font that has a
638//! few emoji of its own. Colour glyphs that are bitmaps can be drawn; the
639//! ones made of gradients (`COLR` version 1), which is how some
640//! distributions ship Noto Color Emoji, can't. Such a font is left out, and
641//! emoji then show in one colour, if a font for that is installed (Noto
642//! Emoji, for one). `just emoji-font-setup` puts that right: the
643//! README says what it fetches, under Building.
644//!
645//! Where: [`crate::fonts`].
646//!
647//! # Reposting and quoting
648//!
649//! the two arrows under a note open a menu.
650//! **Repost** passes the note on as it is (NIP-18): it shows at once, as a
651//! like does, and is done once. The repost carries the note whole and names
652//! a relay that has it, which is asked for first. **Quote** opens the
653//! composer with the note on show under the text; what is written goes out
654//! as a note of the account's own with the quoted note's address under it,
655//! and may be nothing at all.
656//!
657//! Where: [`crate::nostr::engagement`], [`crate::nostr::compose`].
658//!
659//! # Reposts in the feed
660//!
661//! what the people followed repost is listed
662//! with what they write, in the feed and among the notes on a profile, as
663//! a note of its own under **Notes** whatever it answers: where they
664//! reposted it, with who did in small print over it, which leads to their
665//! profile. The note is its author's, with its own time, and everything
666//! under it is about the note. A note is listed once: of those who
667//! reposted it, and of the note itself if its author is followed too, the
668//! newest listing is the one shown, and one that is being read stays where
669//! it is when it is reposted again. A repost carries the note it passes
670//! on as text, which anybody can write: it is shown only if it is signed
671//! as its author signed it and is the note the repost names, and looked
672//! for by that name otherwise (where the repost says it is, and where its
673//! author writes); one that nobody has is left out.
674//!
675//! Where: [`crate::nostr::engagement::reposted`], [`crate::nostr::feed`].
676//!
677//! # Highlights
678//!
679//! a passage one of the people followed marked in
680//! something they read (NIP-84, kind 9802) is listed with their notes, in
681//! the feed and on their profile: the passage, slanted behind a bar, as
682//! somebody else's words; over it, whatever they said of it, read as a
683//! note is; and under it, in small print, where it is from. A page on the
684//! web is named by its site and path, which opens it, and is previewed as
685//! a linked page is; a note shows under it as a quoted note does; an
686//! article is named by who wrote it; a book or a talk by what the
687//! highlight calls it. The passage is shown as it was marked: nothing in
688//! it is a link, a mention or a mark, and one that goes on for pages is
689//! cut. It can be answered (with a comment, NIP-22), reposted, reacted to
690//! and zapped as a note can. One is written by pasting a passage from a
691//! page on the web into a new note: see [Writing](#writing).
692//!
693//! Where: [`crate::nostr::content::parse_highlight`], [`crate::nostr::compose::highlight`].
694//!
695//! # Articles
696//!
697//! a piece of long-form writing (NIP-23, kind 30023) by one of the people
698//! followed is listed with their notes, in the feed and on their profile,
699//! as a card: its picture at the left end, and beside it how long it
700//! takes to read, its title, and the first lines of what sums it up. The
701//! card is the one a linked page is previewed with, and as tall whatever
702//! the article says of itself, so its row is as tall as it was taken to
703//! be. An article a note names by its address (`nostr:naddr1…`) shows
704//! under the note as the same card, with who wrote it, found as a quoted
705//! note is; one that was not found is a link, which looks for it again
706//! when it is clicked.
707//!
708//! A click on the card opens the article, as the note a thread is for:
709//! its title, how long it takes to read and when it was last changed,
710//! what sums it up, its picture as a strip across, all it says, and its
711//! topics. What it says is read as Markdown proper: a line break in a
712//! paragraph is a space, as it is not in a note, and its pictures stand
713//! where they are linked. Under it are its comments (NIP-22) and the
714//! notes that answer it, found by its address as well as by its id: an
715//! article is written again under the same address when it is changed,
716//! and what answered an older version answers the one shown.
717//!
718//! It can be answered (with a comment), reposted, quoted, reacted to and
719//! zapped as a note can; a quote and a share link name it by its address.
720//! **Articles**, above a list, shows the articles alone. Articles are not
721//! written here, and one that was changed is the
722//! version the event store has until its author's notes are listed again.
723//!
724//! Where: [`crate::nostr::article`], [`crate::views::components::article`](mod@crate::views::components::article),
725//! [`crate::nostr::content::parse_article`].
726//!
727//! # Quoted notes
728//!
729//! a note another note names (NIP-18, NIP-21) shows
730//! under it as a card: who wrote it and when, what it says, its images and
731//! the preview of its link. A click on the card opens that note's thread.
732//! The first three notes a note quotes are shown so. A page of notes comes
733//! with the notes it quotes, from the event store or else from the relays,
734//! so that a card is there when its row is first shown and doesn't turn up
735//! under what is being read. A quoted note shows the notes it quotes the
736//! same way, a card in its card, and there it ends: a note quoted deeper
737//! than that shows as a link, and so does one that none of the relays has.
738//! A note the account's own relays don't have is asked of the relays its
739//! author writes to and of the relay its address names (NIP-19), where the
740//! address says either; the link to one that wasn't found looks there
741//! again when it is clicked.
742//!
743//! Where: [`crate::views::components::quoted_note`](mod@crate::views::components::quoted_note), [`crate::nostr::content`].
744//!
745//! # Notifications
746//!
747//! the bell above the feed opens what others did
748//! that concerns you, newest first: replies to you, replies in a
749//! conversation you are named in, mentions, quotes of your notes,
750//! reactions to them (NIP-25), reposts of them (NIP-18) and zaps
751//! (NIP-57). All of it, or one kind: **Mentions**, **Reactions**,
752//! **Zaps**. What is itself a note shows as the note it is, under a line
753//! that says which of those it is, and can be answered and reacted to
754//! where it stands; a reaction, a repost or a zap is one short row, with
755//! the start of the note it is about, which a click opens.
756//! They are the events that name the account, asked of its own relays and
757//! of the relays it reads (NIP-65), when it signs in and then as often as
758//! the feed is looked at for new notes; scrolling towards the end asks for
759//! older ones. A reaction or a repost shows when the note it is about is
760//! yours, where that note can be found.
761//! What was written since you last looked is new: the bell says how many
762//! there are, the panel button has a dot over its corner while there are
763//! any, and they are picked out in the list for as long as you look at
764//! it. Opening the list is looking; when that was is kept in the
765//! settings of this machine, for each account, and published nowhere. An
766//! account that never looked starts with nothing new.
767//! A zap shows once your own Lightning address has said which key its
768//! receipts are signed with, and only if that key signed it: anyone can
769//! write a receipt, for any amount. With no Lightning address, or one that
770//! can't be asked, no zap shows. Follows are not notifications here: who
771//! follows whom can't be told from a relay without asking for everyone's
772//! contact list.
773//! A reply, a mention or a quote from somebody outside your network (see
774//! Threads) shows folded here as there: one line with who wrote it and
775//! when, which a click, or `l` or Enter, shows in full. It is not counted
776//! as new, and lights no dot. A reaction, a repost or a zap is one line
777//! already, and shows whoever it is from.
778//!
779//! Where: [`crate::nostr::notifications`], [`crate::handlers::notifications`].
780//!
781//! # Bookmarks
782//!
783//! with full access, the ribbon at the right of the line
784//! under a note bookmarks it, and takes the bookmark off again. Bookmarks
785//! are private, always: they are kept in the private items of the
786//! account's bookmark list (NIP-51, kind 10003), which are tags, as JSON,
787//! encrypted to the account itself (NIP-44), and are there for any client
788//! that reads the list as NIP-51 says. Content encrypted the older way
789//! (NIP-04) is read too. The public items of that list, its tags, are
790//! neither read nor changed: they go out with every new list as they came,
791//! and a note bookmarked only there has an empty ribbon here. Everything
792//! else among the private items stays as it was too. The list
793//! is read when the popup opens, which takes the key: from the keyring,
794//! or by asking the remote signer to decrypt it. It is asked of the
795//! relays again before every change, and, as with following, a first list
796//! is only written after saying so. A list whose private part can't be
797//! read is never written over.
798//!
799//! Where: [`crate::nostr::bookmarks`], [`crate::handlers::bookmarks`].
800//!
801//! # Browsing bookmarks
802//!
803//! **Bookmarks**, behind the cog above the feed,
804//! lists the notes bookmarked, the one bookmarked last first: the private
805//! bookmarks, which are the only ones there are here. The notes are looked
806//! up by their ids, in the event store
807//! and on the relays, twenty at a time as the list is scrolled: the
808//! account's own, and for a note they don't have the relay its bookmark
809//! names, and the relays its author writes to if the bookmark says who
810//! that is. Under the last
811//! note it says how many bookmarks are not shown: notes no relay has, and
812//! the articles, hashtags and links the same list can hold. A
813//! click on a note opens its thread. Taking a bookmark off there leaves
814//! the note where it is, with an empty ribbon, until the page is opened
815//! again: nothing moves under the pointer.
816//!
817//! Where: [`crate::nostr::bookmarks`], [`crate::handlers::bookmarks`].
818//!
819//! # Copying a picture
820//!
821//! a click on a picture in a note with the right
822//! button puts it on the clipboard, and the picture says so. What is
823//! copied is the picture itself, fetched again from where it is, as a
824//! PNG, the way up it says it is: not the smaller copy that is kept for
825//! showing. It is there to paste after the popup has closed; pasted
826//! before it has arrived, the paste waits for it. Where only text is
827//! taken, what is pasted is the picture's address.
828//!
829//! Where: [`crate::handlers::images`].
830//!
831//! # Share links
832//!
833//! the chain link under a note, beside the ribbon, copies
834//! a link to the note that anyone can open in a browser:
835//! `https://njump.me/` and the note's `nevent` (NIP-19), which names the
836//! note, who wrote it, what kind it is, and two of the relays it was seen
837//! on, leaving out any that only this machine or this network can reach.
838//! The link turns into a tick once it is copied. Nothing is sent anywhere
839//! to make one: the site in it hears of the note when someone opens the
840//! link, and not before. A right click on the chain link opens that link
841//! in the browser, and copies nothing. Read-only accounts have both.
842//!
843//! Where: [`crate::nostr::share`], [`crate::handlers::share`].
844//!
845//! # Seen on
846//!
847//! at the right end of the line under a note, how many relays
848//! it was seen on: every relay that sent the note since the applet
849//! started, and those that took one written here. Each relay is asked
850//! whether it has the notes on show. A press on the count lists which
851//! relays they are under it, over the list, where it takes no room; a
852//! press on it again, one anywhere else, or Escape puts the list away.
853//! A press on one of the relays opens a page of the notes that relay got
854//! last, whoever wrote them: the page its address typed in
855//! [search](#search) shows.
856//!
857//! Where: [`crate::nostr::sightings`], and
858//! [`handle_open_relay`](crate::state::AppModel::handle_open_relay).
859//!
860//! # Zapping
861//!
862//! the bolt under a note whose author has a Lightning address
863//! asks that address for an invoice of the amount chosen (NIP-57) and shows
864//! it as a QR code, to scan with a wallet, or to copy. Avestruz holds no
865//! money and pays nothing itself. While the invoice is on show it waits for
866//! the receipt, and says when the zap went through. With full access the
867//! zap is the account's; without, it is anonymous.
868//!
869//! Where: [`crate::nostr::zap`], [`crate::handlers::zap`].
870//!
871//! # Authors
872//!
873//! names and pictures from profiles, looked up in the event
874//! store first and on the relays second. Until a picture loads, and for
875//! people who have none, a disc in a colour of their own with their initial.
876//! A picture that was fetched is kept on disk, as it is shown, and is
877//! there at the next start with nobody asked; after a week it is asked
878//! for again, in case another is at the same address by then.
879//!
880//! Where: [`crate::views::components::avatar`](mod@crate::views::components::avatar), [`crate::images`],
881//! [`crate::disk_cache`].
882//!
883//! # Note content
884//!
885//! links open in the browser and show as host and path;
886//! people mentioned show by name and open their profile; hashtags are picked
887//! out; images show under the text, from one edge of the note to the
888//! other and as tall as that makes them, unless they are narrower than
889//! that themselves: a picture is made smaller to fit, never larger. They
890//! keep their room while they load when the note says how large they are.
891//! A picture is kept at the size it is shown at on the screen, not as it
892//! came: a list of them scrolls at the screen's pace, and they take a
893//! fraction of the memory.
894//! A picture that moves (a GIF, an animated WebP or PNG) moves where it
895//! is, over and over, for as long as any of it is in view; one of more
896//! frames than there is room to keep moves at its own pace in fewer
897//! steps. Avatars and the pictures beside links stay still.
898//! A click on a picture opens the note, as a click on its text does.
899//! A picture that can't be had shows as the link it came as. Where that
900//! is because nobody answered for it (no network, a server that failed),
901//! it is asked for again when the popup next opens or Refresh is
902//! pressed; where the answer was no, or what came is no picture, it is
903//! not asked for again.
904//!
905//! Where: [`crate::nostr::content`], [`crate::views::components::note_row`](mod@crate::views::components::note_row), [`crate::views::components::picture`].
906//!
907//! # Markdown
908//!
909//! what a note marks is shown as it marks it: `*slanted*`
910//! and `_slanted_`, `**bold**` and `__bold__`, `~~struck out~~`,
911//! `` `code` `` in a line and between two fences in lines of its own,
912//! `# headings` (and a line with `===` under it), `> what is quoted`,
913//! items behind `-`, `*` or `+`, boxes to tick (`- [x]`), a rule (`---`),
914//! tables, links and pictures written `[with a label](https://…)`,
915//! `<https://…>`, `<br>`, and a `\` before a mark that is to stay one.
916//! A table is laid out in columns as wide as what they hold, each set
917//! left, right or in the middle as its `:---:` says; one too wide for the
918//! row is given the row and wraps what its cells hold. Nothing in a note
919//! says whether it is Markdown, so nothing decides that for the whole of
920//! it: each mark is taken for one only where it could be nothing else, on
921//! the edge of a word and closed on its line. `2*3*4`, `snake_case`,
922//! `f**k`, a shrug, a lone dash before a signature and a `#hashtag` stay
923//! as they were written, and so does a note that marks nothing, to the
924//! letter. A link that is given a label shows where it goes beside
925//! it — `the docs (docs.rs)` — since a label can say anything; what is
926//! code is not read for links, mentions or hashtags, and is not tagged
927//! when a note is published. The first three levels of heading are
928//! larger than the text, and the room a row is given before it is drawn
929//! counts them, tables and all. Left as written: numbered lists, which
930//! read as what they are, code set in by four spaces, footnotes, links
931//! whose address is given elsewhere (`[label][1]`), and HTML other than
932//! `<br>`. Lines are not joined into paragraphs: a note's line breaks are
933//! its author's.
934//!
935//! Where: [`crate::nostr::markdown`].
936//!
937//! # Link previews
938//!
939//! under a note that links to a web page, a card with
940//! what the page says of itself: the picture it is shared with, the site,
941//! its title and a few words about it. A click opens
942//! the page. The last page a note links to is the one previewed. Only the
943//! head of the page is fetched, and read for its Open Graph tags and its
944//! title; nothing of it is run. The card is always the same height, and its
945//! room is kept while the page is asked, so nothing moves when the preview
946//! arrives; a page that is gone, or says nothing of itself, gets no card.
947//! Neither does one nobody answered for (no network, a server that
948//! failed), until it is asked again: when the popup next opens or Refresh
949//! is pressed, as a picture that could not be fetched is.
950//!
951//! Where: [`crate::previews`], [`crate::views::components::link_preview`](mod@crate::views::components::link_preview).
952//!
953//! # Videos
954//!
955//! a link to a video plays where it is, in the note's row,
956//! through GStreamer. A link is a video if its address ends like one
957//! (`mp4`, `webm`, `mov`, `mkv`, `m4v`, `ogv`, `avi`) or if the note says it
958//! is one (the media type in its NIP-92 `imeta` tag). Nothing of a video is
959//! fetched until it is pressed: until then there is a play button, over the
960//! picture the note gives for it if it gives one. Then it plays with its
961//! sound, and under it are play and pause, how far in it is and of how
962//! long, a slider to go elsewhere in it, its sound, and the link itself, to
963//! open in the browser. The sound is one button: pressed, it mutes and
964//! unmutes; pointed at, it shows a slider beside it that sets how loud the
965//! video is, on the scale a mixer shows; and its picture says how loud that
966//! is. Moving the slider up unmutes. Both show the sound as the system has
967//! it: where the system remembers how an app's sound was left (PipeWire,
968//! PulseAudio), a video starts as the last one ended, as loud and as muted,
969//! and what a mixer does to it shows there too. Beside the sound is how
970//! fast the video plays, which opens a menu of speeds from 0.5× to 2×; its
971//! sound keeps its pitch. The speed chosen holds for the videos played
972//! after it, until the applet starts again. One video plays at a time,
973//! and only while it is on screen: scrolled out of view, with another view
974//! in the list's place or with the popup closed it is held where it was. Its room in the row is
975//! settled before anything of it is known (the proportions the note says,
976//! or 16:9, never taller than wide), so playing it moves nothing. A link
977//! that gives nothing away and turns out to be a video when it is asked
978//! for its preview gets a card that says so, and plays in its place once
979//! that is pressed. Which videos play is up to the GStreamer plugins on the
980//! machine; one that can't be played says why. A video is read as it
981//! comes. One that has had nothing to show for six seconds, and is not
982//! still filling up, says it is slow to start and offers a button,
983//! **Fetch it whole**: some files have all their pictures before any of
984//! their sound, and never start read front to back. Pressed, the video is
985//! fetched whole, as sound is, and played from that. It is never done
986//! unasked.
987//!
988//! Where: [`crate::video`], [`crate::views::components::video_box`](mod@crate::views::components::video_box).
989//!
990//! # Sound
991//!
992//! a link to sound alone, a song or something said, plays where it is as
993//! a video does, and by the same player. A link is sound if the note says
994//! it is (an `audio/…` media type in its NIP-92 `imeta` tag), or, the note
995//! not calling it a video, if its address ends like a sound file's (`mp3`,
996//! `m4a`, `ogg`, `oga`, `opus`, `wav`, `flac`, `aac`). It has the bar a
997//! video has, and no room over it: play and pause, how far in it is and of
998//! how long, a slider to go elsewhere in it, its sound, how fast it plays,
999//! and the link itself, to open in the browser. Until it is pressed the
1000//! bar has the link in short and nothing of it is fetched; that it is on
1001//! its way, and why it can't be played if it can't, are said on the bar.
1002//! Space plays it from the keyboard, as it does a video. One thing plays
1003//! at a time, a video or sound, and sound too plays only while its row is
1004//! on screen: scrolled out of view or with the popup closed it is held.
1005//! Pressed, it is fetched whole, into a file that is removed when
1006//! something else plays; one left behind because the applet was ended
1007//! first is removed the next time anything is played. A link that gives
1008//! nothing away, and that the note says nothing of, is not asked whether
1009//! it is sound: it stays a link.
1010//!
1011//! Where: [`crate::video`], [`crate::views::components::video_box`](mod@crate::views::components::video_box),
1012//! [`crate::nostr::content`].
1013//!
1014//! # YouTube videos
1015//!
1016//! a link to a YouTube video (its page, a short, a
1017//! live one, an embedded one, or the short `youtu.be` address) plays in
1018//! its row as any video does, in the same player: not in YouTube's own,
1019//! which is a program for a web engine, and there is none here. Under it
1020//! is what the video is called, and over it, until it is played, the
1021//! picture YouTube keeps for it. Pressing play asks
1022//! [yt-dlp](https://github.com/yt-dlp/yt-dlp), which has to be installed,
1023//! for a stream of the video, and plays that. It takes a few seconds, and
1024//! a few more when YouTube says the stream is only good to fetch a moment
1025//! later, which is waited for. The stream is the one YouTube keeps as a
1026//! single file of pictures and sound, which is small (360 lines): enough
1027//! for a row, and the link opens the video in the browser for more. A
1028//! video that is live has no such file, and is played as it comes,
1029//! pictures and sound, in a size near 720 lines if it comes in one: how
1030//! long it has gone on is shown, with no slider to go elsewhere in it
1031//! and no choice of speed. yt-dlp runs as you have set it up, its
1032//! configuration file included, so whatever it needs to get past YouTube
1033//! on your machine is said there; if it can't find the video, what it
1034//! says is shown in the video's place. YouTube changes what it sends
1035//! every few weeks, and a yt-dlp older than the change no longer gets its
1036//! streams: the video's place then says that yt-dlp wants updating, which
1037//! is the way out.
1038//!
1039//! Where: [`crate::youtube`].
1040//!
1041//! # What is asked of whom
1042//!
1043//! Nothing is fetched that a note, a profile or the account itself did
1044//! not point to, and whatever is asked of a server is seen by that server.
1045//!
1046//! Pictures are fetched over `https` only, straight from wherever a profile or a
1047//! note points, and are kept at the size they are shown at, in memory, within
1048//! a budget, and not on disk. The pages notes link to are asked the same
1049//! way, once each for as long as the applet runs, when the note comes into
1050//! view: as with a picture, the page's server sees the request. A video is
1051//! fetched by GStreamer, over `https` only, and not before it is played: its
1052//! server sees that request, and no other. Of a YouTube video, YouTube is
1053//! asked what it is called and for its picture when the note comes into view,
1054//! as any linked page is; and when it is played, yt-dlp asks YouTube for it
1055//! and GStreamer fetches the stream from there. Lightning
1056//! addresses are asked over `https` only as well, and an invoice is shown only
1057//! if it is for the amount chosen.
1058//! So are the domains of NIP-05 names, and only for a profile that is opened.
1059//! Relays other than the ones the config names are connected to as well: those
1060//! the account's relay list names, those the relay lists of the people it
1061//! follows or reads name, the one a bookmark of its own names, and the one the
1062//! address of a quoted note, a repost or a highlight names, which is whatever
1063//! relay its writer chose. Each of them sees the request, and where it comes
1064//! from. A search goes to the account's search relays, which see the words
1065//! searched for; a name at a domain typed there goes to that domain, and a
1066//! relay's address to that relay. A file that is attached goes to the
1067//! account's media servers, and to no other; a share link names
1068//! `njump.me`, which hears of nothing until somebody opens the link.
1069//!
1070//! Where: [`crate::http`], [`crate::images`], [`crate::previews`], [`crate::video`], [`crate::guide::relays`].