- Rust host: spawns storebound serve --stdio with fixed args, hands over a per-session secret, mints confirm tokens only after a native dialog showing the summary and the dry run - every app command re-checks window label and page origin; one capability (main window, app commands + event listen only, no plugin API in the webview); strict CSP; tests/security.rs pins it - store keys picked in native dialogs, kept in the OS keychain, passed per call in memory only - plugins: shell (Rust only), single-instance, deep-link storebound://, window-state, opener, dialog, notification, updater (placeholder endpoint and key until signing), process - app-centric UI: Portfolio, App (Releases, Catalog, Listings, Health, Reviews, TestFlight), App folders, Accounts, Dependencies, Settings; light / dark with the storebound.dev tokens, reduced motion, home folder shown as ~ - macOS menu: Cmd+Q quits, Edit menu, Window menu keeps the main window; Linux DMABUF fix - Bun workspace (npm files unchanged), ci runs desktop typecheck, build, cargo test and clippy; scrub covers home paths; docs/desktop.md (protocol, safety, dependency sources and licenses)
85 lines
5.9 KiB
Markdown
85 lines
5.9 KiB
Markdown
# storebound desktop (apps/desktop)
|
|
|
|
A Tauri 2 window around the storebound CLI: every app in a workspace, on iOS and Android, in one place. It is in
|
|
development; this page is for contributors.
|
|
|
|
## Shape
|
|
|
|
- **One source of logic.** The app never calls a store itself. It runs the storebound CLI as a sidecar
|
|
(`storebound serve --stdio`, compiled with `bun tools/build-sidecars.ts`) and asks it for everything.
|
|
- **App-centric.** One app = one product with up to two platforms (iOS bundle id / App Store Connect app id, Android
|
|
package name), one `storebound.config.ts` per app folder, many apps per workspace. Navigation: Portfolio -> App
|
|
(Releases, Catalog, Listings, Health, Reviews, TestFlight) plus the workspace screens (App folders, Accounts,
|
|
Dependencies, Settings).
|
|
- **Release trains.** A version (for example 2.3.0) spans both stores: iOS build and Android versionCode, per-store
|
|
state (TestFlight, review, live, phased release, rollout fraction). `portfolio.status` returns per app the current
|
|
train (highest version live on a store) and the next one (highest version above it anywhere).
|
|
- **Catalog parity.** Products (and subscriptions, once the config has them) are defined once; `portfolio.status`
|
|
compares the config with both stores (ids missing on a store, ids on one store only).
|
|
|
|
Types of the protocol: `cli/lib/desktop-protocol.ts`; pure portfolio logic: `cli/lib/portfolio.ts`.
|
|
|
|
## Safety model
|
|
|
|
- The sidecar's first request is `session.hello` with a 32-byte secret the Rust host makes per start and writes to
|
|
the sidecar's stdin. Write methods are dry runs unless the call carries a confirm token: HMAC-SHA256 over the
|
|
method, the canonical `{ project, args }` and a 60 s expiry, single use. The host mints one only after the owner
|
|
pressed Apply in a native dialog that shows the summary and the dry run (`write_with_confirm`).
|
|
- No method submits for review, releases, publishes, resumes or completes a rollout. Under `serve`, the CLI's own
|
|
terminal confirmations always answer no.
|
|
- The webview gets no plugin API. It may call the app commands (each re-checks the window label and the page origin
|
|
in Rust) and listen to two events. Strict CSP, no remote content. `src-tauri/tests/security.rs` pins all of it.
|
|
- Store keys (Play service account JSON, App Store Connect key id, issuer id and .p8) are picked in native dialogs,
|
|
stored in the OS keychain (`keyring`), never shown again and passed to the sidecar per call in memory only.
|
|
|
|
## Dependencies screen
|
|
|
|
storebound needs no local tool for store work. Screenshots, app previews, icons and captures use:
|
|
|
|
| tool | used for | how the app gets it |
|
|
|---|---|---|
|
|
| ffmpeg, ffprobe | icons, renders, app previews, frame crops | download into the app data folder (planned, see below) |
|
|
| Chrome / Chrome for Testing | screenshot renders, captions, web captures | system Chrome, or Chrome for Testing downloaded into the app data folder (planned) |
|
|
| Xcode command line tools, simctl | iOS builds, Simulator captures | link to Apple only |
|
|
| adb | Android emulator / device captures | link to the Android platform tools only |
|
|
| git | release notes, analytics compare | link only |
|
|
|
|
`system.tools` reports each with its path, version and source (`app` or `system`). The host passes app-managed
|
|
copies to the sidecar: `STOREBOUND_TOOL_PATH` (app data `tools/bin`, put in front of PATH for every command) and
|
|
`STOREBOUND_CHROME` (app data `tools/chrome/...`, used as Playwright's `executablePath`). Nothing is installed
|
|
system-wide and nothing is bundled in the installer.
|
|
|
|
Download sources (decided; the one-click download lands in the next desktop phase):
|
|
|
|
- **ffmpeg, macOS (arm64, x64):** release builds from ffmpeg.martin-riedl.de (static, notarized zip per tool).
|
|
- **ffmpeg, Linux (x64, arm64) and Windows (x64):** `ffmpeg-n<major>-latest-<os>-gpl` release builds from
|
|
github.com/BtbN/FFmpeg-Builds.
|
|
- **Verification:** the app ships a manifest with the exact URL and SHA-256 of each archive, updated with each
|
|
desktop release; a download whose hash differs is deleted. The publisher's own checksum files are not trusted on
|
|
their own (same host as the archive).
|
|
- **License:** these ffmpeg builds are GPL (v3 for the BtbN `gpl` variants). The app downloads them only on the
|
|
owner's click, from the original publisher, shows the license and the source link next to the button, and never
|
|
redistributes them, so the app itself stays MIT.
|
|
- **Chrome for Testing:** Google's official JSON endpoints
|
|
(googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json, Stable channel), archives
|
|
from storage.googleapis.com over HTTPS. Those endpoints publish no hashes, so the app checks the code signature after
|
|
unpacking (macOS `codesign --verify` with Google's team, Windows Authenticode); on Linux it checks the version banner.
|
|
Chrome for Testing is under Google's terms for Chrome / Chromium (BSD-style Chromium license plus third-party notices).
|
|
- **Progress and cancel** go through the same progress events as sidecar jobs; a cancelled download removes its
|
|
temporary file.
|
|
|
|
## Develop
|
|
|
|
```sh
|
|
bun install
|
|
bun tools/build-sidecars.ts --host # apps/desktop/src-tauri/binaries/storebound-<target triple>
|
|
cd apps/desktop && bunx tauri dev # Vite on 127.0.0.1:1420 + the Rust host
|
|
cd apps/desktop/src-tauri && cargo test && cargo clippy --all-targets -- -D warnings
|
|
```
|
|
|
|
Dev-only switches (ignored in release builds): `VITE_START=accounts|app:catalog|...` opens a screen first,
|
|
`VITE_THEME=light|dark` forces the theme, `VITE_AUTORUN=gallery` starts the confirm flow on the first app.
|
|
Gotchas kept from earlier Tauri apps: Cmd+Q quits and the Window menu keeps an entry for the hidden window; platform
|
|
configs (`tauri.<os>.conf.json`) must not set `app.windows` (Tauri replaces the whole array); Linux sets
|
|
`WEBKIT_DISABLE_DMABUF_RENDERER=1` unless the user set it; a `bun build --compile` binary needs an ad-hoc re-sign on
|
|
macOS or the kernel kills it on start.
|