mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-17 22:03:44 +02:00
Update command sending from server API to use new daemon code
This commit is contained in:
@@ -2,6 +2,27 @@
|
||||
|
||||
namespace Pterodactyl\Repositories\Wings;
|
||||
|
||||
use Webmozart\Assert\Assert;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class DaemonCommandRepository extends DaemonRepository
|
||||
{
|
||||
/**
|
||||
* Sends a command or multiple commands to a running server instance.
|
||||
*
|
||||
* @param string|string[] $command
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
*/
|
||||
public function send($command): ResponseInterface
|
||||
{
|
||||
Assert::isInstanceOf(Server::class, $this->server);
|
||||
|
||||
return $this->getHttpClient()->post(
|
||||
sprintf('/api/servers/%s/commands', $this->server->uuid),
|
||||
[
|
||||
'json' => ['commands' => is_array($command) ? $command : [$command]],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user