diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 8dc2f56..aa58306 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -1,18 +1,18 @@ make(StartupCommandService::class); $user = $this->request->user(); - return [ + $data = [ 'server_owner' => $user->id === $server->owner_id, - 'identifier' => $server->uuidShort, + 'identifier' => $server->uuid_short, 'internal_id' => $server->id, 'uuid' => $server->uuid, 'name' => $server->name, @@ -46,7 +46,8 @@ class ServerTransformer extends BaseClientTransformer 'is_node_under_maintenance' => $server->node->isUnderMaintenance(), 'sftp_details' => [ 'ip' => $server->node->fqdn, - 'port' => $server->node->daemonSFTP, + 'alias' => $server->node->daemon_sftp_alias, + 'port' => $server->node->daemon_sftp, ], 'description' => $server->description, 'limits' => [ @@ -56,7 +57,9 @@ class ServerTransformer extends BaseClientTransformer 'io' => $server->io, 'cpu' => $server->cpu, 'threads' => $server->threads, - 'oom_disabled' => $server->oom_disabled, + // This field is deprecated, please use "oom_killer". + 'oom_disabled' => !$server->oom_killer, + 'oom_killer' => $server->oom_killer, ], 'invocation' => $service->handle($server, !$user->can(Permission::ACTION_STARTUP_READ, $server)), 'docker_image' => $server->image, @@ -78,12 +81,18 @@ class ServerTransformer extends BaseClientTransformer 'egg_id' => $server->egg_id, ], ]; + + if (!config('panel.editable_server_descriptions')) { + unset($data['description']); + } + + return $data; } /** * Returns the allocations associated with this server. * - * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException + * @throws \App\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeAllocations(Server $server): Collection { @@ -108,7 +117,7 @@ class ServerTransformer extends BaseClientTransformer } /** - * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException + * @throws \App\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeVariables(Server $server): Collection|NullResource { @@ -126,7 +135,7 @@ class ServerTransformer extends BaseClientTransformer /** * Returns the egg associated with this server. * - * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException + * @throws \App\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeEgg(Server $server): Item { @@ -136,7 +145,7 @@ class ServerTransformer extends BaseClientTransformer /** * Returns the subusers associated with this server. * - * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException + * @throws \App\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeSubusers(Server $server): Collection|NullResource { @@ -146,4 +155,4 @@ class ServerTransformer extends BaseClientTransformer return $this->collection($server->subusers, $this->makeTransformer(SubuserTransformer::class), Subuser::RESOURCE_NAME); } -} +} \ No newline at end of file