Menu ▾ ▴

#184 Windows: CLI flags and carrier:// protocol registration

closed
nobody
2026-08-28
2026-07-22
Anonymous
No

Originally created by: kristofferR

Windows counterpart of Linux [#170] and macOS [#176] (Ref [#170], Ref [#176]): no new action semantics — reuses the shared actions.rs (AppAction, parse_carrier_url, run_app_action, pending-action slot drained by on_page_load) and only adds the Windows argv surface and protocol registration. Also the dispatch foundation for the taskbar jump list (#56, Ref [#56]).

Design

  • One parser for both surfaces: action_from_argv(args) -> Option<AppAction> in actions.rs — scan past argv[0], first match wins: --new-conversation, --settings, --thread <digits> (1–32 ASCII digits via the consolidated validation from [#176]), or any arg parsing as a carrier:// URL → parse_carrier_url. Unknown args ignored (debug log, never echoed verbatim — protocol args are attacker-controllable). Pure, unit-testable on all platforms. Jump-list entries use the flags (--thread <id>), not URLs — they must work even if protocol registration failed and avoid quoting round-trips.
  • Warm path: the single-instance callback (which currently ignores argv) becomes show_main + action_from_argv → run_app_action. Protocol invocations arrive there as plain argv ("...\Carrier.exe" "carrier://t/<id>/"). Cold path: parse std::env::args() in run() and seed the pending-action slot per [#170]/#176.
  • Registration — tauri-plugin-deep-link, registration only. Different call than macOS [#176] (which rejected the plugin) because Windows has two install stories: (1) NSIS installs get install-time registry registration free from config — plugins.deep-link.desktop.schemes: ["carrier"] drives the bundler's NSIS registry entries + uninstall cleanup (config keys verified in the CLI schema; confirm by inspecting the generated installer.nsi on first build); (2) the portable zip has no installer, so setup calls the plugin's register("carrier") on Windows (writes the same HKCU keys pointing at the running exe; also self-heals when a portable user moves the folder), log-and-continue on failure. Do not enable the plugin's JS API capability or single-instance's deep-link feature — URLs already arrive as argv and action_from_argv keeps parsing in one audited place, preserving [#176]'s strict-parsing stance.
  • Edge cases: multi_instance experimental flag → a protocol launch starts a second instance that cold-parses argv there (acceptable, documented); first recognized action wins, rest ignored; missing/invalid --thread id → plain launch/foreground; HKCU-only, no admin, matches the per-user NSIS install mode.

Testing. Unit: action_from_argv table tests (flags, URLs, junk, missing value, >32 digits, argv[0] containing "carrier://"). Manual: start carrier://t/<id>/ and Carrier.exe --thread <id> warm + cold, installed and portable; uninstall removes the registry key; portable first-run registers it.

Part of [#187].

Related

Tickets: #170
Tickets: #176
Tickets: #187
Tickets: #233
Tickets: #247
Tickets: #56

Discussion

  • Anonymous

    Anonymous - 2026-08-28

    Originally posted by: kristofferR

    Completed and manually verified through PR [#247]. Warm and cold CLI and carrier:// launches work, the NSIS installer registers the protocol at install time with guarded uninstall cleanup, and runtime registration remains available for portable builds. Closing as complete.

     

    Related

    Tickets: #247

  • Anonymous

    Anonymous - 2026-08-28

    Ticket changed by: kristofferR

    • status: open --> closed
     

Log in to post a comment.