File tree Expand file tree Collapse file tree 2 files changed +15
-10
lines changed
app/Transformers/Api/Client
resources/scripts/api/server Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change 55use Pterodactyl \Models \Egg ;
66use Pterodactyl \Models \Server ;
77use Pterodactyl \Models \Subuser ;
8+ use Pterodactyl \Models \Allocation ;
89
910class ServerTransformer extends BaseClientTransformer
1011{
@@ -41,10 +42,14 @@ public function transform(Server $server): array
4142 'port ' => $ server ->node ->daemonSFTP ,
4243 ],
4344 'description ' => $ server ->description ,
44- 'allocation ' => [
45- 'ip ' => $ server ->allocation ->alias ,
46- 'port ' => $ server ->allocation ->port ,
47- ],
45+ 'allocations ' => $ server ->allocations ->map (function (Allocation $ allocation ) use ($ server ) {
46+ return [
47+ 'ip ' => $ allocation ->ip ,
48+ 'ip_alias ' => $ allocation ->ip_alias ,
49+ 'port ' => $ allocation ->port ,
50+ 'is_default ' => $ allocation ->id === $ server ->allocation_id ,
51+ ];
52+ }),
4853 'limits ' => [
4954 'memory ' => $ server ->memory ,
5055 'swap ' => $ server ->swap ,
Original file line number Diff line number Diff line change @@ -45,12 +45,12 @@ export const rawDataToServerObject = (data: any): Server => ({
4545 port : data . sftp_details . port ,
4646 } ,
4747 description : data . description ? ( ( data . description . length > 0 ) ? data . description : null ) : null ,
48- allocations : [ {
49- ip : data . allocation . ip ,
50- alias : null ,
51- port : data . allocation . port ,
52- default : true ,
53- } ] ,
48+ allocations : ( data . allocations || [ ] ) . map ( ( datum : any ) => ( {
49+ ip : datum . ip ,
50+ alias : datum . ip_alias ,
51+ port : datum . port ,
52+ default : datum . is_default ,
53+ } ) ) ,
5454 limits : { ...data . limits } ,
5555 featureLimits : { ...data . feature_limits } ,
5656 isSuspended : data . is_suspended ,
You can’t perform that action at this time.
0 commit comments