mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
sessions: switch to settings struct.
This commit is contained in:
@ -3,6 +3,7 @@ package event
|
||||
const (
|
||||
SYSTEM_INIT = "system/init"
|
||||
SYSTEM_ADMIN = "system/admin"
|
||||
SYSTEM_SETTINGS = "system/settings"
|
||||
SYSTEM_LOGS = "system/logs"
|
||||
SYSTEM_DISCONNECT = "system/disconnect"
|
||||
)
|
||||
|
@ -19,10 +19,13 @@ type SystemInit struct {
|
||||
ControlHost ControlHost `json:"control_host"`
|
||||
ScreenSize ScreenSize `json:"screen_size"`
|
||||
Sessions map[string]SessionData `json:"sessions"`
|
||||
ImplicitHosting bool `json:"implicit_hosting"`
|
||||
InactiveCursors bool `json:"inactive_cursors"`
|
||||
Settings types.Settings `json:"settings"`
|
||||
ScreencastEnabled bool `json:"screencast_enabled"`
|
||||
WebRTC SystemWebRTC `json:"webrtc"`
|
||||
|
||||
// TODO: Left for compatibility with old client, remove.
|
||||
ImplicitHosting bool `json:"implicit_hosting"`
|
||||
InactiveCursors bool `json:"inactive_cursors"`
|
||||
}
|
||||
|
||||
type SystemAdmin struct {
|
||||
|
@ -22,6 +22,13 @@ type SessionState struct {
|
||||
IsWatching bool `json:"is_watching"`
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
PrivateMode bool `json:"private_mode"`
|
||||
ImplicitHosting bool `json:"implicit_hosting"`
|
||||
InactiveCursors bool `json:"inactive_cursors"`
|
||||
MercifulReconnect bool `json:"merciful_reconnect"`
|
||||
}
|
||||
|
||||
type Session interface {
|
||||
ID() string
|
||||
Profile() MemberProfile
|
||||
@ -56,9 +63,6 @@ type SessionManager interface {
|
||||
GetHost() Session
|
||||
ClearHost()
|
||||
|
||||
SetPrivateMode(isPrivateMode bool)
|
||||
PrivateMode() bool
|
||||
|
||||
SetCursor(cursor Cursor, session Session)
|
||||
PopCursors() map[Session][]Cursor
|
||||
|
||||
@ -73,12 +77,11 @@ type SessionManager interface {
|
||||
OnProfileChanged(listener func(session Session))
|
||||
OnStateChanged(listener func(session Session))
|
||||
OnHostChanged(listener func(session Session))
|
||||
OnPrivateModeChanged(listener func(isPrivateMode bool))
|
||||
OnSettingsChanged(listener func(new Settings, old Settings))
|
||||
|
||||
ImplicitHosting() bool
|
||||
InactiveCursors() bool
|
||||
UpdateSettings(Settings)
|
||||
Settings() Settings
|
||||
CookieEnabled() bool
|
||||
MercifulReconnect() bool
|
||||
|
||||
CookieSetToken(w http.ResponseWriter, token string)
|
||||
CookieClearToken(w http.ResponseWriter, r *http.Request)
|
||||
|
Reference in New Issue
Block a user