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

View File

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

View File

@ -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())
}
}