More API response fixing
This commit is contained in:
@@ -18,11 +18,7 @@ import (
|
||||
|
||||
// Returns a single server from the collection of servers.
|
||||
func getServer(c *gin.Context) {
|
||||
s := ExtractServer(c)
|
||||
c.JSON(http.StatusOK, ServerJsonResponse{
|
||||
Configuration: s.Config(),
|
||||
Resources: s.Proc(),
|
||||
})
|
||||
c.JSON(http.StatusOK, ExtractServer(c).ToAPIResponse())
|
||||
}
|
||||
|
||||
// Returns the logs for a given server instance.
|
||||
|
||||
@@ -14,13 +14,6 @@ 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()
|
||||
@@ -37,12 +30,9 @@ func getSystemInformation(c *gin.Context) {
|
||||
// this wings instance.
|
||||
func getAllServers(c *gin.Context) {
|
||||
servers := middleware.ExtractManager(c).All()
|
||||
out := make([]ServerJsonResponse, len(servers), len(servers))
|
||||
out := make([]server.APIResponse, len(servers), len(servers))
|
||||
for i, v := range servers {
|
||||
out[i] = ServerJsonResponse{
|
||||
Configuration: v.Config(),
|
||||
Resources: v.Proc(),
|
||||
}
|
||||
out[i] = v.ToAPIResponse()
|
||||
}
|
||||
c.JSON(http.StatusOK, out)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user