Streaming Transfers (#4548)

This commit is contained in:
Matthew Penner 2022-11-14 18:25:07 -07:00 committed by GitHub
parent 032e4f2e31
commit df2402b54f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 106 deletions

View file

@ -2,8 +2,8 @@
namespace Pterodactyl\Repositories\Wings;
use Pterodactyl\Models\Node;
use Lcobucci\JWT\Token\Plain;
use Pterodactyl\Models\Server;
use GuzzleHttp\Exception\GuzzleException;
use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
@ -12,16 +12,16 @@ class DaemonTransferRepository extends DaemonRepository
/**
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function notify(Server $server, Plain $token): void
public function notify(Node $targetNode, Plain $token): void
{
try {
$this->getHttpClient()->post('/api/transfer', [
$this->getHttpClient()->post(sprintf('/api/servers/%s/transfer', $this->server->uuid), [
'json' => [
'server_id' => $server->uuid,
'url' => $server->node->getConnectionAddress() . sprintf('/api/servers/%s/archive', $server->uuid),
'server_id' => $this->server->uuid,
'url' => $targetNode->getConnectionAddress() . '/api/transfers',
'token' => 'Bearer ' . $token->toString(),
'server' => [
'uuid' => $server->uuid,
'uuid' => $this->server->uuid,
'start_on_completion' => false,
],
],