diff --git a/router/router_server.go b/router/router_server.go index a275845..17d14b3 100644 --- a/router/router_server.go +++ b/router/router_server.go @@ -24,10 +24,9 @@ type serverProcData struct { // Returns a single server from the collection of servers. func getServer(c *gin.Context) { s := ExtractServer(c) - - c.JSON(http.StatusOK, serverProcData{ - ResourceUsage: s.Proc(), - Suspended: s.IsSuspended(), + c.JSON(http.StatusOK, ServerJsonResponse{ + Configuration: s.Config(), + Resources: s.Proc(), }) } diff --git a/router/router_system.go b/router/router_system.go index 58ff70c..28ee144 100644 --- a/router/router_system.go +++ b/router/router_system.go @@ -14,6 +14,13 @@ import ( "github.com/pterodactyl/wings/system" ) +// ServerJsonResponse is a type returned when requesting details about a single +// server instance on Wings. +type ServerJsonResponse struct { + *server.Configuration + Resources server.ResourceUsage `json:"resources"` +} + // Returns information about the system that wings is running on. func getSystemInformation(c *gin.Context) { i, err := system.GetSystemInformation() @@ -29,15 +36,10 @@ 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) { - type serverItem struct { - *server.Configuration - Resources server.ResourceUsage `json:"resources"` - } - servers := middleware.ExtractManager(c).All() - out := make([]serverItem, len(servers), len(servers)) + out := make([]ServerJsonResponse, len(servers), len(servers)) for i, v := range servers { - out[i] = serverItem{ + out[i] = ServerJsonResponse{ Configuration: v.Config(), Resources: v.Proc(), }