Media uploads: photos, video and audio

Attach files from the new Media field (path prompt with Tab completion,
or paste/drop paths) or by URL. Files go to the server's media endpoint
(q=config media-endpoint, multipart 'file', 201 Location) in the
background; publishing waits for them. The extension picks the photo,
video or audio property; photos can carry alt text ({value, alt}).
Edits replace or delete a media property only when it changed. Notes
with media need no text. Warns when q=config lists post types without
video or audio.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Phil
2026-11-01 09:31:03 -07:00
co-authored by Claude Opus 5.5
parent c78ade3900
commit c3ad8d05e0
8 changed files with 1125 additions and 36 deletions
+12 -1
View File
@@ -25,7 +25,7 @@ Running `tuipub` with no account starts the login flow first.
| Key | Action |
| --- | --- |
| Tab / Shift-Tab | Next / previous field (Title, In reply to, Note, Tags, Crosspost) |
| Tab / Shift-Tab | Next / previous field (Title, In reply to, Note, Media, Tags, Crosspost) |
| Ctrl-T | Post type: Note → Like → Repost (only types the server lists in `q=config`) |
| Ctrl-S | Publish or save. The confirm dialog offers **d** (draft) / **p** (publish) |
| Ctrl-P | Your posts |
@@ -35,6 +35,15 @@ Running `tuipub` with no account starts the login flow first.
| Esc | Quit, or back to the post list while editing (asks if there are unsaved changes) |
| ← → / ↑ ↓, Space, a | Crosspost list: move, toggle, all/none (one row when they fit, stacked when the window is narrow) |
**Media**: Tab to the Media field and press **a**, then type a path (Tab completes it) or an http(s) URL. You can also paste or drag files onto the field (quoted paths, `file://` URIs and `\ ` escapes all work), one per line. Files upload to the server's media endpoint in the background; a URL is attached as is. The file extension decides whether it goes in `photo`, `video` or `audio`. In the field: **Enter** alt text · **d** remove · **J/K** move down/up · **↑↓** select. Publishing waits for uploads to finish. A note with media needs no text, as Micropub doesn't require it. If the server lists post types in `q=config` and video or audio isn't among them, tuipub warns that it may drop the file.
| Key (Media field) | Action |
| --- | --- |
| a | Attach a file or URL (Enter on an empty list does the same) |
| Enter / e | Edit alt text |
| d / Delete | Remove |
| J / K | Move down / up (the first one leads) |
**Likes and reposts** (StarPunk 2.5.0+): press Ctrl-T, paste the URL into "Like of" / "Repost of", and optionally add a comment. StarPunk turns likes and reposts of fediverse or Bluesky posts into native favourites/boosts when it crossposts; likes of ordinary web pages aren't crossposted. What a like or repost points at can't be changed afterwards, but its comment can.
When editing, saving sends only the fields you changed. Crosspost targets can't be changed after posting, but StarPunk updates existing crossposts when you edit.
@@ -63,6 +72,7 @@ Content is sent as written (Markdown for StarPunk). Tags are comma-separated, an
- **Login**: authorization code flow with PKCE (S256). tuipub runs a one-shot callback server on `127.0.0.1:<random port>` and uses `http://127.0.0.1:<port>/` as its `client_id`. The client ID and redirect URI share an origin, so the server needs no client registration. It checks `state` and `iss`. Scopes requested: `create update delete media`. Tokens from older tuipub versions only had `create media`; run `tuipub login` again to edit and delete.
- **Token storage**: the system keyring (Secret Service / gnome-keyring), keyed by your profile URL. Account settings go in `~/.config/tuipub/config.toml`.
- **Posts list**: `q=source` without `url` (`limit`/`offset`, drafts included). Edits are Micropub `update` with `replace`/`delete`; deletes are `delete`/`undelete`; drafts are `post-status: draft`.
- **Media**: uploads go to `media-endpoint` from `q=config` as `multipart/form-data` with one `file` part. The `Location` of the 201 response is the file's URL, sent as `photo` (`{"value", "alt"}` when there's alt text), `video` or `audio`. Edits `replace` a media property that changed and `delete` one that's now empty. Without a media endpoint you can still attach by URL.
- **Posting**: always sends a JSON body. `mp-syndicate-to` lists exactly the checked targets, and an empty list means "crosspost nowhere". If the target list can't be loaded, `mp-syndicate-to` is left out and the server's default applies (the confirm dialog says so).
### Environment
@@ -73,6 +83,7 @@ Content is sent as written (Markdown for StarPunk). Tags are comma-separated, an
## StarPunk notes
- StarPunk 2.3.3+ stores the Title as the note's `# Heading` first line. Older versions ignore it, so on those, start the note with `# Heading` instead.
- Media (2.6.4): only JPEG, PNG, GIF and WebP upload. It keeps the first 4 photos, and `video`/`audio` are ignored (its `q=config` doesn't list them, so tuipub warns). A note needs text even with photos.
- Listing, editing, deleting, drafts and replies need StarPunk 2.4.0+; likes and reposts need 2.5.0+. Ctrl-P shows a message instead of the list when a server says it can't list posts (`q` in `q=config`).
## Develop