Skip to main content

Crate cosmic_applet_avestruz

Crate cosmic_applet_avestruz 

Source
Expand description

Avestruz: a Nostr client that lives in the COSMIC™ desktop panel.

A button in the panel opens a popup, and the popup is the whole client: the notes of the people an account follows, their threads and profiles, writing and answering, likes, reposts, zaps, bookmarks, search, and the account’s relays.

This is the library the binary is a thin main over. It is not meant to be used by anything else: it is a library so that its modules can be tested and documented, and what is pub here is public to the crate’s own tests and docs.

§Start here

The guide is the way in: how the parts go together, what happens in which order, which relay is asked what, what is spoken, what was decided, and how it is tested. Each module below then says what its own piece does.

flowchart TB
    panel["The panel button: a process of its own"] -- "toggle" --> popup["The popup"]
    popup -- "a message" --> update["app: update"]
    update --> handlers["handlers"]
    handlers -- "change" --> state[("state: AppModel")]
    state -- "is drawn by" --> views["views"]
    views --> popup
    handlers -- "ask, tell" --> nostr["nostr"]
    nostr <--> store[("The event store")]
    nostr <--> relays(["Relays"])
    handlers -- "fetch" --> web(["The web: pictures, previews, names, invoices"])
    nostr -- "sign" --> keyring[("The keyring, or a remote signer")]
To find outRead
What the parts are and how they talkguide::architecture
What happens when something is doneguide::flows
Which relay is asked or told whatguide::relays
Which NIPs and kinds are spoken, and whereguide::protocol
What must not be undone by accidentguide::decisions
How it is tested, and every test by nameguide::testing

§The modules

ModuleWhat it is
appThe application: init, the subscriptions, and update
stateThe model: everything that outlives the popup
messagesEvery message that changes the model
handlersWhat happens on each message
viewsWhat each view looks like, and the components they share
nostrEverything that speaks Nostr: relays, the store, the account, events
configThe settings
http, images, previews, requestsEverything fetched from the web
emojiThe emoji to react with: the ones used most, and all there are
fontsWhich fonts emoji are drawn with: none whose colour glyphs can’t be drawn, and the ones for emoji before any other
videoThe videos notes link to, played in their rows
youtubeWhich links are YouTube videos, and asking yt-dlp what there is to play of one
draftsWhat is being written
mediaA file to be attached to a note: what it is, and a picture without what it says beside the picture
screen, links, logging, helpers, i18nThe rest

§How much of it is tested

433 tests in 58 modules. They are listed by name, as the sentences they were written as, in guide::testing.

§Building these pages

just doc-open

That builds the documentation with private items, which is most of an application, and with its diagrams drawn. Plain cargo doc builds the same pages with each diagram as the text it was written as.

Modules§

app
COSMIC application implementation for Avestruz.
button
The button in the panel, and the line between it and the window it opens.
config
Persisted configuration schema for Avestruz.
drafts
What has been written and not published: one text for each thing that can be written to.
emoji
Emoji to react with: the ones this reader uses most, kept for next time, and all there are, to pick another from.
fonts
Fonts: which ones emoji are drawn with.
guide
The guide: how Avestruz is put together, and why. Documentation only.
handlers
Message handlers for Avestruz.
helpers
Small pure helpers shared by views and handlers.
http
Fetching from the web: the one client everything is fetched with, and the one way of fetching.
i18n
Provides localization support for this crate.
images
Pictures from the web: avatars, the images in notes, and the pictures across profiles.
links
Opening a link in the system’s browser.
logging
Runtime-adjustable log level.
media
A file that is to be attached to a note, before it goes anywhere: what kind of file it is, how large a picture it is, and the picture without what it says of where, when, with what and by whom it was made.
messages
Application messages for Avestruz.
nostr
Everything that speaks Nostr: the relay client and its local event store, the signed-in account and its key, and the models the views are built from.
previews
What a web page says of itself, for showing under a note that links to it: its title, a few words about it, and a picture.
requests
What views ask for that has to be fetched: the asking, apart from what is asked for.
screen
The screen the popup opens on: how much of its height there is for the popup, and how many of its pixels a point is.
state
Application state for Avestruz.
video
Videos notes link to, played where the link was: in the note’s row.
views
View rendering modules for Avestruz.
youtube
YouTube videos: telling a link to one from any other, and finding what there is to play of it.

Macros§

fl
Request a localized string by ID from the i18n/ directory.