mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
inactive cursors access control.
This commit is contained in:
@ -254,6 +254,22 @@ func (manager *SessionManagerCtx) AdminBroadcast(event string, payload interface
|
||||
}
|
||||
}
|
||||
|
||||
func (manager *SessionManagerCtx) InactiveCursorsBroadcast(event string, payload interface{}, exclude interface{}) {
|
||||
for _, session := range manager.List() {
|
||||
if !session.State().IsConnected || !session.Profile().CanSeeInactiveCursors {
|
||||
continue
|
||||
}
|
||||
|
||||
if exclude != nil {
|
||||
if in, _ := utils.ArrayIn(session.ID(), exclude); in {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
session.Send(event, payload)
|
||||
}
|
||||
}
|
||||
|
||||
// ---
|
||||
// events
|
||||
// ---
|
||||
|
@ -54,7 +54,7 @@ func (session *SessionCtx) IsHost() bool {
|
||||
}
|
||||
|
||||
func (session *SessionCtx) SetCursor(cursor types.Cursor) {
|
||||
if session.manager.InactiveCursors() {
|
||||
if session.manager.InactiveCursors() && session.profile.SendsInactiveCursor {
|
||||
session.manager.SetCursor(cursor, session)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user