Skip to content

Commit 16968f5

Browse files
committed
feat: merge download page into homepage with client-side arch detection
Serve an HTML download page at GET / using UA Client Hints API (navigator.userAgentData.getHighEntropyValues) to auto-detect Windows ARM64 vs x64. The legacy User-Agent string is unreliable because Chrome/Edge on ARM64 reports "x64". When ?arch= is provided, the endpoint still returns a 302 redirect for CLI/curl compatibility. - Delete routes/download.ts, merge into routes/index.ts - Rename tests/download.test.ts to tests/index.test.ts - Update README to reflect unified endpoint
1 parent a9db3f1 commit 16968f5

4 files changed

Lines changed: 343 additions & 214 deletions

File tree

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
# vp-setup-exe-downloader
22

3-
Download redirector for the Vite+ Windows installer. Auto-detects CPU architecture and redirects to the correct GitHub release asset.
3+
Download page and redirector for the Vite+ Windows installer. Serves a landing page that auto-detects CPU architecture using [UA Client Hints](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/getHighEntropyValues) and links to the correct GitHub release asset.
44

55
## Endpoints
66

77
### `GET /`
88

9-
Redirects to the [Vite+ installation guide](https://viteplus.dev/guide/#install-vp).
9+
Serves the download page with client-side architecture detection.
1010

11-
### `GET /download`
12-
13-
Redirects to the latest `vp-setup.exe` GitHub release asset.
11+
- On Windows ARM64 browsers (Chrome/Edge 90+), the main download button automatically points to the ARM64 installer.
12+
- On all other browsers, defaults to the x64 installer.
13+
- A secondary link for the alternative architecture is always visible.
1414

1515
**Query parameters:**
1616

17-
| Param | Description | Example |
18-
| ------ | ------------------------------------------------ | ---------------------- |
19-
| `arch` | Override architecture detection (`x64`, `arm64`) | `?arch=arm64` |
20-
| `tag` | Pin to a specific release tag | `?tag=v0.1.17-alpha.0` |
17+
| Param | Description | Example |
18+
| ------ | ---------------------------------------------------- | ---------------------- |
19+
| `arch` | Skip the page and redirect directly (`x64`, `arm64`) | `?arch=arm64` |
20+
| `tag` | Pin to a specific release tag | `?tag=v0.1.17-alpha.0` |
21+
22+
When `?arch=` is provided, the endpoint returns a 302 redirect instead of the HTML page (useful for CLI/curl).
2123

22-
**Architecture detection:**
24+
### `GET /favicon.ico`
2325

24-
1. `?arch=` query parameter (explicit override)
25-
2. `User-Agent` header (detects `ARM64`/`aarch64`)
26-
3. Defaults to `x64`
26+
Redirects to the Vite+ favicon.
2727

2828
## Development
2929

routes/download.ts

Lines changed: 0 additions & 198 deletions
This file was deleted.

0 commit comments

Comments
 (0)