This commit is contained in:
Matthew Penner 2022-12-14 18:08:50 -07:00
parent 7ed2be50fd
commit 3670dc6d4b
No known key found for this signature in database
5 changed files with 5 additions and 10 deletions

View file

@ -14,6 +14,7 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest
{
public function rules(): array
{
/** @var \Pterodactyl\Models\Server $server */
$server = $this->route()->parameter('server');
return [

View file

@ -13,6 +13,6 @@ class DownloadFileRequest extends ClientApiRequest
*/
public function authorize(): bool
{
return $this->user()->can('file.read', $this->parameter('server', Server::class));
return $this->user()->can('file.read', $this->route()->parameter('server'));
}
}

View file

@ -148,7 +148,7 @@ class Node extends Model
*/
public function getConnectionAddress(): string
{
return sprintf('%s://%s:%s', $this->scheme, $this->fqdn, $this->daemonListen);
return sprintf('%s://%s:%s', $this->scheme, $this->fqdn, $this->public_port_http);
}
/**

View file

@ -30,13 +30,7 @@ class NodeTransformer extends Transformer
*/
public function transform(Node $model): array
{
$response = collect($model->toArray())->mapWithKeys(function ($value, $key) {
// I messed up early in 2016 when I named this column as poorly
// as I did. This is the tragic result of my mistakes.
$key = ($key === 'daemonSFTP') ? 'daemonSftp' : $key;
return [snake_case($key) => $value];
})->toArray();
$response = $model->toArray();
$response['created_at'] = self::formatTimestamp($model->created_at);
$response['updated_at'] = self::formatTimestamp($model->updated_at);

View file

@ -45,7 +45,7 @@ class ServerTransformer extends Transformer
'is_node_under_maintenance' => $server->node->isUnderMaintenance(),
'sftp_details' => [
'ip' => $server->node->fqdn,
'port' => $server->node->daemonSFTP,
'port' => $server->node->public_port_sftp,
],
'description' => $server->description,
'limits' => [