private mode implementation.

This commit is contained in:
Miroslav Šedivý
2022-03-26 23:20:38 +01:00
parent f549171ded
commit d004ddd68f
12 changed files with 160 additions and 11 deletions

View File

@ -54,6 +54,10 @@ func CanHostOnly(w http.ResponseWriter, r *http.Request) (context.Context, error
return nil, utils.HttpForbidden("session cannot host")
}
if session.PrivateModeEnabled() {
return nil, utils.HttpUnprocessableEntity("private mode is enabled")
}
return nil, nil
}

View File

@ -27,6 +27,7 @@ type Session interface {
Profile() MemberProfile
State() SessionState
IsHost() bool
PrivateModeEnabled() bool
// cursor
SetCursor(cursor Cursor)
@ -55,6 +56,9 @@ type SessionManager interface {
GetHost() Session
ClearHost()
SetPrivateMode(isPrivateMode bool)
PrivateMode() bool
SetCursor(cursor Cursor, session Session)
PopCursors() map[Session][]Cursor
@ -69,6 +73,7 @@ type SessionManager interface {
OnProfileChanged(listener func(session Session))
OnStateChanged(listener func(session Session))
OnHostChanged(listener func(session Session))
OnPrivateModeChanged(listener func(isPrivateMode bool))
ImplicitHosting() bool
InactiveCursors() bool

View File

@ -26,6 +26,8 @@ type WebRTCPeer interface {
SetCandidate(candidate webrtc.ICECandidateInit) error
SetVideoID(videoID string) error
SetPaused(isPaused bool) error
SendCursorPosition(x, y int) error
SendCursorImage(cur *CursorImage, img []byte) error