implement private mode.

This commit is contained in:
Miroslav Šedivý 2022-03-27 22:49:12 +02:00
parent 5f6aef469a
commit f7f533f269
2 changed files with 24 additions and 6 deletions

View File

@ -24,6 +24,7 @@ export interface NekoConnectionEvents {
export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
private _open = false
public paused = false
public websocket = new NekoWebSocket()
public logger = new NekoLoggerFactory(this.websocket)
public webrtc = new NekoWebRTC(this.logger.new('webrtc'))
@ -102,6 +103,11 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
this._webrtcCongestionControlHandle = (stats: WebRTCStats) => {
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 (!this._reconnector.webrtc.isOpen) return

View File

@ -10,7 +10,7 @@
@imageReady="screencastReady = $event"
/>
<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"
:sessionId="state.session_id"
:hostId="state.control.host_id"
@ -20,6 +20,7 @@
:cursorDraw="inactiveCursorDrawFunction"
/>
<neko-overlay
v-show="!private_mode_enabled && connected"
:style="{ pointerEvents: state.control.locked ? 'none' : 'auto' }"
:sessions="state.sessions"
:hostId="state.control.host_id"
@ -29,10 +30,8 @@
:canvasSize="canvasSize"
:isControling="controlling"
:cursorDraw="cursorDrawFunction"
: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
"
:implicitControl="state.settings.implicit_hosting && session.profile.can_host"
:inactiveCursors="state.settings.inactive_cursors && session.profile.sends_inactive_cursor"
@implicitControlRequest="control.request()"
@implicitControlRelease="control.release()"
@updateKeyboardModifiers="updateKeyboardModifiers($event)"
@ -210,8 +209,21 @@
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() {
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