mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add profileChanged.
This commit is contained in:
parent
a2da60d617
commit
2467c94c59
@ -142,6 +142,7 @@ func (manager *SessionManagerCtx) Update(id string, profile types.MemberProfile)
|
|||||||
manager.membersMu.Unlock()
|
manager.membersMu.Unlock()
|
||||||
|
|
||||||
manager.emmiter.Emit("profile_changed", session)
|
manager.emmiter.Emit("profile_changed", session)
|
||||||
|
session.profileChanged()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +59,24 @@ func (session *SessionCtx) CanAccessClipboard() bool {
|
|||||||
return session.profile.CanAccessClipboard
|
return session.profile.CanAccessClipboard
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (session *SessionCtx) profileChanged() {
|
||||||
|
if !session.CanHost() && session.IsHost() {
|
||||||
|
session.manager.ClearHost()
|
||||||
|
}
|
||||||
|
|
||||||
|
if !session.CanWatch() && session.IsWatching() {
|
||||||
|
if err := session.webrtc_peer.Destroy(); err != nil {
|
||||||
|
session.logger.Warn().Err(err).Msgf("webrtc destroy has failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !session.CanConnect() && session.IsConnected() {
|
||||||
|
if err := session.Disconnect("profile changed"); err != nil {
|
||||||
|
session.logger.Warn().Err(err).Msgf("websocket destroy has failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---
|
// ---
|
||||||
// runtime
|
// runtime
|
||||||
// ---
|
// ---
|
||||||
|
Loading…
Reference in New Issue
Block a user