Skip to content

Commit 59bfc21

Browse files
committed
Include all server information in details endpoints for daemon to use
1 parent 058f72c commit 59bfc21

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

app/Http/Controllers/Api/Remote/Servers/ServerConfigurationController.php renamed to app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
use Pterodactyl\Http\Controllers\Controller;
88
use Pterodactyl\Services\Eggs\EggConfigurationService;
99
use Pterodactyl\Repositories\Eloquent\ServerRepository;
10+
use Pterodactyl\Services\Servers\ServerConfigurationStructureService;
1011

11-
class ServerConfigurationController extends Controller
12+
class ServerDetailsController extends Controller
1213
{
1314
/**
1415
* @var \Pterodactyl\Services\Eggs\EggConfigurationService
@@ -20,21 +21,34 @@ class ServerConfigurationController extends Controller
2021
*/
2122
private $repository;
2223

24+
/**
25+
* @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService
26+
*/
27+
private $configurationStructureService;
28+
2329
/**
2430
* ServerConfigurationController constructor.
2531
*
2632
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
33+
* @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $configurationStructureService
2734
* @param \Pterodactyl\Services\Eggs\EggConfigurationService $eggConfigurationService
2835
*/
29-
public function __construct(ServerRepository $repository, EggConfigurationService $eggConfigurationService)
30-
{
36+
public function __construct(
37+
ServerRepository $repository,
38+
ServerConfigurationStructureService $configurationStructureService,
39+
EggConfigurationService $eggConfigurationService
40+
) {
3141
$this->eggConfigurationService = $eggConfigurationService;
3242
$this->repository = $repository;
43+
$this->configurationStructureService = $configurationStructureService;
3344
}
3445

3546
/**
47+
* Returns details about the server that allows Wings to self-recover and ensure
48+
* that the state of the server matches the Panel at all times.
49+
*
3650
* @param \Illuminate\Http\Request $request
37-
* @param $uuid
51+
* @param string $uuid
3852
* @return \Illuminate\Http\JsonResponse
3953
*
4054
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
@@ -43,8 +57,9 @@ public function __invoke(Request $request, $uuid)
4357
{
4458
$server = $this->repository->getByUuid($uuid);
4559

46-
return JsonResponse::create(
47-
$this->eggConfigurationService->handle($server)
48-
);
60+
return JsonResponse::create([
61+
'settings' => $this->configurationStructureService->handle($server),
62+
'process_configuration' => $this->eggConfigurationService->handle($server),
63+
]);
4964
}
5065
}

routes/api-remote.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
// Routes for the Wings daemon.
1313
Route::post('/sftp/auth', 'SftpAuthenticationController');
1414
Route::group(['prefix' => '/servers/{uuid}'], function () {
15-
Route::get('/configuration', 'Servers\ServerConfigurationController');
15+
Route::get('/', 'Servers\ServerDetailsController');
1616
});

0 commit comments

Comments
 (0)