Files
Deathgarden_Rebirth-Rewrite/dist/app/Http/Controllers/Web/Admin/Tools/VersioningController.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

63 lines
1.9 KiB
PHP

<?php
namespace App\Http\Controllers\Web\Admin\Tools;
use App\Enums\Auth\Permissions;
use App\Http\Requests\Api\Admin\Tools\SaveVersioningRequest;
use App\Models\Admin\Versioning\CurrentCatalogVersion;
use App\Models\Admin\Versioning\CurrentContentVersion;
use App\Models\Admin\Versioning\CurrentGameVersion;
use Session;
class VersioningController extends AdminToolController
{
protected static string $name = 'Versioning';
protected static string $description = 'Manage the Game, Content & Catalog Versions';
protected static string $iconComponent = 'icons.arrow-left-right';
protected static Permissions $neededPermission = Permissions::FILE_UPLOAD;
public function index()
{
return view('admin.tools.versioning');
}
public function save(SaveVersioningRequest $request)
{
$errorMessage = '';
$successMessage = '';
$success = (new CurrentGameVersion($request->gameVersion))->save();
if ($success === true) {
$successMessage .= "Game version saved\n\n";
} else {
$errorMessage .= "Game version saving failed: ' . $success\n\n";
}
$success = (new CurrentContentVersion($request->contentVersion))->save();
if ($success === true) {
$successMessage .= "Content version saved\n\n";
} else {
$errorMessage .= "Content version saving failed: ' . $success\n\n";
}
(new CurrentCatalogVersion($request->catalogVersion))->save();
if ($success === true) {
$successMessage .= "Catalog version saved\n\n";
} else {
$errorMessage .= "Catalog version saving failed: ' . $success\n\n";
}
if ($success !== '') {
Session::flash('alert-success', nl2br(trim($successMessage)));
}
if ($errorMessage !== '') {
Session::flash('alert-error', nl2br(trim($errorMessage)));
}
return back();
}
}