mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
implement settings structure.
This commit is contained in:
parent
832c1f22e2
commit
5f6aef469a
@ -100,8 +100,6 @@ export class NekoMessages extends EventEmitter<NekoEvents> {
|
|||||||
protected [EVENT.SYSTEM_INIT](conf: message.SystemInit) {
|
protected [EVENT.SYSTEM_INIT](conf: message.SystemInit) {
|
||||||
this._localLog.debug(`EVENT.SYSTEM_INIT`)
|
this._localLog.debug(`EVENT.SYSTEM_INIT`)
|
||||||
Vue.set(this._state, 'session_id', conf.session_id)
|
Vue.set(this._state, 'session_id', conf.session_id)
|
||||||
Vue.set(this._state.control, 'implicit_hosting', conf.implicit_hosting)
|
|
||||||
Vue.set(this._state.cursors, 'enabled', conf.inactive_cursors)
|
|
||||||
Vue.set(this._state.connection, 'screencast', conf.screencast_enabled)
|
Vue.set(this._state.connection, 'screencast', conf.screencast_enabled)
|
||||||
Vue.set(this._state.connection.webrtc, 'videos', conf.webrtc.videos)
|
Vue.set(this._state.connection.webrtc, 'videos', conf.webrtc.videos)
|
||||||
|
|
||||||
@ -111,6 +109,7 @@ export class NekoMessages extends EventEmitter<NekoEvents> {
|
|||||||
|
|
||||||
this[EVENT.SCREEN_UPDATED](conf.screen_size)
|
this[EVENT.SCREEN_UPDATED](conf.screen_size)
|
||||||
this[EVENT.CONTROL_HOST](conf.control_host)
|
this[EVENT.CONTROL_HOST](conf.control_host)
|
||||||
|
this[EVENT.SYSTEM_SETTINGS](conf.settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected [EVENT.SYSTEM_ADMIN]({ screen_sizes_list, broadcast_status }: message.SystemAdmin) {
|
protected [EVENT.SYSTEM_ADMIN]({ screen_sizes_list, broadcast_status }: message.SystemAdmin) {
|
||||||
@ -130,6 +129,11 @@ export class NekoMessages extends EventEmitter<NekoEvents> {
|
|||||||
this[EVENT.BORADCAST_STATUS](broadcast_status)
|
this[EVENT.BORADCAST_STATUS](broadcast_status)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected [EVENT.SYSTEM_SETTINGS](settings: message.SystemSettings) {
|
||||||
|
this._localLog.debug(`EVENT.SYSTEM_SETTINGS`)
|
||||||
|
Vue.set(this._state, 'settings', settings)
|
||||||
|
}
|
||||||
|
|
||||||
protected [EVENT.SYSTEM_DISCONNECT]({ message }: message.SystemDisconnect) {
|
protected [EVENT.SYSTEM_DISCONNECT]({ message }: message.SystemDisconnect) {
|
||||||
this._localLog.debug(`EVENT.SYSTEM_DISCONNECT`)
|
this._localLog.debug(`EVENT.SYSTEM_DISCONNECT`)
|
||||||
this._connection.close(new Error(message))
|
this._connection.close(new Error(message))
|
||||||
@ -229,7 +233,7 @@ export class NekoMessages extends EventEmitter<NekoEvents> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected [EVENT.SESSION_CURSORS](cursors: message.SessionCursor[]) {
|
protected [EVENT.SESSION_CURSORS](cursors: message.SessionCursor[]) {
|
||||||
Vue.set(this._state.cursors, 'list', cursors)
|
Vue.set(this._state, 'cursors', cursors)
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
|
@ -10,13 +10,13 @@
|
|||||||
@imageReady="screencastReady = $event"
|
@imageReady="screencastReady = $event"
|
||||||
/>
|
/>
|
||||||
<neko-cursors
|
<neko-cursors
|
||||||
v-if="state.cursors.enabled && state.sessions[state.session_id].profile.can_see_inactive_cursors"
|
v-if="state.settings.inactive_cursors && state.sessions[state.session_id].profile.can_see_inactive_cursors"
|
||||||
:sessions="state.sessions"
|
:sessions="state.sessions"
|
||||||
:sessionId="state.session_id"
|
:sessionId="state.session_id"
|
||||||
:hostId="state.control.host_id"
|
:hostId="state.control.host_id"
|
||||||
:screenSize="state.screen.size"
|
:screenSize="state.screen.size"
|
||||||
:canvasSize="canvasSize"
|
:canvasSize="canvasSize"
|
||||||
:cursors="state.cursors.list"
|
:cursors="state.cursors"
|
||||||
:cursorDraw="inactiveCursorDrawFunction"
|
:cursorDraw="inactiveCursorDrawFunction"
|
||||||
/>
|
/>
|
||||||
<neko-overlay
|
<neko-overlay
|
||||||
@ -29,8 +29,10 @@
|
|||||||
:canvasSize="canvasSize"
|
:canvasSize="canvasSize"
|
||||||
:isControling="controlling"
|
:isControling="controlling"
|
||||||
:cursorDraw="cursorDrawFunction"
|
:cursorDraw="cursorDrawFunction"
|
||||||
:implicitControl="state.control.implicit_hosting && state.sessions[state.session_id].profile.can_host"
|
:implicitControl="state.settings.implicit_hosting && state.sessions[state.session_id].profile.can_host"
|
||||||
:inactiveCursors="state.cursors.enabled && state.sessions[state.session_id].profile.sends_inactive_cursor"
|
:inactiveCursors="
|
||||||
|
state.settings.inactive_cursors && state.sessions[state.session_id].profile.sends_inactive_cursor
|
||||||
|
"
|
||||||
@implicitControlRequest="control.request()"
|
@implicitControlRequest="control.request()"
|
||||||
@implicitControlRelease="control.release()"
|
@implicitControlRelease="control.release()"
|
||||||
@updateKeyboardModifiers="updateKeyboardModifiers($event)"
|
@updateKeyboardModifiers="updateKeyboardModifiers($event)"
|
||||||
@ -174,7 +176,6 @@
|
|||||||
variant: '',
|
variant: '',
|
||||||
},
|
},
|
||||||
host_id: null,
|
host_id: null,
|
||||||
implicit_hosting: false,
|
|
||||||
locked: false,
|
locked: false,
|
||||||
},
|
},
|
||||||
screen: {
|
screen: {
|
||||||
@ -187,10 +188,13 @@
|
|||||||
},
|
},
|
||||||
session_id: null,
|
session_id: null,
|
||||||
sessions: {},
|
sessions: {},
|
||||||
cursors: {
|
settings: {
|
||||||
enabled: false,
|
private_mode: false,
|
||||||
list: [],
|
implicit_hosting: false,
|
||||||
|
inactive_cursors: false,
|
||||||
|
merciful_reconnect: false,
|
||||||
},
|
},
|
||||||
|
cursors: [],
|
||||||
} as NekoState
|
} as NekoState
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
@ -597,13 +601,17 @@
|
|||||||
Vue.set(this.state.connection.webrtc, 'videos', [])
|
Vue.set(this.state.connection.webrtc, 'videos', [])
|
||||||
Vue.set(this.state.control, 'clipboard', null)
|
Vue.set(this.state.control, 'clipboard', null)
|
||||||
Vue.set(this.state.control, 'host_id', null)
|
Vue.set(this.state.control, 'host_id', null)
|
||||||
Vue.set(this.state.control, 'implicit_hosting', false)
|
|
||||||
Vue.set(this.state.screen, 'size', { width: 1280, height: 720, rate: 30 })
|
Vue.set(this.state.screen, 'size', { width: 1280, height: 720, rate: 30 })
|
||||||
Vue.set(this.state.screen, 'configurations', [])
|
Vue.set(this.state.screen, 'configurations', [])
|
||||||
Vue.set(this.state, 'session_id', null)
|
Vue.set(this.state, 'session_id', null)
|
||||||
Vue.set(this.state, 'sessions', {})
|
Vue.set(this.state, 'sessions', {})
|
||||||
Vue.set(this.state.cursors, 'enabled', false)
|
Vue.set(this.state, 'settings', {
|
||||||
Vue.set(this.state.cursors, 'list', [])
|
private_mode: false,
|
||||||
|
implicit_hosting: false,
|
||||||
|
inactive_cursors: false,
|
||||||
|
merciful_reconnect: false,
|
||||||
|
})
|
||||||
|
Vue.set(this.state, 'cursors', [])
|
||||||
|
|
||||||
// webrtc
|
// webrtc
|
||||||
Vue.set(this.state.connection.webrtc, 'stats', null)
|
Vue.set(this.state.connection.webrtc, 'stats', null)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
export const SYSTEM_INIT = 'system/init'
|
export const SYSTEM_INIT = 'system/init'
|
||||||
export const SYSTEM_ADMIN = 'system/admin'
|
export const SYSTEM_ADMIN = 'system/admin'
|
||||||
|
export const SYSTEM_SETTINGS = 'system/settings'
|
||||||
export const SYSTEM_LOGS = 'system/logs'
|
export const SYSTEM_LOGS = 'system/logs'
|
||||||
export const SYSTEM_DISCONNECT = 'system/disconnect'
|
export const SYSTEM_DISCONNECT = 'system/disconnect'
|
||||||
|
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
import { ICEServer } from '../internal/webrtc'
|
import { ICEServer } from '../internal/webrtc'
|
||||||
|
import { Settings } from './state'
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// System
|
// System
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
|
|
||||||
|
export interface SystemSettings extends Settings {}
|
||||||
|
|
||||||
export interface SystemWebRTC {
|
export interface SystemWebRTC {
|
||||||
videos: string[]
|
videos: string[]
|
||||||
}
|
}
|
||||||
@ -13,8 +16,7 @@ export interface SystemInit {
|
|||||||
control_host: ControlHost
|
control_host: ControlHost
|
||||||
screen_size: ScreenSize
|
screen_size: ScreenSize
|
||||||
sessions: Record<string, SessionData>
|
sessions: Record<string, SessionData>
|
||||||
implicit_hosting: boolean
|
settings: Settings
|
||||||
inactive_cursors: boolean
|
|
||||||
screencast_enabled: boolean
|
screencast_enabled: boolean
|
||||||
webrtc: SystemWebRTC
|
webrtc: SystemWebRTC
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ export default interface State {
|
|||||||
screen: Screen
|
screen: Screen
|
||||||
session_id: string | null
|
session_id: string | null
|
||||||
sessions: Record<string, Session>
|
sessions: Record<string, Session>
|
||||||
|
settings: Settings
|
||||||
cursors: Cursors
|
cursors: Cursors
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +65,6 @@ export interface Control {
|
|||||||
clipboard: Clipboard | null
|
clipboard: Clipboard | null
|
||||||
keyboard: Keyboard
|
keyboard: Keyboard
|
||||||
host_id: string | null
|
host_id: string | null
|
||||||
implicit_hosting: boolean
|
|
||||||
locked: boolean
|
locked: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,14 +125,22 @@ export interface Session {
|
|||||||
state: SessionState
|
state: SessionState
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
// Settings
|
||||||
|
/////////////////////////////
|
||||||
|
|
||||||
|
export interface Settings {
|
||||||
|
private_mode: boolean
|
||||||
|
implicit_hosting: boolean
|
||||||
|
inactive_cursors: boolean
|
||||||
|
merciful_reconnect: boolean
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Cursors
|
// Cursors
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
|
|
||||||
export interface Cursors {
|
type Cursors = SessionCursors[]
|
||||||
enabled: boolean
|
|
||||||
list: SessionCursors[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SessionCursors {
|
export interface SessionCursors {
|
||||||
id: string
|
id: string
|
||||||
|
Loading…
Reference in New Issue
Block a user