diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerConfigurationController.php b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php similarity index 52% rename from app/Http/Controllers/Api/Remote/Servers/ServerConfigurationController.php rename to app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php index eeb157542..c9d9f4bc6 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerConfigurationController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php @@ -7,8 +7,9 @@ use Illuminate\Http\JsonResponse; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Services\Eggs\EggConfigurationService; use Pterodactyl\Repositories\Eloquent\ServerRepository; +use Pterodactyl\Services\Servers\ServerConfigurationStructureService; -class ServerConfigurationController extends Controller +class ServerDetailsController extends Controller { /** * @var \Pterodactyl\Services\Eggs\EggConfigurationService @@ -20,21 +21,34 @@ class ServerConfigurationController extends Controller */ private $repository; + /** + * @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService + */ + private $configurationStructureService; + /** * ServerConfigurationController constructor. * * @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository + * @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService * @param \Pterodactyl\Services\Eggs\EggConfigurationService $eggConfigurationService */ - public function __construct(ServerRepository $repository, EggConfigurationService $eggConfigurationService) - { + public function __construct( + ServerRepository $repository, + ServerConfigurationStructureService $configurationStructureService, + EggConfigurationService $eggConfigurationService + ) { $this->eggConfigurationService = $eggConfigurationService; $this->repository = $repository; + $this->configurationStructureService = $configurationStructureService; } /** + * Returns details about the server that allows Wings to self-recover and ensure + * that the state of the server matches the Panel at all times. + * * @param \Illuminate\Http\Request $request - * @param $uuid + * @param string $uuid * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException @@ -43,8 +57,9 @@ class ServerConfigurationController extends Controller { $server = $this->repository->getByUuid($uuid); - return JsonResponse::create( - $this->eggConfigurationService->handle($server) - ); + return JsonResponse::create([ + 'settings' => $this->configurationStructureService->handle($server), + 'process_configuration' => $this->eggConfigurationService->handle($server), + ]); } } diff --git a/routes/api-remote.php b/routes/api-remote.php index f35810ac1..476e90512 100644 --- a/routes/api-remote.php +++ b/routes/api-remote.php @@ -12,5 +12,5 @@ Route::group(['prefix' => '/scripts'], function () { // Routes for the Wings daemon. Route::post('/sftp/auth', 'SftpAuthenticationController'); Route::group(['prefix' => '/servers/{uuid}'], function () { - Route::get('/configuration', 'Servers\ServerConfigurationController'); + Route::get('/', 'Servers\ServerDetailsController'); });