Merge branch 'develop' of github.com:pterodactyl/wings into develop

This commit is contained in:
Dane Everitt 2021-04-03 11:18:44 -07:00
commit ff62d16085
4 changed files with 29 additions and 6 deletions

View File

@ -247,6 +247,8 @@ type Configuration struct {
// if the debug flag is passed through the command line arguments.
Debug bool
AppName string `default:"Pterodactyl" json:"app_name" yaml:"app_name"`
// A unique identifier for this node in the Panel.
Uuid string

View File

@ -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

View File

@ -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 {

View File

@ -13,6 +13,11 @@ import (
"github.com/pterodactyl/wings/system"
)
// appName is a local cache variable to avoid having to make expensive copies of
// the configuration every time we need to send output along to the websocket for
// a server.
var appName string
var ErrTooMuchConsoleData = errors.New("console is outputting too much data")
type ConsoleThrottler struct {
@ -122,11 +127,14 @@ func (s *Server) Throttler() *ConsoleThrottler {
return s.throttler
}
// Sends output to the server console formatted to appear correctly as being sent
// from Wings.
// PublishConsoleOutputFromDaemon sends output to the server console formatted
// to appear correctly as being sent from Wings.
func (s *Server) PublishConsoleOutputFromDaemon(data string) {
if appName == "" {
appName = config.Get().AppName
}
s.Events().Publish(
ConsoleOutputEvent,
colorstring.Color(fmt.Sprintf("[yellow][bold][Pterodactyl Daemon]:[default] %s", data)),
colorstring.Color(fmt.Sprintf("[yellow][bold][%s Daemon]:[default] %s", appName, data)),
)
}