repository = $repository; $this->eventDispatcher = $eventDispatcher; } /** * Returns installation information for a server. * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function index(Request $request, string $uuid): JsonResponse { $server = $this->repository->getByUuid($uuid); $egg = $server->egg; return new JsonResponse([ 'container_image' => $egg->copy_script_container, 'entrypoint' => $egg->copy_script_entry, 'script' => $egg->copy_script_install, ]); } /** * Updates the installation state of a server. * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ public function store(InstallationDataRequest $request, string $uuid): Response { $server = $this->repository->getByUuid($uuid); $status = $request->boolean('successful') ? null : Server::STATUS_INSTALL_FAILED; if ($server->status === Server::STATUS_SUSPENDED) { $status = Server::STATUS_SUSPENDED; } $this->repository->update($server->id, ['status' => $status], true, true); // If the server successfully installed, fire installed event. if ($status === null) { $this->eventDispatcher->dispatch(new ServerInstalled($server)); } return new Response('', Response::HTTP_NO_CONTENT); } }