Update API calls to Wings to only pass the required details with the changes to the installer system
This commit is contained in:
parent
869bc22103
commit
e96ead4c4d
4 changed files with 23 additions and 39 deletions
|
@ -35,18 +35,18 @@ class DaemonServerRepository extends DaemonRepository
|
|||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function create(array $data): void
|
||||
public function create(bool $startOnCompletion = true): void
|
||||
{
|
||||
Assert::isInstanceOf($this->server, Server::class);
|
||||
|
||||
try {
|
||||
$this->getHttpClient()->post(
|
||||
'/api/servers',
|
||||
[
|
||||
'json' => $data,
|
||||
]
|
||||
);
|
||||
} catch (TransferException $exception) {
|
||||
$this->getHttpClient()->post('/api/servers', [
|
||||
'json' => [
|
||||
'uuid' => $this->server->uuid,
|
||||
'start_on_completion' => $startOnCompletion,
|
||||
],
|
||||
]);
|
||||
} catch (GuzzleException $exception) {
|
||||
throw new DaemonConnectionException($exception);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,28 +2,31 @@
|
|||
|
||||
namespace Pterodactyl\Repositories\Wings;
|
||||
|
||||
use Pterodactyl\Models\Node;
|
||||
use Lcobucci\JWT\Token\Plain;
|
||||
use Pterodactyl\Models\Server;
|
||||
use GuzzleHttp\Exception\TransferException;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
|
||||
|
||||
class DaemonTransferRepository extends DaemonRepository
|
||||
{
|
||||
/**
|
||||
* @throws DaemonConnectionException
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function notify(Server $server, array $data, Node $node, string $token): void
|
||||
public function notify(Server $server, Plain $token): void
|
||||
{
|
||||
try {
|
||||
$this->getHttpClient()->post('/api/transfer', [
|
||||
'json' => [
|
||||
'server_id' => $server->uuid,
|
||||
'url' => $node->getConnectionAddress() . sprintf('/api/servers/%s/archive', $server->uuid),
|
||||
'token' => 'Bearer ' . $token,
|
||||
'server' => $data,
|
||||
'url' => $server->node->getConnectionAddress() . sprintf('/api/servers/%s/archive', $server->uuid),
|
||||
'token' => 'Bearer ' . $token->toString(),
|
||||
'server' => [
|
||||
'uuid' => $server->uuid,
|
||||
'start_on_completion' => false,
|
||||
],
|
||||
],
|
||||
]);
|
||||
} catch (TransferException $exception) {
|
||||
} catch (GuzzleException $exception) {
|
||||
throw new DaemonConnectionException($exception);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue