mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
implement private mode.
This commit is contained in:
parent
5f6aef469a
commit
f7f533f269
@ -24,6 +24,7 @@ export interface NekoConnectionEvents {
|
|||||||
export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
|
export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
|
||||||
private _open = false
|
private _open = false
|
||||||
|
|
||||||
|
public paused = false
|
||||||
public websocket = new NekoWebSocket()
|
public websocket = new NekoWebSocket()
|
||||||
public logger = new NekoLoggerFactory(this.websocket)
|
public logger = new NekoLoggerFactory(this.websocket)
|
||||||
public webrtc = new NekoWebRTC(this.logger.new('webrtc'))
|
public webrtc = new NekoWebRTC(this.logger.new('webrtc'))
|
||||||
@ -102,6 +103,11 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
|
|||||||
this._webrtcCongestionControlHandle = (stats: WebRTCStats) => {
|
this._webrtcCongestionControlHandle = (stats: WebRTCStats) => {
|
||||||
Vue.set(this._state.webrtc, 'stats', stats)
|
Vue.set(this._state.webrtc, 'stats', stats)
|
||||||
|
|
||||||
|
// when connection is paused, 0fps and muted track is expected
|
||||||
|
if (this.paused) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// if automatic quality adjusting is turned off
|
// if automatic quality adjusting is turned off
|
||||||
if (!this._reconnector.webrtc.isOpen) return
|
if (!this._reconnector.webrtc.isOpen) return
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
@imageReady="screencastReady = $event"
|
@imageReady="screencastReady = $event"
|
||||||
/>
|
/>
|
||||||
<neko-cursors
|
<neko-cursors
|
||||||
v-if="state.settings.inactive_cursors && state.sessions[state.session_id].profile.can_see_inactive_cursors"
|
v-if="state.settings.inactive_cursors && session.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"
|
||||||
@ -20,6 +20,7 @@
|
|||||||
:cursorDraw="inactiveCursorDrawFunction"
|
:cursorDraw="inactiveCursorDrawFunction"
|
||||||
/>
|
/>
|
||||||
<neko-overlay
|
<neko-overlay
|
||||||
|
v-show="!private_mode_enabled && connected"
|
||||||
:style="{ pointerEvents: state.control.locked ? 'none' : 'auto' }"
|
:style="{ pointerEvents: state.control.locked ? 'none' : 'auto' }"
|
||||||
:sessions="state.sessions"
|
:sessions="state.sessions"
|
||||||
:hostId="state.control.host_id"
|
:hostId="state.control.host_id"
|
||||||
@ -29,10 +30,8 @@
|
|||||||
:canvasSize="canvasSize"
|
:canvasSize="canvasSize"
|
||||||
:isControling="controlling"
|
:isControling="controlling"
|
||||||
:cursorDraw="cursorDrawFunction"
|
:cursorDraw="cursorDrawFunction"
|
||||||
:implicitControl="state.settings.implicit_hosting && state.sessions[state.session_id].profile.can_host"
|
:implicitControl="state.settings.implicit_hosting && session.profile.can_host"
|
||||||
:inactiveCursors="
|
:inactiveCursors="state.settings.inactive_cursors && session.profile.sends_inactive_cursor"
|
||||||
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)"
|
||||||
@ -210,8 +209,21 @@
|
|||||||
return this.state.control.host_id !== null && this.state.session_id === this.state.control.host_id
|
return this.state.control.host_id !== null && this.state.session_id === this.state.control.host_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get session() {
|
||||||
|
return this.state.session_id != null ? this.state.sessions[this.state.session_id] : null
|
||||||
|
}
|
||||||
|
|
||||||
public get is_admin() {
|
public get is_admin() {
|
||||||
return this.state.session_id != null ? this.state.sessions[this.state.session_id].profile.is_admin : false
|
return this.session?.profile.is_admin || false
|
||||||
|
}
|
||||||
|
|
||||||
|
public get private_mode_enabled() {
|
||||||
|
return this.state.settings.private_mode && !this.is_admin
|
||||||
|
}
|
||||||
|
|
||||||
|
@Watch('private_mode_enabled')
|
||||||
|
private setConnectionPaused(paused: boolean) {
|
||||||
|
this.connection.paused = paused
|
||||||
}
|
}
|
||||||
|
|
||||||
screencastReady = false
|
screencastReady = false
|
||||||
|
Loading…
Reference in New Issue
Block a user