diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 50d45e276..360ba20fa 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -5,6 +5,7 @@ namespace Pterodactyl\Transformers\Api\Client; use Pterodactyl\Models\Egg; use Pterodactyl\Models\Server; use Pterodactyl\Models\Subuser; +use Pterodactyl\Models\Allocation; class ServerTransformer extends BaseClientTransformer { @@ -41,10 +42,14 @@ class ServerTransformer extends BaseClientTransformer 'port' => $server->node->daemonSFTP, ], 'description' => $server->description, - 'allocation' => [ - 'ip' => $server->allocation->alias, - 'port' => $server->allocation->port, - ], + 'allocations' => $server->allocations->map(function (Allocation $allocation) use ($server) { + return [ + 'ip' => $allocation->ip, + 'ip_alias' => $allocation->ip_alias, + 'port' => $allocation->port, + 'is_default' => $allocation->id === $server->allocation_id, + ]; + }), 'limits' => [ 'memory' => $server->memory, 'swap' => $server->swap, diff --git a/resources/scripts/api/server/getServer.ts b/resources/scripts/api/server/getServer.ts index bd4f90ba8..0bd0b7798 100644 --- a/resources/scripts/api/server/getServer.ts +++ b/resources/scripts/api/server/getServer.ts @@ -45,12 +45,12 @@ export const rawDataToServerObject = (data: any): Server => ({ port: data.sftp_details.port, }, description: data.description ? ((data.description.length > 0) ? data.description : null) : null, - allocations: [ { - ip: data.allocation.ip, - alias: null, - port: data.allocation.port, - default: true, - } ], + allocations: (data.allocations || []).map((datum: any) => ({ + ip: datum.ip, + alias: datum.ip_alias, + port: datum.port, + default: datum.is_default, + })), limits: { ...data.limits }, featureLimits: { ...data.feature_limits }, isSuspended: data.is_suspended,