mirror of
https://github.com/ergosteur/ssh-protocol-handler-win.git
synced 2026-10-28 08:10:35 -04:00
Replace .NET WinForms handler with the Rust build in CI; drop SshHandler
Remove the .NET/WinForms project (SshHandler/, SshHandler.sln) now that the Rust rewrite (SshHandlerRs/) covers the same behavior with a ~250KB binary and no CLR startup cost, and its Default-Apps-style registration is confirmed working. Rewire the release workflow to build ssh-handler.exe natively on windows-latest with the MSVC toolchain instead of dotnet publish, and package it alongside the .bat and .sh handlers as release assets (ssh-handler-rs-*.exe, openssh_protocol_handler-*.bat, ssh-handler-*.sh) when a v* tag is pushed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GYCT2RpUjFfBfp6CD4rREw
This commit is contained in:
+23
-17
@@ -1,18 +1,22 @@
|
||||
# ssh-handler (Rust)
|
||||
|
||||
A from-scratch rewrite of `SshHandler` (the .NET/WinForms `ssh://` protocol
|
||||
handler) in Rust, targeting raw Win32 (via `windows-rs`) instead of a managed
|
||||
GUI framework. Same behavior, same registry keys, same dialog layout — just
|
||||
without the .NET runtime.
|
||||
|
||||
Why: the WinForms build's self-contained publish is ~150MB and pays CLR
|
||||
startup cost on every single `ssh://` link click. This version has no
|
||||
runtime, no GC, no JIT — cold start is just process creation plus a native
|
||||
dialog box. Release build is ~250KB.
|
||||
The Windows `ssh://` protocol handler, in Rust — raw Win32 (via `windows-rs`)
|
||||
instead of a managed GUI framework. This started as a rewrite of an earlier
|
||||
.NET/WinForms version (since removed) whose self-contained publish was
|
||||
~150MB and paid CLR startup cost on every single `ssh://` link click. This
|
||||
version has no runtime, no GC, no JIT — cold start is just process creation
|
||||
plus a native dialog box. Release build is ~250KB.
|
||||
|
||||
## Building
|
||||
|
||||
Cross-compiling from Linux (what CI does):
|
||||
CI (`.github/workflows/build.yml`) builds natively on `windows-latest` with
|
||||
the MSVC toolchain:
|
||||
|
||||
```sh
|
||||
cargo build --release --target x86_64-pc-windows-msvc
|
||||
```
|
||||
|
||||
Cross-compiling from Linux also works, e.g. for local iteration:
|
||||
|
||||
```sh
|
||||
rustup target add x86_64-pc-windows-gnu
|
||||
@@ -20,19 +24,21 @@ sudo apt install mingw-w64
|
||||
cargo build --release --target x86_64-pc-windows-gnu
|
||||
```
|
||||
|
||||
Or natively on Windows with the MSVC toolchain:
|
||||
|
||||
```sh
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
The dialog is a native Win32 resource (`resources/ssh_handler.rc`), compiled
|
||||
via `embed-resource` in `build.rs` — no GUI toolkit dependency.
|
||||
|
||||
## Behavior
|
||||
|
||||
- No arguments: setup mode. Checks for admin rights, confirms with the user,
|
||||
then writes the `ssh://` protocol registration under `HKEY_CLASSES_ROOT`.
|
||||
then registers `ssh_handler_rs` as an `ssh://` handler using the "Default
|
||||
Programs" capability model (a dedicated ProgID with
|
||||
`Capabilities\UrlAssociations`, plus a
|
||||
`HKLM\SOFTWARE\RegisteredApplications` entry) — the same pattern
|
||||
`openssh_protocol_handler.bat` uses, and the one Windows 10/11 actually
|
||||
honors in Settings > Apps > Default Apps > "Choose default apps by link
|
||||
type". A bare `HKCR\ssh\shell\open\command` write (what the old .NET
|
||||
version did) gets silently ignored once a `UserChoice` already exists for
|
||||
the protocol, which is the common case.
|
||||
- `ssh://user@host` argument: handler mode. Parses the target (defaulting the
|
||||
username to the current Windows user if omitted), shows a small dialog to
|
||||
confirm/edit the target and optionally enable "legacy mode" (older
|
||||
|
||||
Reference in New Issue
Block a user