Files
PS_Launcher/installer/README.md
j.foucher b7de228bc9 v0.6 + v1.0: HMAC download URLs, launcher self-update, Inno Setup installer
Three deliverables shipped together so the next deployment cycle has a
clean distribution story.

(1) Auto-update of the launcher itself
---------------------------------------
- Models: RemoteManifest gains an optional `launcher` section
  (LauncherInfo: version, minRequired, download {url,size,sha256},
   releaseNotesUrl). Server-side, sign-manifest.php passes it through
  unchanged; admins edit versions.json with the new launcher entry +
  upload PSLauncher-X.Y.Z.exe to /builds/launcher/.
- Core: ILauncherSelfUpdater compares assembly version against
  manifest.launcher.version using the existing SemVer parser, and
  reuses DownloadManager (Range/resume/sha256 already proven on the
  game ZIPs) to download the new exe into
  %LocalAppData%/PSLauncher/selfupdate/.
- New project PSLauncher.Updater (~34 MB self-contained console exe):
  spawned by the main app with --target / --source / --pid / --launch.
  Waits for the main process to exit (or for the file lock to release),
  backs up the current exe to .bak, copies the new file in place, and
  restarts. .bak survives the swap so the user can roll back manually.
- App.csproj now declares Version=0.5.0 — currently shipped baseline.
  PSLauncher.App.csproj sets a fixed AssemblyVersion so reflection-based
  comparison works deterministically.
- MainViewModel.PromptLauncherUpdate: dialog after CheckForUpdates if
  the manifest advertises a newer launcher. Download with progress in
  the existing footer, then Application.Shutdown() so the Updater can
  do its job.

(2) Inno Setup installer
------------------------
installer/PSLauncher.iss + build-installer.ps1 produce a single
PSLauncher-Setup-X.Y.Z.exe (~80 MB) that installs into
Program Files\ASTERION VR\PSLauncher\, drops both PSLauncher.exe and
PSLauncher.Updater.exe side by side (the updater MUST live next to
the target), creates Start Menu + optional Desktop shortcuts, and
registers a clean uninstall entry. The user's %LocalAppData%
(license, logs, cache) is intentionally untouched on uninstall — same
license survives a reinstall.

build-installer.ps1 chains dotnet publish for both projects and ISCC
in one command. README explains the bump-version workflow.

(3) HMAC-signed download URLs
-----------------------------
- New PHP route GET /api/download-url/{version} (Authorization: Bearer
  <licenseKey> or ?key=...). Validates the license, checks
  download_entitlement_until >= minLicenseDate of the version, and
  returns a HMAC-signed URL (path|exp|licId, hash_hmac SHA-256, valid
  1 h) + sha256 + sizeBytes for verification.
- /builds/.htaccess routes every *.zip request to gate.php. gate.php
  validates exp, lic, sig (constant-time hash_equals), then streams
  the file with Range: support so the launcher's resume keeps working.
  Audit log gets a download_url_issued entry per request.
- Client-side wired transparently: LicenseService gains
  GetSignedDownloadUrlAsync(version) that GETs the endpoint with the
  decrypted license key from DPAPI. MainViewModel calls it before
  every download; if the endpoint returns 404/401/network-error, the
  client falls back to the manifest's plain download.url (graceful
  degradation for setups that haven't deployed gate.php yet).

Note on PHP streaming for 14 GB ZIPs: gate.php uses set_time_limit(0)
+ ignore_user_abort(true) + 1 MiB chunked fread with periodic flush.
Works on OVH mutualisé but holds a PHP-FPM slot for the duration. If
parallel downloads scale past a few clients, switch to
mod_xsendfile or migrate /builds/ to Cloudflare R2 with native
S3-presigned URLs and remove the gate entirely.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 09:38:13 +02:00

58 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PS_Launcher — Installeur
Génère un setup Windows (`PSLauncher-Setup-{version}.exe`) qui distribue
le launcher principal + son updater dans `Program Files\ASTERION VR\PSLauncher\`.
## Pré-requis
- **.NET 8 SDK** (déjà installé pour build le projet)
- **Inno Setup 6.x** — https://jrsoftware.org/isdl.php (gratuit, ~6 Mo)
## Build en une commande
Depuis la racine du repo :
```powershell
powershell -ExecutionPolicy Bypass -File installer\build-installer.ps1
```
Ça enchaîne :
1. `dotnet publish src/PSLauncher.App -c Release``PSLauncher.exe` (~77 Mo)
2. `dotnet publish src/PSLauncher.Updater -c Release``PSLauncher.Updater.exe` (~10 Mo)
3. `ISCC PSLauncher.iss``installer/output/PSLauncher-Setup-X.Y.Z.exe`
Le fichier final fait ~80 Mo (compression ultra Inno + binaires self-contained).
## Distribution
Tu balances **un seul `.exe`** au client :
- Il lance, choisit français/anglais, clique Suivant×3, c'est installé.
- Raccourci bureau + menu Démarrer créés.
- Désinstallation propre via Programmes et fonctionnalités.
Le cache utilisateur (`%LocalAppData%\PSLauncher\config.json`, logs, downloads partiels)
n'est **pas** touché par l'install/désinstall — la license et les paramètres survivent.
## Mise à jour du launcher
Le launcher se met à jour seul via `PSLauncher.Updater.exe` (cf. flow auto-update).
Le client n'a pas besoin de rejouer l'installeur sauf changement majeur (TFM, déps).
## Bumper la version
Avant de rebuild un installeur :
1. `src/PSLauncher.App/PSLauncher.App.csproj``<Version>X.Y.Z</Version>` (et AssemblyVersion / FileVersion)
2. `installer/PSLauncher.iss``#define MyAppVersion "X.Y.Z"`
3. `installer/build-installer.ps1`
Côté serveur, mets aussi à jour `manifest/versions.json` section `launcher` avec la
nouvelle version + URL de download du nouveau `PSLauncher.exe` (via le backoffice
ou édition manuelle, puis `php tools/sign-manifest.php`).
## Code-signing (optionnel)
Pour éviter le warning SmartScreen "éditeur inconnu", il faut signer
`PSLauncher.exe`, `PSLauncher.Updater.exe` et `PSLauncher-Setup-X.Y.Z.exe` avec
un certificat Authenticode (OV ~250 €/an, EV ~400 €/an, ou gratuit via SignPath
pour OSS). Hors-scope du script actuel.