api: cleanup controllers
This commit is contained in:
parent
00c42225e8
commit
f78aaea6a3
47 changed files with 323 additions and 764 deletions
|
@ -12,10 +12,7 @@ use Pterodactyl\Http\Requests\Api\Remote\InstallationDataRequest;
|
|||
|
||||
class ServerInstallController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var \Pterodactyl\Repositories\Eloquent\ServerRepository
|
||||
*/
|
||||
private $repository;
|
||||
private ServerRepository $repository;
|
||||
|
||||
/**
|
||||
* ServerInstallController constructor.
|
||||
|
@ -28,16 +25,14 @@ class ServerInstallController extends Controller
|
|||
/**
|
||||
* Returns installation information for a server.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function index(Request $request, string $uuid)
|
||||
public function index(Request $request, string $uuid): JsonResponse
|
||||
{
|
||||
$server = $this->repository->getByUuid($uuid);
|
||||
$egg = $server->egg;
|
||||
|
||||
return JsonResponse::create([
|
||||
return new JsonResponse([
|
||||
'container_image' => $egg->copy_script_container,
|
||||
'entrypoint' => $egg->copy_script_entry,
|
||||
'script' => $egg->copy_script_install,
|
||||
|
@ -47,12 +42,10 @@ class ServerInstallController extends Controller
|
|||
/**
|
||||
* Updates the installation state of a server.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
*/
|
||||
public function store(InstallationDataRequest $request, string $uuid)
|
||||
public function store(InstallationDataRequest $request, string $uuid): Response
|
||||
{
|
||||
$server = $this->repository->getByUuid($uuid);
|
||||
|
||||
|
@ -63,6 +56,6 @@ class ServerInstallController extends Controller
|
|||
|
||||
$this->repository->update($server->id, ['status' => $status], true, true);
|
||||
|
||||
return new JsonResponse([], Response::HTTP_NO_CONTENT);
|
||||
return new Response('', Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue