Update command sending from server API to use new daemon code
This commit is contained in:
parent
161e0f6165
commit
ee0da206c1
2 changed files with 26 additions and 8 deletions
|
@ -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]],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue