Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Use an app-specific password for [iCloud](https://support.apple.com/en-us/102525

Want to try it first? Run `hane demo` for a sample inbox that never connects or sends mail.

To try the image button, open **A few photos from the coast** in the demo and click **Always show images**. The sample is local, and demo settings reset when you quit.

## Everyday use

Use these keys to navigate Hane's TUI:
Expand All @@ -59,6 +61,7 @@ Use these keys to navigate Hane's TUI:
| `Space n t` | Show or hide the account explorer |
| `/` | Search downloaded mail |
| `r` / `c` | Reply / compose a new message |
| `I` / `S` | Always show remote images / reading settings |
| `u` / `s` | Toggle unread / starred |
| `dd` | Move a conversation to Trash after confirmation |
| `R` / `L` | Sync now / load older messages |
Expand All @@ -70,6 +73,8 @@ In the editor, press **i** to type and **Esc** to return to Normal mode. Use **`

Mail syncs in the background every minute. Opening a conversation marks it read; previews do not. Use `hane --offline` to read cached mail and write drafts without connecting.

Embedded and attached images appear inline when you open a conversation. When remote images are hidden, click the **Always show images** button above the message or press **I** once. Hane remembers the choice for all messages, including after restarting. Press **S** for reading settings to turn them off. Image hosts can see those requests. PNG, JPEG, GIF (first frame), and WebP previews use terminal colour cells; the pixels are cached only for the current session.

For the complete keymap, account setup, and delivery recovery instructions, see the [usage guide](docs/usage.md).

## Update
Expand Down Expand Up @@ -110,6 +115,6 @@ hane help passwords

The previous `--demo`, `--version`, `--sync-once`, `--check-connection`, and `--password-setup` flags remain supported as command aliases.

Connection checks and `hane sync` do not send outgoing messages. Search covers downloaded mail; use **L** to load more. Attachments are listed but cannot yet be downloaded or attached, and composition is plain text. Drafts are stored locally rather than in the server's Drafts folder.
Connection checks and `hane sync` do not send outgoing messages. Search covers downloaded mail; use **L** to load more. Image attachments can be previewed; general file downloads and uploads are not available yet, and composition is plain text. Drafts are stored locally rather than in the server's Drafts folder.

See [development](docs/development.md) for the source layout, tests, and release builds.
13 changes: 13 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ internal/app/ Terminal UI, accounts, mail, and credential handling
internal/app/assets/ Embedded terminal logo
internal/buildinfo/ Shared application version
internal/cli/ Command parsing, option validation, and help
internal/mailimage/ Bounded raster decoding, public HTTP fetching, terminal previews
internal/update/ Release discovery, verified downloads, atomic installation
scripts/ Release packaging and screenshot rendering
docs/ Usage guide and screenshots
Expand Down Expand Up @@ -65,3 +66,15 @@ Open a pull request for every change to `main`, including administrator changes.
David (`@dmillzilla`) owns all files through `.github/CODEOWNERS`. Non-admins need one approving code-owner review; new reviewable commits dismiss stale approvals. Repository admins can explicitly bypass the review requirement when merging a PR, including their own PRs. That exception does not bypass the PR requirement, CI checks, or conversation resolution.

GitHub applies bypass permission to the person merging, rather than to the PR author. Admins should approve contributor PRs before merging; the review bypass exists so admin-authored PRs do not need self-approval.

## Message images

Normal IMAP reads index image MIME parts and an HTML alternative without fetching separate image parts or remote image URLs. The plaintext body is preserved, and a separate sanitized body retains image placeholders by message ID. Legacy mail cache entries gain this metadata when synced; the storage schema remains compatible.

Opening a conversation schedules bounded local/attached image jobs. Remote jobs are allowed only by the saved app-wide reading preference (off by default) or an explicit one-conversation command. The reader notice enables the remembered preference; Settings disables it and cancels pending work. `preferences.json` uses the existing private, atomic config writer. Invalid preferences stay blocked and are preserved rather than overwritten.

Remote HTTP requests use a dedicated client with no environment proxy, cookies, mail credentials, or Referer. Every DNS answer is checked before dialing a pinned public address, including on public redirects. Private destinations, HTTPS downgrades, redirect loops, oversized responses, and unsupported raster types are rejected. MIME image fetches use read-only selection, UIDVALIDITY validation, and BODY.PEEK.

The demo includes an embedded picture in its first conversation and a simulated remote picture in **A few photos from the coast**. The simulated source goes through the regular consent UI, but the demo loader supplies a local raster and rejects other network/attachment requests. Demo reading preferences are session-only and do not read or overwrite the real preference file.

Decoded dimensions are checked before full pixel allocation, then pixels are reduced for a bounded in-memory cache. Truecolor half-block previews use the regular TUI layout so scrolling, resizing, and redraws work without graphics-protocol support. Background jobs carry generations; hiding images or leaving a conversation cancels work and stale completions cannot reopen previews or populate another message. The reducer schedules automatic loading after both navigation and live sync, without repeatedly retrying failures.
29 changes: 27 additions & 2 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,30 @@
- Opening a conversation searches all server folders for its Message-ID, References, and In-Reply-To relationships, including older parents beyond the inbox page. Copies with the same Message-ID display once in the conversation. Unrelated messages are not merged merely because they share a subject.
- Opening a thread marks its messages read. **u** toggles read/unread; **s** toggles starred. Changes are saved locally before being queued for the server. Temporary disconnections retain the queue. UIDVALIDITY checks prevent writes from targeting a different message after the server rebuilds a mailbox.
- Explorer and inbox unread counts come from server message counts, so they cover older, unloaded pages too. Pending local changes update those counts immediately.
- Mail is fetched with **BODY.PEEK**. Background downloads and previews do not mark messages read. HTML is converted to readable terminal text; scripts, styles, remote images, and tracking pixels are not loaded. Attachments are listed by name.
- Mail is fetched with **BODY.PEEK**. Background downloads and previews do not mark messages read. HTML is converted to readable terminal text; scripts and styles are not executed. Embedded and attached image previews load when you open a conversation; remote images follow your reading preference. Other attachments are listed by name.

### Images

Embedded CID images, data images, and image attachments load inline when you open a conversation. Remote images are blocked by default. The first time you encounter them, a notice above the message offers a distinct **Always show images** button. Click the button, or press **I** / **`:images`**, to load images and remember the choice for all accounts and future launches. The button stays visible as you scroll until you enable images; the explanation and surrounding text are not click targets.

Press **S** or **`:settings`** to open reading settings. **Space/Enter** toggles **Always show remote images**; **h/l** turns it off/on, and **Esc** returns. Turning it off cancels pending image loads and hides remote previews, including cached ones. Image hosts can see when you open mail after enabling it. Known hidden and tracking-sized HTML images are skipped.

PNG, JPEG, GIF (first frame), and WebP are supported. Previews use terminal colour cells and resize with the reader; a truecolor terminal is recommended.

To try both image flows locally, run `./hane demo --no-splash`:

1. Open the first conversation to see an embedded image load automatically.
2. Go back and open **A few photos from the coast** in **Personal / Inbox** (the fifth conversation).
3. Click **Always show images** above the message. The sample photo appears inline.
4. Press **S**, turn the setting off with **h**, and press **Esc**. The photo is hidden and the button returns.

The demo uses local pictures and never contacts an image host. It starts with remote-image samples hidden each time; changes to demo settings last only for that session and do not affect your mailbox preferences.

Only public HTTP(S) sources are fetched, with DNS validation on every connection and redirect. Local/private-network sources, active formats such as SVG, and oversized images are refused.

Previews are cached in memory for the current session. Offline mode displays already loaded previews and embedded data images without fetching remote or attached images. Conversations preview up to 32 images, with an 8 MiB limit per image, a 32 MiB download budget, and a 45-second loading timeout. Failed images do not retry automatically; **I** retries while enabling the saved remote-image preference. Advanced commands **`:loadimages`** and **`:hideimages`** show/retry or hide only the current conversation without changing the saved preference. Normal navigation and scrolling continue while images load. Older cached messages discover image metadata on the next sync, which fetches text and MIME metadata only.

The preference is stored privately in `preferences.json` in Hane's existing config directory (`~/.config/sorakyaku` on Linux, `~/Library/Application Support/sorakyaku` on macOS). Rendered previews are kept in memory.

![Live mailbox layout using fictional preview data](live-mail.png)

Expand Down Expand Up @@ -83,6 +106,8 @@ SMTP acceptance confirms submission to the server, not final delivery to the rec
| `L` / `:older` | Fetch 100 older messages in the folder |
| `/` | Search downloaded mail; Esc clears |
| `u`; `s` | Toggle unread; toggle starred |
| `I` / `:images` | Always show remote images; retry failed previews |
| `S` / `:settings` | Reading settings, including remote images on/off |
| `dd` / Delete / `:delete` | Confirm move to Trash, or delete a saved local draft |
| `Q` / `:queue` | Open pending Trash moves and their status |
| `r`; `c` / `:new` | Reply/resume draft; new message |
Expand Down Expand Up @@ -136,7 +161,7 @@ Corrupt or unsupported mail storage is preserved and blocks startup instead of b

## Current limits

- Plain-text replies and new messages; no attachment downloads/uploads, HTML composition, Bcc, OAuth, permanent deletion, or general folder moves yet.
- Plain-text replies and new messages; image attachments can be previewed, but general attachment downloads/uploads, HTML composition, Bcc, OAuth, permanent deletion, and general folder moves are not available yet.
- Drafts are local to this device. The server Drafts folder can be read, but server draft editing/upload is not implemented.
- Search covers downloaded mail. Load older pages with L to expand it.
- Message text downloads are limited to 1 MiB of encoded input shared across up to 16 text parts, and 2 MiB of decoded text. The reader labels truncated text. Very large or deeply malformed conversations stop at 500 referenced IDs / 12 lookup rounds with an incomplete-thread notice.
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/godbus/dbus/v5 v5.2.2
github.com/gofrs/flock v0.13.1
github.com/zalando/go-keyring v0.2.8
golang.org/x/image v0.46.0
golang.org/x/net v0.59.0
golang.org/x/term v0.46.0
)
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
golang.org/x/image v0.46.0 h1:b1+oYj0Jbp6K5MDT4i4/eZpYlk3V8SJhhDKh6LBHAyQ=
golang.org/x/image v0.46.0/go.mod h1:3B3W05VGVQyuXucLINLjXKrqISASfi4Xj+iCVkLMwew=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand Down
Loading
Loading