Path: blob/1.0-develop/app/Http/Controllers/Api/Remote/EggInstallController.php
10280 views
<?php12namespace Pterodactyl\Http\Controllers\Api\Remote;34use Illuminate\Http\Request;5use Illuminate\Http\JsonResponse;6use Pterodactyl\Http\Controllers\Controller;7use Pterodactyl\Services\Servers\EnvironmentService;8use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;910class EggInstallController extends Controller11{12/**13* EggInstallController constructor.14*/15public function __construct(private EnvironmentService $environment, private ServerRepositoryInterface $repository)16{17}1819/**20* Handle request to get script and installation information for a server21* that is being created on the node.22*23* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException24*/25public function index(Request $request, string $uuid): JsonResponse26{27$node = $request->attributes->get('node');2829/** @var \Pterodactyl\Models\Server $server */30$server = $this->repository->findFirstWhere([31['uuid', '=', $uuid],32['node_id', '=', $node->id],33]);3435$this->repository->loadEggRelations($server);36$egg = $server->getRelation('egg');3738return response()->json([39'scripts' => [40'install' => !$egg->copy_script_install ? null : str_replace(["\r\n", "\n", "\r"], "\n", $egg->copy_script_install),41'privileged' => $egg->script_is_privileged,42],43'config' => [44'container' => $egg->copy_script_container,45'entry' => $egg->copy_script_entry,46],47'env' => $this->environment->handle($server),48]);49}50}515253