storebound/apps/desktop/src-tauri/src/commands_list.rs
CRT 08eb314196 Desktop: never a blank window (frozen-prototype fix, error screens, logs, state migration, boot check)
The signed release showed only its background colour and never started the sidecar. Tauri's freezePrototype
freezes Object.prototype before the bundle runs; d3-color and d3-format (under the visx charts) assign
`constructor` / `toString` on plain objects while loading, which throws on a frozen prototype, so the bundle
stopped before React drew anything. The saved state was not the cause.

- build/freeze-safe.ts: Vite plugin that rewrites those assignments in dependencies into a helper that defines
  the property when the frozen prototype would refuse it
- error boundaries for the window, each screen and each app tab (Copy details, Reload, Reset saved state with a
  backup); public/boot.js shows the same panel when the bundle fails or the window stays empty
- logs/host.log (start, saved state, sidecar start/stop, panics) and logs/webview.log (log_webview), rotated,
  home as ~, keys, tokens and e-mail addresses replaced
- state.json `version` 2 with an explicit 1 -> 2 migration (original kept as state.json.v1.bak), per-entry
  tolerant parsing, partial settings keep their fields, unreadable files kept aside
- folders that are gone: "Folder not found" with Locate... (project_locate) / Remove; portfolio reads skip them
- tools/desktop-boot-check.ts: the built window with the release CSP and the frozen prototype, a mocked host from
  the state fixtures (empty, D1 with folders gone, D3) and the real sidecar, through every screen; in bun run ci,
  the Forgejo CI workflow and the macOS release
2026-10-11 01:36:34 +00:00

48 lines
1.2 KiB
Rust

/// Every app command the webview can call. build.rs turns each into an `allow-<name>` permission (underscores become
/// dashes); capabilities/main.json grants them to the `main` window only; tests/security.rs checks both lists match.
pub const COMMANDS: &[&str] = &[
"app_info",
"sidecar_status",
"sidecar_call",
"cache_get",
"cache_clear",
"job_cancel",
"write_with_confirm",
"projects_list",
"project_add",
"project_init",
"project_remove",
"project_set_accounts",
"accounts_list",
"account_add_play",
"account_add_apple",
"account_remove",
"portfolio_status",
"open_external",
"tools_info",
"tools_install",
"tools_uninstall",
"workspace_get",
"studio_save",
"studio_remove",
"studio_logo",
"account_update",
"account_check",
"store_apps_refresh",
"store_apps_cached",
"overrides_set",
"settings_set",
"cache_info",
"data_reveal",
"notify",
"app_reset",
"update_check",
"update_install",
"project_import_fastlane",
"export_save",
"price_sheet_pick",
"project_reveal",
"project_locate",
"state_reset",
"log_webview",
];