diff --git a/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php b/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php index 17368cd08..706af5de6 100644 --- a/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Servers/Databases/StoreServerDatabaseRequest.php @@ -14,6 +14,7 @@ class StoreServerDatabaseRequest extends ApplicationApiRequest { public function rules(): array { + /** @var \Pterodactyl\Models\Server $server */ $server = $this->route()->parameter('server'); return [ diff --git a/app/Http/Requests/Api/Client/Servers/Files/DownloadFileRequest.php b/app/Http/Requests/Api/Client/Servers/Files/DownloadFileRequest.php index c588c9b23..af1022bdc 100644 --- a/app/Http/Requests/Api/Client/Servers/Files/DownloadFileRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Files/DownloadFileRequest.php @@ -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')); } } diff --git a/app/Models/Node.php b/app/Models/Node.php index eb7d5cc25..1ab72a5bd 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -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); } /** diff --git a/app/Transformers/Api/Application/NodeTransformer.php b/app/Transformers/Api/Application/NodeTransformer.php index de3fd63da..093fcc962 100644 --- a/app/Transformers/Api/Application/NodeTransformer.php +++ b/app/Transformers/Api/Application/NodeTransformer.php @@ -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); diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 401c34905..01a2d135b 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -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' => [