mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-12-05 08:44:59 -06:00
Add POST /api/v1/launcher/releases so the launcher workflow can upload its release zip directly instead of someone uploading it in the admin tool. The zip goes through the same validation and publisher. - Requires LAUNCHER_PUBLISH_TOKEN as a bearer token (401 when wrong or missing); publishing through the API is disabled (403) while unset - Errors on launcher API routes are rendered as JSON, so the CI gets a 422 with the rejection reason without sending an Accept header - The Authorization header is no longer written to the exception log - Document that the CI treats "already been published" as a re-run - Rename the admin upload label to "Upload update files"
27 lines
884 B
PHP
27 lines
884 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use App\Classes\Launcher\LauncherReleasePublisher;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\Api\Admin\Tools\UploadLauncherReleaseRequest;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
/**
|
|
* Publishes launcher release zips uploaded by the launcher CI. Rejections are returned as 422 validation errors on "release".
|
|
*/
|
|
class LauncherReleaseController extends Controller
|
|
{
|
|
public function store(UploadLauncherReleaseRequest $request, LauncherReleasePublisher $publisher): JsonResponse
|
|
{
|
|
$release = $publisher->publish($request->file('release')->getRealPath());
|
|
|
|
return response()->json([
|
|
'version' => $release->version,
|
|
'channel' => $release->channel,
|
|
'warnings' => $publisher->warnings,
|
|
'pruned_versions' => $publisher->prunedVersions,
|
|
], 201);
|
|
}
|
|
}
|