feat: Windows x64 and ARM64 support for decdn-sponsored - #7
Merged
Merged
Conversation
Rename the onramp CLI to decdn-sponsored and replace `onramp <hash>` with `decdn-sponsored pull <hash> [-o <dir>]`, which delegates to `decdn bundle pull`. - Each download gets its own throwaway key and random password under ~/.decdn/sponsored/downloads/<hash>/; the user never manages a keystore or password. The installer no longer generates a key. - The capability is saved beside the key and reused on re-run, so an interrupted pull resumes without a new captcha. A capability near expiry is replaced by a fresh key. State is deleted on success. - Hash-only input (b3:<hex> or hex); name resolution stays on the website. - decdn runs with inherited stdio; stderr classification is removed. - The installer passes its arguments through, so `curl .../decdn.sh | sh -s -- pull b3:<hash>` installs and downloads. - Capability defaults: $5 cap, 48h TTL. - Server moves from the removed decdn-client-pull crate to decdn-client so the workspace builds again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…assword - Create the per-download state dirs with mode 0700 via DirBuilder, so the directory holding key material is never briefly world-readable. - A keystore whose password file is missing cannot sign: replace it, together with the capability bound to it, instead of letting `decdn bundle pull` fail with a low-signal error. The flow now checks for a capability after ensure_key so the replacement is picked up. - Correct Session::capability's doc: only malformed contents read as None; an unreadable file is an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- installer: GET /decdn.ps1 serves a PowerShell twin of decdn.sh, templated from the same config. It installs decdn.exe and decdn-sponsored.exe to %LOCALAPPDATA%\decdn\bin, puts that on PATH (for the user and the running session), and writes the same profile with forward-slash paths and no BOM. It picks the OS architecture, so x64 PowerShell under emulation on ARM64 still installs ARM64 binaries, and runs in one script block so `irm | iex` leaves nothing behind. - decdn.sh names architectures x86_64/aarch64 like the Windows script, so /dl/<bin>-<os>-<arch> is uniform. - wrapper: resolve the home directory with std::env::home_dir (HOME is unset on Windows) and open the captcha link through `rundll32 url.dll,FileProtocolHandler` there. - tests: the pull-flow tests run on Windows with a .cmd stub for decdn; a contract test covers GET /decdn.ps1. - ci: first workflow. Linux runs the workspace (fmt, clippy, tests); macOS and Windows x64 lint and test the client; Windows ARM64 lints it. decdn/decdn is checked out beside sponsord for the path dependencies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The wrapper’s Windows test stub likely isn’t spawnable as written and the new home-directory implementation uses a deprecated API that can break -D warnings builds.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (3)
What changed in this PR
Adds first-class Windows support (x64 + ARM64) for the decdn-sponsored installer and wrapper flow, including a PowerShell installer endpoint, Windows-aware wrapper behavior, expanded tests, and initial cross-platform CI coverage.
Changes:
- Add
GET /decdn.ps1and a templated PowerShell installer (assets/decdn.ps1) alongside the existing POSIX installer. - Update wrapper behavior for Windows (home directory resolution; browser-opening strategy) and extend pull-flow tests to run on Windows.
- Introduce a CI workflow covering Linux workspace checks plus macOS/Windows client lint+tests (including Windows ARM64 lint).
| File | Description |
|---|---|
| README.md | Documents Windows installer usage and new /decdn.ps1 endpoint. |
| crates/wrapper/tests/pull_flow.rs | Adds Windows .cmd-based decdn stub for pull-flow tests. |
| crates/wrapper/src/flow.rs | Uses rundll32 url.dll,FileProtocolHandler to open URLs on Windows. |
| crates/wrapper/src/config.rs | Switches home directory discovery to support Windows. |
| crates/server/tests/http_contract.rs | Adds contract coverage for templated /decdn.ps1. |
| crates/server/src/http/mod.rs | Routes /decdn.sh and /decdn.ps1 to distinct handlers. |
| crates/server/src/http/installer.rs | Refactors installer rendering and adds PowerShell script handler. |
| crates/server/assets/decdn.sh | Normalizes arch values to x86_64/aarch64 for binary naming. |
| crates/server/assets/decdn.ps1 | Adds a Windows installer script that installs binaries and writes sponsor.toml. |
| .github/workflows/ci.yml | Adds initial multi-OS CI, including Windows ARM64 clippy for the client crate. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- ci: `rustup target add` from inside the checkout, so the Windows ARM64 target lands on the toolchain rust-toolchain.toml pins (the action's `targets:` went to its own toolchain, leaving no aarch64 std). - decdn.ps1: the TLS protocol list is process-wide, so save it and restore it in a `finally` instead of leaving it changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # README.md # crates/server/assets/decdn.sh # crates/wrapper/src/config.rs # crates/wrapper/src/flow.rs # crates/wrapper/tests/pull_flow.rs
The test faked the home directory by setting HOME, which Windows does not consult (home_dir reads the profile folder there), so it failed on the Windows runner while the code was right. Compare against home() instead, and drop the now-unused serial_test dev-dependency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Windows at launch, on x64 and ARM64. Stacked on #6 (base:
feat/decdn-sponsored).GET /decdn.ps1serves a PowerShell twin ofdecdn.sh, filled in from the same config. On Windows the website shows:decdn.exeanddecdn-sponsored.exeto%LOCALAPPDATA%\decdn\binand adds that to PATH, both for the user and for the running session, so the next command on the same line finds them.sponsor.tomlprofile, with forward-slash paths (no TOML escaping) and no byte-order mark (which Windows PowerShell 5.1 would otherwise add).irm | iexleaves no variables or preferences behind in the user's session, and it never callsexit(which would close their window).decdn.sh: now normalizes architectures tox86_64/aarch64, so/dl/<bin>-<os>-<arch>names match on every platform.std::env::home_dir, becauseHOMEis unset on Windows.rundll32 url.dll,FileProtocolHandler, which skipscmd's special-character parsing..cmdstub fordecdn. A contract test coversGET /decdn.ps1.decdn/decdnis checked out alongside sponsord so the../decdnpath dependencies resolve.Merge order: the Windows CI legs build against
decdnmain, which compiles for Windows only after decdn/decdn#2146 lands.Test plan
cargo fmt --check,cargo clippy --workspace --all-targets -D warnings,cargo test --workspace(31 passed)decdn.ps1under real PowerShell (mcr.microsoft.com/powershell, ARM64) against a fake gateway: 0 parse errors;irm | iexinstalls both binaries; the profile is correct; PATH is updated for the session; nothing leaks into the caller's scope; ARM64 detected; the one-call form passespull b3:…through todecdn-sponsored.exedecdn.exe(from feat(cli): build the user CLI for Windows x64 and ARM64 decdn#2146) built with cross and run under Wine:key-genthenwhoamiagree on the addressldexports every symbol ofiroh-relay'scdyliband overflows the 65,535 export limit. MSVC isn't affected.🤖 Generated with Claude Code