diff --git a/router/router_system.go b/router/router_system.go index b3eb1ce..58ff70c 100644 --- a/router/router_system.go +++ b/router/router_system.go @@ -10,6 +10,7 @@ import ( "github.com/pterodactyl/wings/config" "github.com/pterodactyl/wings/installer" "github.com/pterodactyl/wings/router/middleware" + "github.com/pterodactyl/wings/server" "github.com/pterodactyl/wings/system" ) @@ -28,7 +29,20 @@ func getSystemInformation(c *gin.Context) { // Returns all of the servers that are registered and configured correctly on // this wings instance. func getAllServers(c *gin.Context) { - c.JSON(http.StatusOK, middleware.ExtractManager(c).All()) + type serverItem struct { + *server.Configuration + Resources server.ResourceUsage `json:"resources"` + } + + servers := middleware.ExtractManager(c).All() + out := make([]serverItem, len(servers), len(servers)) + for i, v := range servers { + out[i] = serverItem{ + Configuration: v.Config(), + Resources: v.Proc(), + } + } + c.JSON(http.StatusOK, out) } // Creates a new server on the wings daemon and begins the installation process diff --git a/server/configuration.go b/server/configuration.go index b7f16b7..100b4ab 100644 --- a/server/configuration.go +++ b/server/configuration.go @@ -8,7 +8,7 @@ import ( type EggConfiguration struct { // The internal UUID of the Egg on the Panel. - ID string + ID string `json:"id"` // Maintains a list of files that are blacklisted for opening/editing/downloading // or basically any type of access on the server by any user. This is NOT the same @@ -43,7 +43,6 @@ type Configuration struct { Build environment.Limits `json:"build"` CrashDetectionEnabled bool `default:"true" json:"enabled" yaml:"enabled"` Mounts []Mount `json:"mounts"` - Resources ResourceUsage `json:"resources"` Egg EggConfiguration `json:"egg,omitempty"` Container struct {