Pass along new fields to Wings instance when endpoint is used; closes #4048

This commit is contained in:
DaneEveritt 2022-05-28 13:45:23 -04:00
parent 3fceb588fb
commit c14c7b436e
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 57 additions and 33 deletions

View file

@ -267,15 +267,23 @@ class DaemonFileRepository extends DaemonRepository
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function pull(string $url, ?string $directory): ResponseInterface
public function pull(string $url, ?string $directory, array $params = []): ResponseInterface
{
Assert::isInstanceOf($this->server, Server::class);
$attributes = [
'url' => $url,
'root' => $directory ?? '/',
'file_name' => $params['filename'] ?? null,
'use_header' => $params['use_header'] ?? null,
'foreground' => $params['foreground'] ?? null,
];
try {
return $this->getHttpClient()->post(
sprintf('/api/servers/%s/files/pull', $this->server->uuid),
[
'json' => ['url' => $url, 'directory' => $directory ?? '/'],
'json' => array_filter($attributes, fn ($value) => !is_null($value)),
]
);
} catch (TransferException $exception) {