mirror of
https://github.com/m1k1o/neko.git
synced 2026-11-03 00:11:48 -06:00
fix kicked message for legacy implementation.
This commit is contained in:
@@ -165,6 +165,11 @@ func (s *session) wsToClient(msg []byte) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// if profile change is the reason for disconnect, it's a kick event
|
||||
if request.Message == "profile changed" {
|
||||
request.Message = "kicked"
|
||||
}
|
||||
|
||||
return s.toClient(&oldMessage.SystemMessage{
|
||||
Event: oldEvent.SYSTEM_DISCONNECT,
|
||||
Message: request.Message,
|
||||
|
||||
@@ -47,7 +47,12 @@ func (session *SessionCtx) profileChanged() {
|
||||
}
|
||||
|
||||
if (!session.profile.CanConnect || !session.profile.CanLogin || !session.profile.CanWatch) && session.state.IsWatching {
|
||||
session.GetWebRTCPeer().Destroy()
|
||||
// TODO: Needed for legacy implementation. Websocket must die before webrtc and deliver signal close message
|
||||
// otherwise webrtc destroy would trigger websocket reconnect. In case of kick event, webrtc destroy is called
|
||||
// before websocket destroy that delivers the information about the kick.
|
||||
time.AfterFunc(time.Second, func() {
|
||||
session.GetWebRTCPeer().Destroy()
|
||||
})
|
||||
}
|
||||
|
||||
if (!session.profile.CanConnect || !session.profile.CanLogin) && session.state.IsConnected {
|
||||
|
||||
Reference in New Issue
Block a user