diff --git a/api/api.go b/api/api.go index 161a7d2..1848190 100644 --- a/api/api.go +++ b/api/api.go @@ -32,7 +32,7 @@ func (r *PanelRequest) GetClient() *http.Client { func (r *PanelRequest) SetHeaders(req *http.Request) *http.Request { req.Header.Set("Accept", "application/vnd.pterodactyl.v1+json") req.Header.Set("Content-Type", "application/json") - req.Header.Set("Authorization", "Bearer "+config.Get().AuthenticationToken) + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s.%s", config.Get().AuthenticationTokenId, config.Get().AuthenticationToken)) return req } diff --git a/config/config.go b/config/config.go index 910f06a..0177672 100644 --- a/config/config.go +++ b/config/config.go @@ -21,6 +21,17 @@ type Configuration struct { // if the debug flag is passed through the command line arguments. Debug bool + // A unique identifier for this node in the Panel. + Uuid string + + // An identifier for the token which must be included in any requests to the panel + // so that the token can be looked up correctly. + AuthenticationTokenId string `yaml:"token_id"` + + // The token used when performing operations. Requests to this instance must + // validate against it. + AuthenticationToken string `yaml:"token"` + Api ApiConfiguration System SystemConfiguration Docker DockerConfiguration @@ -55,10 +66,6 @@ type Configuration struct { // The location where the panel is running that this daemon should connect to // to collect data and send events. PanelLocation string `yaml:"remote"` - - // The token used when performing operations. Requests to this instance must - // validate against it. - AuthenticationToken string `yaml:"token"` } // Defines basic system configuration settings. diff --git a/server/filesystem.go b/server/filesystem.go index 02b6e2b..e597269 100644 --- a/server/filesystem.go +++ b/server/filesystem.go @@ -18,6 +18,7 @@ import ( "strconv" "strings" "sync" + "sync/atomic" "time" ) @@ -170,10 +171,11 @@ func (fs *Filesystem) DirectorySize(dir string) (int64, error) { defer wg.Done() s, _ := fs.DirectorySize(p) - size += s + + atomic.AddInt64(&size, s) }(filepath.Join(cleaned, f.Name())) } else { - size += f.Size() + atomic.AddInt64(&size, f.Size()) } }