Files
Deathgarden_Rebirth-Rewrite/dist/app/Http/Controllers/Web/LauncherFileController.php
Shaggy84675 8bb72bb2b7 Deliver launcher updates from signed CI release zips
Replace the manually set launcher version with releases uploaded from the
CI zip (exes, launcher-manifest.json and launcher-manifest.json.sig).

- New "Launcher" admin tool (renamed from Launcher Message): upload a
  release, switch the current one, delete old ones, set the launcher message
- Uploads are validated: manifest rules, size + SHA-256 of every exe, and
  the ECDSA manifest signature when LAUNCHER_UPDATE_PUBLIC_KEYS is set
- The same zip, manifest or version cannot be published twice; only the
  newest 5 releases are kept and the current one is never removed
- Serve the current release to the launcher at /launcher/{file},
  byte-for-byte and uncached, with range support for resumed downloads
- /download-launcher serves the newest framework build; the legacy
  /api/v1/launcher-version returns the current release version
- Remove the launcher version from the Versioning tool
- Fix the file input button highlighting when hovering the whole input
2026-11-14 14:15:45 +01:00

30 lines
1.1 KiB
PHP

<?php
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Models\Admin\LauncherRelease;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
/**
* Serves the current launcher release to the launcher's updater: launcher-manifest.json, its .sig and the exes the
* manifest lists. The bytes are served unchanged (the signature covers the exact manifest bytes) and never cached,
* because the exe names stay the same from one version to the next.
*/
class LauncherFileController extends Controller
{
public function show(string $fileName): BinaryFileResponse
{
$path = LauncherRelease::current()?->servableFilePath($fileName) ?? abort(404);
return response()->file($path, [
'Content-Type' => match ($fileName) {
LauncherRelease::MANIFEST_FILE_NAME => 'application/json',
LauncherRelease::SIGNATURE_FILE_NAME => 'text/plain; charset=utf-8',
default => 'application/octet-stream',
},
'Cache-Control' => 'no-cache, no-store, must-revalidate',
]);
}
}