commit
76b7967fef
|
@ -247,6 +247,8 @@ type Configuration struct {
|
||||||
// if the debug flag is passed through the command line arguments.
|
// if the debug flag is passed through the command line arguments.
|
||||||
Debug bool
|
Debug bool
|
||||||
|
|
||||||
|
AppName string `default:"Pterodactyl" json:"app_name" yaml:"app_name"`
|
||||||
|
|
||||||
// A unique identifier for this node in the Panel.
|
// A unique identifier for this node in the Panel.
|
||||||
Uuid string
|
Uuid string
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,11 @@ import (
|
||||||
"github.com/pterodactyl/wings/system"
|
"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")
|
var ErrTooMuchConsoleData = errors.New("console is outputting too much data")
|
||||||
|
|
||||||
type ConsoleThrottler struct {
|
type ConsoleThrottler struct {
|
||||||
|
@ -122,11 +127,14 @@ func (s *Server) Throttler() *ConsoleThrottler {
|
||||||
return s.throttler
|
return s.throttler
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sends output to the server console formatted to appear correctly as being sent
|
// PublishConsoleOutputFromDaemon sends output to the server console formatted
|
||||||
// from Wings.
|
// to appear correctly as being sent from Wings.
|
||||||
func (s *Server) PublishConsoleOutputFromDaemon(data string) {
|
func (s *Server) PublishConsoleOutputFromDaemon(data string) {
|
||||||
|
if appName == "" {
|
||||||
|
appName = config.Get().AppName
|
||||||
|
}
|
||||||
s.Events().Publish(
|
s.Events().Publish(
|
||||||
ConsoleOutputEvent,
|
ConsoleOutputEvent,
|
||||||
colorstring.Color(fmt.Sprintf("[yellow][bold][Pterodactyl Daemon]:[default] %s", data)),
|
colorstring.Color(fmt.Sprintf("[yellow][bold][%s Daemon]:[default] %s", appName, data)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user