Include all server information in details endpoints for daemon to use
This commit is contained in:
parent
058f72c923
commit
59bfc212c9
|
@ -7,8 +7,9 @@ use Illuminate\Http\JsonResponse;
|
||||||
use Pterodactyl\Http\Controllers\Controller;
|
use Pterodactyl\Http\Controllers\Controller;
|
||||||
use Pterodactyl\Services\Eggs\EggConfigurationService;
|
use Pterodactyl\Services\Eggs\EggConfigurationService;
|
||||||
use Pterodactyl\Repositories\Eloquent\ServerRepository;
|
use Pterodactyl\Repositories\Eloquent\ServerRepository;
|
||||||
|
use Pterodactyl\Services\Servers\ServerConfigurationStructureService;
|
||||||
|
|
||||||
class ServerConfigurationController extends Controller
|
class ServerDetailsController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var \Pterodactyl\Services\Eggs\EggConfigurationService
|
* @var \Pterodactyl\Services\Eggs\EggConfigurationService
|
||||||
|
@ -20,21 +21,34 @@ class ServerConfigurationController extends Controller
|
||||||
*/
|
*/
|
||||||
private $repository;
|
private $repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService
|
||||||
|
*/
|
||||||
|
private $configurationStructureService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ServerConfigurationController constructor.
|
* ServerConfigurationController constructor.
|
||||||
*
|
*
|
||||||
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
|
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
|
||||||
|
* @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService
|
||||||
* @param \Pterodactyl\Services\Eggs\EggConfigurationService $eggConfigurationService
|
* @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->eggConfigurationService = $eggConfigurationService;
|
||||||
$this->repository = $repository;
|
$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 \Illuminate\Http\Request $request
|
||||||
* @param $uuid
|
* @param string $uuid
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*
|
*
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
|
@ -43,8 +57,9 @@ class ServerConfigurationController extends Controller
|
||||||
{
|
{
|
||||||
$server = $this->repository->getByUuid($uuid);
|
$server = $this->repository->getByUuid($uuid);
|
||||||
|
|
||||||
return JsonResponse::create(
|
return JsonResponse::create([
|
||||||
$this->eggConfigurationService->handle($server)
|
'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.
|
// Routes for the Wings daemon.
|
||||||
Route::post('/sftp/auth', 'SftpAuthenticationController');
|
Route::post('/sftp/auth', 'SftpAuthenticationController');
|
||||||
Route::group(['prefix' => '/servers/{uuid}'], function () {
|
Route::group(['prefix' => '/servers/{uuid}'], function () {
|
||||||
Route::get('/configuration', 'Servers\ServerConfigurationController');
|
Route::get('/', 'Servers\ServerDetailsController');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue