diff --git a/app/Http/Controllers/Api/Client/Servers/CommandController.php b/app/Http/Controllers/Api/Client/Servers/CommandController.php index 6cc50de47..6b3a7ab45 100644 --- a/app/Http/Controllers/Api/Client/Servers/CommandController.php +++ b/app/Http/Controllers/Api/Client/Servers/CommandController.php @@ -8,7 +8,6 @@ use Pterodactyl\Facades\Activity; use Psr\Http\Message\ResponseInterface; use GuzzleHttp\Exception\BadResponseException; use Symfony\Component\HttpKernel\Exception\HttpException; -use Pterodactyl\Repositories\Wings\DaemonCommandRepository; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; use Pterodactyl\Http\Requests\Api\Client\Servers\SendCommandRequest; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; @@ -18,7 +17,7 @@ class CommandController extends ClientApiController /** * CommandController constructor. */ - public function __construct(private DaemonCommandRepository $repository) + public function __construct() { parent::__construct(); } @@ -31,7 +30,7 @@ class CommandController extends ClientApiController public function index(SendCommandRequest $request, Server $server): Response { try { - $this->repository->setServer($server)->send($request->input('command')); + $server->send($request->input('command')); } catch (DaemonConnectionException $exception) { $previous = $exception->getPrevious(); diff --git a/app/Jobs/Schedule/RunTaskJob.php b/app/Jobs/Schedule/RunTaskJob.php index 1e1ab2bb3..058ecb788 100644 --- a/app/Jobs/Schedule/RunTaskJob.php +++ b/app/Jobs/Schedule/RunTaskJob.php @@ -13,7 +13,6 @@ use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\DispatchesJobs; use Pterodactyl\Services\Backups\InitiateBackupService; use Pterodactyl\Repositories\Wings\DaemonPowerRepository; -use Pterodactyl\Repositories\Wings\DaemonCommandRepository; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; class RunTaskJob extends Job implements ShouldQueue @@ -36,7 +35,6 @@ class RunTaskJob extends Job implements ShouldQueue * @throws \Throwable */ public function handle( - DaemonCommandRepository $commandRepository, InitiateBackupService $backupService, DaemonPowerRepository $powerRepository ) { @@ -66,7 +64,7 @@ class RunTaskJob extends Job implements ShouldQueue $powerRepository->setServer($server)->send($this->task->payload); break; case Task::ACTION_COMMAND: - $commandRepository->setServer($server)->send($this->task->payload); + $server->send($this->task->payload); break; case Task::ACTION_BACKUP: $backupService->setIgnoredFiles(explode(PHP_EOL, $this->task->payload))->handle($server, null, true); diff --git a/app/Repositories/Wings/DaemonCommandRepository.php b/app/Repositories/Wings/DaemonCommandRepository.php deleted file mode 100644 index cde29ff36..000000000 --- a/app/Repositories/Wings/DaemonCommandRepository.php +++ /dev/null @@ -1,33 +0,0 @@ -server, Server::class); - - try { - return $this->getHttpClient()->post( - sprintf('/api/servers/%s/commands', $this->server->uuid), - [ - 'json' => ['commands' => is_array($command) ? $command : [$command]], - ] - ); - } catch (TransferException $exception) { - throw new DaemonConnectionException($exception); - } - } -}