Skip to main content

Module media

Module media 

Source
Expand description

The account’s media servers, and attaching files to what is being written.

The servers are the account’s server list (see crate::nostr::blossom). They show as the event store has them at once, and as the relays have them when they have answered; until then nothing can be changed, since what is saved replaces what the list names. Servers are added, taken out and moved on the page, and nothing is written until Save, as on the relays page; a first list is only written after saying so. There is no server until the account names one: none is built in.

A file is attached from the composer: picked in the desktop’s file chooser, or pasted. The chooser is a window of its own, and the popup is above every window and has the keyboard, so the popup closes while the chooser is open, and opens again on the composer when it is done.

flowchart TD
    attach["Attach, in the composer"] --> any{"Any media server?"}
    any -->|"none"| page["The media servers page, to add one"]
    any -->|"yes"| chooser["The popup closes; the file chooser opens"]
    chooser --> picked["Files picked: the popup opens again"]
    paste["Ctrl+V, in the composer"] --> what{"What is on the clipboard?"}
    what -->|"text"| typed["Pasted into the text"]
    what -->|"files, a picture"| each
    picked --> each["For each file"]
    each --> ready["Read; a picture made bare; hashed"]
    ready --> signed["The account signs an authorization for that hash"]
    signed --> sent["Sent to the first server that takes it; the others fetch it"]
    sent --> link["Its address goes at the end of the text, and what the note says of it is kept"]

Each file is on its way by itself, shown under the text with how far it has got, and can be called off. They belong to what they were attached to: one that arrives after the composer was left goes at the end of that target’s draft. Nothing is published while a file for it is on its way.

What a note says of a file (crate::nostr::blossom::imeta) is kept by the file’s address, and said when a note that links to that address goes out: taking the address out of the text takes the file out of the note. It is kept with the draft, too, on the relay of this machine.

Enums§

Pasted
What was on the clipboard when Ctrl+V was pressed in the composer.
Picked 🔒
A file to attach: where it is, or what it is called and made of.

Constants§

FILE_LIST 🔒
The kinds of thing taken from the clipboard, the most wanted first: a list of files, then text, and a picture only where there is neither. Something copied in a spreadsheet is offered as text and as a picture of it, and it is the text that is meant.
PASTED_NAME 🔒
What a picture pasted from the clipboard is called.
PICTURES 🔒
TEXTS 🔒

Functions§

attach 🔒
Send picked to the first of servers that takes it, as account, which signer signs for: read, a picture made bare (see crate::media), hashed, authorized, and sent (see blossom::send), with size set to how large it is as it goes and sent kept at how much of it has gone.
attach_failure_text 🔒
Why the file called name was not attached, in the user’s language.
pasted 🔒
What bytes from the clipboard are, which it said are a kind. A list of addresses none of which is a file is the text it is.
upload_error_text 🔒
Why a server did not take a file, in the user’s language.