feat(settings): implement Settings view with config.toml persistence

Merged
MP
7mo ago
+2587-152

Summary

  • Expand AppConfig domain model from 9 to 32 fields covering 6 settings categories (General, Downloads, Network, Remote Access, Browser Integration, Appearance)
  • Create TomlConfigStore adapter for reading/writing ~/.config/vortex/config.toml with atomic writes, auto-defaults, and forward-compatible deserialization
  • Implement UpdateConfigCommand handler with input validation (proxy_type, theme, port bounds, concurrent/segment limits, timeout range)
  • Add settings_get / settings_update Tauri IPC commands with camelCase DTO serialization
  • Build SettingsView with 6-tab sidebar layout and shared SettingToggle / SettingNumberInput components
  • Implement all 6 section components: GeneralSection, DownloadsSection, NetworkSection, RemoteAccessSection (with API key display), BrowserSection, AppearanceSection (with accent color presets)
  • Add event-based cache invalidation via settings-updated Tauri event listener

Test plan

  • 368 Rust tests pass (including 8 TOML adapter tests + 4 validation tests)
  • 280 TypeScript tests pass (including 35 settings tests)
  • cargo clippy -- -D warnings clean
  • tsc --noEmit clean
  • oxlint 0 errors
  • Lefthook pre-commit hooks pass (secrets, fmt, lint, clippy)
  • Manual: Open Settings, switch tabs, change values, verify persistence after reload
  • Manual: Change theme/accent color, verify UI updates
  • Manual: Enable REST API, verify API key display/copy/regenerate

Summary by cubic

Implements the full Settings experience with persistent config.toml, a 6‑tab UI, strict post‑merge validation, and concurrency‑safe config access, completing Task 23. Also adds tauri-plugin-pilot on Unix and isolates its dev-pilot capability to Linux/macOS to keep Windows CI green.

  • New Features

    • Expanded AppConfig to 32 fields across General, Downloads, Network, Remote Access, Browser, and Appearance.
    • TomlConfigStore persistence to ~/.config/vortex/config.toml with atomic writes and sensible defaults.
    • Validated UpdateConfigCommand and IPC: settings_get / settings_update (camelCase DTOs, { patch: ... }) plus SettingsUpdated event; cross‑field checks (e.g., require proxyUrl when proxyType ≠ none).
    • SettingsView with 6 tabs and shared inputs; API key show/copy/regenerate, accent color presets, and cache invalidation on settings-updated. Adds tauri-plugin-pilot (Unix‑only) with dev-pilot capability restricted to Linux/macOS.
  • Bug Fixes

    • Concurrency: guarded reads and writes with a Mutex for safe config access.
    • Persistence/security: temp config.toml created with 0o600 permissions and sync_all used for crash‑safe atomic writes.
    • IPC/UX: fixed { patch: ... } IPC shape; buffered inputs commit on blur and sync after clamping; controlled Browser inputs; disabled Browse until picker is wired.
    • Accessibility/clarity: added aria-pressed, htmlFor/id, aria-label on Theme/Language selects; clarified speed limit to MiB/s; numeric fields respect step when committing.
    • CI: moved pilot:default permissions into a platform‑scoped dev-pilot capability file to avoid Windows build validation errors.

Summary by CodeRabbit

  • New Features

    • Full Settings UI with tabs: General, Downloads, Network, Remote Access, Browser, Appearance.
    • Configure proxy, download limits, timeouts, web interface port, REST/WebSocket/API key (show/copy/regenerate), theme, accent color, compact mode, and many other preferences.
    • Settings persist safely on disk and update immediately across the app; external changes auto-refresh the UI.
  • Tests

    • Added comprehensive frontend tests covering the Settings view and all sections.