diff --git a/pkg/auth/session.go b/pkg/auth/session.go index bc925c1..9a38c36 100644 --- a/pkg/auth/session.go +++ b/pkg/auth/session.go @@ -293,7 +293,6 @@ func (a *authenticator) ValidateAccessToken(token AccessToken) *RefreshToken { return nil } - return uvIssRT } diff --git a/pkg/blas/blas.go b/pkg/blas/blas.go index 297187d..85c1fa9 100644 --- a/pkg/blas/blas.go +++ b/pkg/blas/blas.go @@ -80,9 +80,9 @@ func (b *Blas) Components() components.ComponentStore { return b.components } func New(cfg *config.Config) (b *Blas, err error) { b = &Blas{ - Bus: bus.New(), - Config: cfg, - components: make(components.ComponentStore), + Bus: bus.New(), + Config: cfg, + components: make(components.ComponentStore), WebSocketManager: wsapi.NewManager(), } diff --git a/pkg/wsapi/api.go b/pkg/wsapi/api.go index b4f0d8e..02be019 100644 --- a/pkg/wsapi/api.go +++ b/pkg/wsapi/api.go @@ -16,7 +16,7 @@ import ( var ( NoSuchHandlerErr = errors.New("bad websocket command") - NoMessageIDErr = errors.New("no message ID") + NoMessageIDErr = errors.New("no message ID") ) type Type string @@ -122,28 +122,29 @@ type cmdMsg struct { } type MsgType string + const ( ResultMsgType MsgType = "result" ) type Error struct { - Code string `json:"code"` + Code string `json:"code"` Message string `json:"message"` } type WSError struct { - ID *int `json:"id,omitempty"` - Type MsgType `json:"type"` - Success bool `json:"success"` - Error Error `json:"error"` + ID *int `json:"id,omitempty"` + Type MsgType `json:"type"` + Success bool `json:"success"` + Error Error `json:"error"` } func (ws *cmdHandler) writeError(id int, err Error) error { return ws.WriteJSON(WSError{ - ID: &id, - Type: ResultMsgType, + ID: &id, + Type: ResultMsgType, Success: false, - Error: err, + Error: err, }) } @@ -163,10 +164,10 @@ func (ws *cmdHandler) handleMsg(r io.Reader) error { if !ok { return ws.WriteJSON( WSError{ - Type: ResultMsgType, + Type: ResultMsgType, Success: false, Error: Error{ - Code: "invalid_id", + Code: "invalid_id", Message: "command has no ID", }, }) @@ -181,7 +182,7 @@ func (ws *cmdHandler) handleMsg(r io.Reader) error { case nil: case NoSuchHandlerErr: return ws.writeError(id, Error{ - Code: "invalid_type", + Code: "invalid_type", Message: "no such command", }) default: