Fix multiple server status messages
This commit is contained in:
parent
0ae286d617
commit
5c2686fc6d
|
@ -218,15 +218,28 @@ func (h *Handler) HandleInbound(m Message) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if token.HasPermission(PermissionConnect) {
|
||||
h.setJwt(token)
|
||||
}
|
||||
// Check if the user has previously authenticated successfully.
|
||||
newConnection := h.GetJwt() == nil
|
||||
|
||||
// Previously there was a HasPermission(PermissionConnect) check around this,
|
||||
// however NewTokenPayload will return an error if it doesn't have the connect
|
||||
// permission meaning that it was a redundant function call.
|
||||
h.setJwt(token)
|
||||
|
||||
// Tell the client they authenticated successfully.
|
||||
h.unsafeSendJson(Message{
|
||||
Event: AuthenticationSuccessEvent,
|
||||
Args: []string{},
|
||||
})
|
||||
|
||||
// Check if the client was refreshing their authentication token
|
||||
// instead of authenticating for the first time.
|
||||
if !newConnection {
|
||||
// This prevents duplicate status messages as outlined in
|
||||
// https://github.com/pterodactyl/panel/issues/2077
|
||||
return nil
|
||||
}
|
||||
|
||||
// On every authentication event, send the current server status back
|
||||
// to the client. :)
|
||||
state := h.server.GetState()
|
||||
|
|
Loading…
Reference in New Issue
Block a user