M7: Offline downloads #19

Merged
mett merged 2 commits from feat/m7-offline into main 2026-10-29 02:20:35 +01:00
Owner

M7: Offline

  • Download manager (src-tauri/src/offline/): one book at a time, the rest queued. Pause and resume with range requests, a size check per file (a file only gets its final name when its size matches), cover saved next to the audio. Books and single podcast episodes. The index is SQLite in the app data dir (not the cache dir).
  • Offline playback: a downloaded item plays from a local edl:// timeline. Online, the server session still runs for live sync and only the audio comes from disk. Offline, or when the server stops answering mid-playback, listening goes into a local session.
  • Sync queue: closed local sessions are uploaded with POST /api/session/local-all when the connection is back. The server keeps the newer lastUpdate (checked live: an older upload is accepted but does not move the progress). After the upload the progress map is refreshed and merged by lastUpdate.
  • Offline mode: automatic from the socket status, plus a switch (sidebar and settings). Offline, the sidebar shows only Downloads, and pages that need the server redirect there. The app can start with the server unreachable, using the saved login.
  • Storage settings: folder (existing downloads move along, with progress), space used and free, "remove downloads of finished books".
  • UI: Downloads page, download button on book pages and podcast episodes, "Update available" when a downloaded item's files changed on the server (re-download on click).

Product decisions (from the issue discussion): automatic + manual offline mode; one download at a time; no auto-delete; move downloads when the folder changes; manual update of changed books; podcast episodes included.

Tests

  • scripts/check.sh steps run individually: pnpm check, cargo fmt --check, cargo clippy -D warnings, cargo test against the Podman-run test server (all pass; 3 new live tests in tests/live_offline.rs, unit tests for the store, file planning, moving and the session body). ts-rs bindings are committed.
  • pnpm lint as in the script fails on a stray .claude/worktrees/ folder in my checkout (not part of the repo); prettier --check src *.md package.json passes.
  • pnpm tauri dev starts without errors. I did not click through the new pages by hand, so the Downloads page, the offline redirect and the folder picker are untested visually. Windows is not built.
  • scripts/check.sh comes from ci/forgejo-linux-only (identical file).

Closes #7

## M7: Offline - **Download manager** (`src-tauri/src/offline/`): one book at a time, the rest queued. Pause and resume with range requests, a size check per file (a file only gets its final name when its size matches), cover saved next to the audio. Books and single podcast episodes. The index is SQLite in the app data dir (not the cache dir). - **Offline playback**: a downloaded item plays from a local `edl://` timeline. Online, the server session still runs for live sync and only the audio comes from disk. Offline, or when the server stops answering mid-playback, listening goes into a local session. - **Sync queue**: closed local sessions are uploaded with `POST /api/session/local-all` when the connection is back. The server keeps the newer `lastUpdate` (checked live: an older upload is accepted but does not move the progress). After the upload the progress map is refreshed and merged by `lastUpdate`. - **Offline mode**: automatic from the socket status, plus a switch (sidebar and settings). Offline, the sidebar shows only Downloads, and pages that need the server redirect there. The app can start with the server unreachable, using the saved login. - **Storage settings**: folder (existing downloads move along, with progress), space used and free, "remove downloads of finished books". - **UI**: Downloads page, download button on book pages and podcast episodes, "Update available" when a downloaded item's files changed on the server (re-download on click). Product decisions (from the issue discussion): automatic + manual offline mode; one download at a time; no auto-delete; move downloads when the folder changes; manual update of changed books; podcast episodes included. ### Tests - `scripts/check.sh` steps run individually: `pnpm check`, `cargo fmt --check`, `cargo clippy -D warnings`, `cargo test` against the Podman-run test server (all pass; 3 new live tests in `tests/live_offline.rs`, unit tests for the store, file planning, moving and the session body). ts-rs bindings are committed. - `pnpm lint` as in the script fails on a stray `.claude/worktrees/` folder in my checkout (not part of the repo); `prettier --check src *.md package.json` passes. - `pnpm tauri dev` starts without errors. I did **not** click through the new pages by hand, so the Downloads page, the offline redirect and the folder picker are untested visually. Windows is not built. - `scripts/check.sh` comes from `ci/forgejo-linux-only` (identical file). Closes #7
Download manager (one book at a time, resumable with range requests, size
check per file, cover saved), SQLite index in the app data dir, offline mode
(automatic from the socket, or switched on by the user), playing downloaded
items from a local edl:// timeline, local sessions uploaded with
POST /api/session/local-all, storage info and moving the download folder.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
M7 UI: Downloads page, offline mode, download buttons, storage settings
Some checks failed
CI / linux (pull_request) Has been cancelled
CI / fedora (pull_request) Has been cancelled
CI / windows (pull_request) Has been cancelled
15d7b8ab17
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
mett merged commit b5518d7940 into main 2026-10-29 02:20:35 +01:00
Sign in to join this conversation.
No description provided.