Merge branch 'develop' into issues/1899

This commit is contained in:
Matthew Penner 2020-04-10 17:27:39 -06:00
commit 4ea1b90560
3 changed files with 16 additions and 7 deletions

View File

@ -32,7 +32,7 @@ func (r *PanelRequest) GetClient() *http.Client {
func (r *PanelRequest) SetHeaders(req *http.Request) *http.Request { func (r *PanelRequest) SetHeaders(req *http.Request) *http.Request {
req.Header.Set("Accept", "application/vnd.pterodactyl.v1+json") req.Header.Set("Accept", "application/vnd.pterodactyl.v1+json")
req.Header.Set("Content-Type", "application/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 return req
} }

View File

@ -21,6 +21,17 @@ 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
// 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 Api ApiConfiguration
System SystemConfiguration System SystemConfiguration
Docker DockerConfiguration Docker DockerConfiguration
@ -55,10 +66,6 @@ type Configuration struct {
// The location where the panel is running that this daemon should connect to // The location where the panel is running that this daemon should connect to
// to collect data and send events. // to collect data and send events.
PanelLocation string `yaml:"remote"` 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. // Defines basic system configuration settings.

View File

@ -18,6 +18,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"sync/atomic"
"time" "time"
) )
@ -170,10 +171,11 @@ func (fs *Filesystem) DirectorySize(dir string) (int64, error) {
defer wg.Done() defer wg.Done()
s, _ := fs.DirectorySize(p) s, _ := fs.DirectorySize(p)
size += s
atomic.AddInt64(&size, s)
}(filepath.Join(cleaned, f.Name())) }(filepath.Join(cleaned, f.Name()))
} else { } else {
size += f.Size() atomic.AddInt64(&size, f.Size())
} }
} }