cosmic_applet_avestruz/lib.rs
1// SPDX-License-Identifier: MIT
2
3//! Avestruz: a Nostr client that lives in the COSMICâ„¢ desktop panel.
4//!
5//! A button in the panel opens a popup, and the popup is the whole client:
6//! the notes of the people an account follows, their threads and profiles,
7//! writing and answering, likes, reposts, zaps, bookmarks, search, and the
8//! account's relays.
9//!
10//! This is the library the binary is a thin `main` over. It is not meant
11//! to be used by anything else: it is a library so that its modules can be
12//! tested and documented, and what is `pub` here is public to the crate's
13//! own tests and docs.
14//!
15//! # Start here
16//!
17//! The [`guide`] is the way in: how the parts go together, what happens
18//! in which order, which relay is asked what, what is spoken, what was
19//! decided, and how it is tested. Each module below then says what its own
20//! piece does.
21//!
22//! ```mermaid
23//! flowchart TB
24//! panel["The panel button: a process of its own"] -- "toggle" --> popup["The popup"]
25//! popup -- "a message" --> update["app: update"]
26//! update --> handlers["handlers"]
27//! handlers -- "change" --> state[("state: AppModel")]
28//! state -- "is drawn by" --> views["views"]
29//! views --> popup
30//! handlers -- "ask, tell" --> nostr["nostr"]
31//! nostr <--> store[("The event store")]
32//! nostr <--> relays(["Relays"])
33//! handlers -- "fetch" --> web(["The web: pictures, previews, names, invoices"])
34//! nostr -- "sign" --> keyring[("The keyring, or a remote signer")]
35//! ```
36//!
37//! | To find out | Read |
38//! |---|---|
39//! | What the parts are and how they talk | [`guide::architecture`] |
40//! | What happens when something is done | [`guide::flows`] |
41//! | Which relay is asked or told what | [`guide::relays`] |
42//! | Which NIPs and kinds are spoken, and where | [`guide::protocol`] |
43//! | What must not be undone by accident | [`guide::decisions`] |
44//! | How it is tested, and every test by name | [`guide::testing`] |
45//!
46//! # The modules
47//!
48//! | Module | What it is |
49//! |---|---|
50//! | [`app`] | The application: init, the subscriptions, and `update` |
51//! | [`state`] | The model: everything that outlives the popup |
52//! | [`messages`] | Every message that changes the model |
53//! | [`handlers`] | What happens on each message |
54//! | [`views`] | What each view looks like, and the components they share |
55//! | [`nostr`] | Everything that speaks Nostr: relays, the store, the account, events |
56//! | [`config`] | The settings |
57//! | [`http`], [`images`], [`previews`], [`requests`] | Everything fetched from the web |
58//! | [`emoji`] | The emoji to react with: the ones used most, and all there are |
59//! | [`fonts`] | Which fonts emoji are drawn with: none whose colour glyphs can't be drawn, and the ones for emoji before any other |
60//! | [`video`] | The videos notes link to, played in their rows |
61//! | [`youtube`] | Which links are YouTube videos, and asking yt-dlp what there is to play of one |
62//! | [`drafts`] | What is being written |
63//! | [`media`] | A file to be attached to a note: what it is, and a picture without what it says beside the picture |
64//! | [`screen`], [`links`], [`logging`], [`helpers`], [`i18n`] | The rest |
65//!
66//! # How much of it is tested
67//!
68#![doc = include_str!(concat!(env!("OUT_DIR"), "/test_summary.md"))]
69//! They are listed by name, as the sentences they were written as, in
70//! [`guide::testing`].
71//!
72//! # Building these pages
73//!
74//! ```sh
75//! just doc-open
76//! ```
77//!
78//! That builds the documentation with private items, which is most of an
79//! application, and with its diagrams drawn. Plain `cargo doc` builds the
80//! same pages with each diagram as the text it was written as.
81
82pub mod app;
83pub mod button;
84pub mod config;
85pub mod drafts;
86pub mod emoji;
87pub mod fonts;
88pub mod guide;
89pub mod handlers;
90pub mod helpers;
91pub mod http;
92pub mod i18n;
93pub mod images;
94pub mod links;
95pub mod logging;
96pub mod media;
97pub mod messages;
98pub mod nostr;
99pub mod previews;
100pub mod requests;
101pub mod screen;
102pub mod state;
103pub mod video;
104pub mod views;
105pub mod youtube;