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) {
|
||||
this._localLog.debug(`EVENT.SYSTEM_INIT`)
|
||||
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.webrtc, 'videos', conf.webrtc.videos)
|
||||
|
||||
@ -111,6 +109,7 @@ export class NekoMessages extends EventEmitter<NekoEvents> {
|
||||
|
||||
this[EVENT.SCREEN_UPDATED](conf.screen_size)
|
||||
this[EVENT.CONTROL_HOST](conf.control_host)
|
||||
this[EVENT.SYSTEM_SETTINGS](conf.settings)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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) {
|
||||
this._localLog.debug(`EVENT.SYSTEM_DISCONNECT`)
|
||||
this._connection.close(new Error(message))
|
||||
@ -229,7 +233,7 @@ export class NekoMessages extends EventEmitter<NekoEvents> {
|
||||
}
|
||||
|
||||
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"
|
||||
/>
|
||||
<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"
|
||||
:sessionId="state.session_id"
|
||||
:hostId="state.control.host_id"
|
||||
:screenSize="state.screen.size"
|
||||
:canvasSize="canvasSize"
|
||||
:cursors="state.cursors.list"
|
||||
:cursors="state.cursors"
|
||||
:cursorDraw="inactiveCursorDrawFunction"
|
||||
/>
|
||||
<neko-overlay
|
||||
@ -29,8 +29,10 @@
|
||||
:canvasSize="canvasSize"
|
||||
:isControling="controlling"
|
||||
:cursorDraw="cursorDrawFunction"
|
||||
:implicitControl="state.control.implicit_hosting && state.sessions[state.session_id].profile.can_host"
|
||||
:inactiveCursors="state.cursors.enabled && state.sessions[state.session_id].profile.sends_inactive_cursor"
|
||||
:implicitControl="state.settings.implicit_hosting && state.sessions[state.session_id].profile.can_host"
|
||||
:inactiveCursors="
|
||||
state.settings.inactive_cursors && state.sessions[state.session_id].profile.sends_inactive_cursor
|
||||
"
|
||||
@implicitControlRequest="control.request()"
|
||||
@implicitControlRelease="control.release()"
|
||||
@updateKeyboardModifiers="updateKeyboardModifiers($event)"
|
||||
@ -174,7 +176,6 @@
|
||||
variant: '',
|
||||
},
|
||||
host_id: null,
|
||||
implicit_hosting: false,
|
||||
locked: false,
|
||||
},
|
||||
screen: {
|
||||
@ -187,10 +188,13 @@
|
||||
},
|
||||
session_id: null,
|
||||
sessions: {},
|
||||
cursors: {
|
||||
enabled: false,
|
||||
list: [],
|
||||
settings: {
|
||||
private_mode: false,
|
||||
implicit_hosting: false,
|
||||
inactive_cursors: false,
|
||||
merciful_reconnect: false,
|
||||
},
|
||||
cursors: [],
|
||||
} as NekoState
|
||||
|
||||
/////////////////////////////
|
||||
@ -597,13 +601,17 @@
|
||||
Vue.set(this.state.connection.webrtc, 'videos', [])
|
||||
Vue.set(this.state.control, 'clipboard', 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, 'configurations', [])
|
||||
Vue.set(this.state, 'session_id', null)
|
||||
Vue.set(this.state, 'sessions', {})
|
||||
Vue.set(this.state.cursors, 'enabled', false)
|
||||
Vue.set(this.state.cursors, 'list', [])
|
||||
Vue.set(this.state, 'settings', {
|
||||
private_mode: false,
|
||||
implicit_hosting: false,
|
||||
inactive_cursors: false,
|
||||
merciful_reconnect: false,
|
||||
})
|
||||
Vue.set(this.state, 'cursors', [])
|
||||
|
||||
// webrtc
|
||||
Vue.set(this.state.connection.webrtc, 'stats', null)
|
||||
|
@ -1,5 +1,6 @@
|
||||
export const SYSTEM_INIT = 'system/init'
|
||||
export const SYSTEM_ADMIN = 'system/admin'
|
||||
export const SYSTEM_SETTINGS = 'system/settings'
|
||||
export const SYSTEM_LOGS = 'system/logs'
|
||||
export const SYSTEM_DISCONNECT = 'system/disconnect'
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
import { ICEServer } from '../internal/webrtc'
|
||||
import { Settings } from './state'
|
||||
|
||||
/////////////////////////////
|
||||
// System
|
||||
/////////////////////////////
|
||||
|
||||
export interface SystemSettings extends Settings {}
|
||||
|
||||
export interface SystemWebRTC {
|
||||
videos: string[]
|
||||
}
|
||||
@ -13,8 +16,7 @@ export interface SystemInit {
|
||||
control_host: ControlHost
|
||||
screen_size: ScreenSize
|
||||
sessions: Record<string, SessionData>
|
||||
implicit_hosting: boolean
|
||||
inactive_cursors: boolean
|
||||
settings: Settings
|
||||
screencast_enabled: boolean
|
||||
webrtc: SystemWebRTC
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ export default interface State {
|
||||
screen: Screen
|
||||
session_id: string | null
|
||||
sessions: Record<string, Session>
|
||||
settings: Settings
|
||||
cursors: Cursors
|
||||
}
|
||||
|
||||
@ -64,7 +65,6 @@ export interface Control {
|
||||
clipboard: Clipboard | null
|
||||
keyboard: Keyboard
|
||||
host_id: string | null
|
||||
implicit_hosting: boolean
|
||||
locked: boolean
|
||||
}
|
||||
|
||||
@ -125,14 +125,22 @@ export interface Session {
|
||||
state: SessionState
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
// Settings
|
||||
/////////////////////////////
|
||||
|
||||
export interface Settings {
|
||||
private_mode: boolean
|
||||
implicit_hosting: boolean
|
||||
inactive_cursors: boolean
|
||||
merciful_reconnect: boolean
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
// Cursors
|
||||
/////////////////////////////
|
||||
|
||||
export interface Cursors {
|
||||
enabled: boolean
|
||||
list: SessionCursors[]
|
||||
}
|
||||
type Cursors = SessionCursors[]
|
||||
|
||||
export interface SessionCursors {
|
||||
id: string
|
||||
|
Loading…
Reference in New Issue
Block a user