From a94732fff529733889fdeb3d7c4cd9c01829523c Mon Sep 17 00:00:00 2001 From: hristoterezov <hristo@jitsi.org> Date: Thu, 4 May 2017 11:52:23 -0500 Subject: [PATCH] feat(remotecontrol): Implements config option that removes the auth window by default Use the auth dialog provided by Jitsi Meet instead. --- config.js | 12 ++++++++++- modules/remotecontrol/constants.js | 4 ++-- modules/remotecontrol/index.js | 32 +++++++++++++++++------------- windows/jitsi-meet/render.js | 5 ++++- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/config.js b/config.js index 4ed15d6..7aeb711 100644 --- a/config.js +++ b/config.js @@ -1,3 +1,13 @@ module.exports = { - jitsiMeetURL: "https://meet.jit.si/" + /** + * The URL of the Jitsi Meet deployment that will be used. + */ + jitsiMeetURL: "https://meet.jit.si/", + + /** + * If true, the authorization of remote control will be handled by jitsi + * meet electron app. Otherwise the authorization will be handled in Jitsi + * Meet. + */ + handleRemoteControlAuthorization: false }; diff --git a/modules/remotecontrol/constants.js b/modules/remotecontrol/constants.js index 165ed5f..e8d53a6 100644 --- a/modules/remotecontrol/constants.js +++ b/modules/remotecontrol/constants.js @@ -25,7 +25,7 @@ module.exports = { }, /** - * The type of remote control events sent trough the API module. + * The name of remote control events sent trough the API module. */ - REMOTE_CONTROL_EVENT_TYPE: "remote-control-event" + REMOTE_CONTROL_EVENT_NAME: "remote-control-event" }; diff --git a/modules/remotecontrol/index.js b/modules/remotecontrol/index.js index a9d3021..1d67e8b 100644 --- a/modules/remotecontrol/index.js +++ b/modules/remotecontrol/index.js @@ -1,6 +1,6 @@ let robot = require("robotjs"); const constants = require("../../modules/remotecontrol/constants"); -const {EVENT_TYPES, PERMISSIONS_ACTIONS, REMOTE_CONTROL_EVENT_TYPE} = constants; +const {EVENT_TYPES, PERMISSIONS_ACTIONS, REMOTE_CONTROL_EVENT_NAME} = constants; /** * Attaching to the window for debug purposes. @@ -64,17 +64,21 @@ class RemoteControl { /** * Initializes the remote control functionality. */ - init(channel, windowManager) { + init(channel, windowManager, handleAuthorization) { + this.handleAuthorization = handleAuthorization; this.windowManager = windowManager; this.channel = channel; this.channel.ready(() => { this.channel.listen('message', message => { const event = message.data; - if(event.name === REMOTE_CONTROL_EVENT_TYPE) { + if(event.name === REMOTE_CONTROL_EVENT_NAME) { this.onRemoteControlEvent(event); } }); this.sendEvent({type: EVENT_TYPES.supported}); + if (!handleAuthorization) { + this.start(); + } }); } @@ -177,16 +181,16 @@ class RemoteControl { break; } case EVENT_TYPES.permissions: { - if(event.action !== PERMISSIONS_ACTIONS.request) - break; - - //Open Dialog and answer - this.handlePermissionRequest({ - userId: event.userId, - userJID: event.userJID, - displayName: event.displayName, - screenSharing: event.screenSharing - }); + if(event.action === PERMISSIONS_ACTIONS.request + && this.handleAuthorization) { + // Open Dialog and answer + this.handlePermissionRequest({ + userId: event.userId, + userJID: event.userJID, + displayName: event.displayName, + screenSharing: event.screenSharing + }); + } break; } case EVENT_TYPES.stop: { @@ -204,7 +208,7 @@ class RemoteControl { */ sendEvent(event) { const remoteControlEvent = Object.assign( - { name: REMOTE_CONTROL_EVENT_TYPE }, + { name: REMOTE_CONTROL_EVENT_NAME }, event ); this.channel.send({ diff --git a/windows/jitsi-meet/render.js b/windows/jitsi-meet/render.js index 6b7b3f6..a4246b9 100644 --- a/windows/jitsi-meet/render.js +++ b/windows/jitsi-meet/render.js @@ -78,7 +78,10 @@ function onload() { window: iframe.contentWindow, windowForEventListening: window }); - remoteControl.init(channel, dialogFactory); + remoteControl.init( + channel, + dialogFactory, + config.handleRemoteControlAuthorization); } /** -- GitLab