Update API calls to Wings to only pass the required details with the changes to the installer system

This commit is contained in:
Dane Everitt 2021-08-29 14:09:43 -07:00
parent 869bc22103
commit e96ead4c4d
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
4 changed files with 23 additions and 39 deletions

View file

@ -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);
}
}