Include all server information in details endpoints for daemon to use
This commit is contained in:
parent
058f72c923
commit
59bfc212c9
2 changed files with 23 additions and 8 deletions
|
@ -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),
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -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');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue