diff --git a/config.js b/config.js index 4ed15d622bc62ac65389d37943e795d749c14792..7aeb711e2fb95d3ff4f97384a7839a3a50c582ce 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 165ed5ffc49062324db1c2cd25892f5d52abf62d..e8d53a65ef85e3744aa562dea456222ee159e2d1 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 a9d3021e67ab084c941c2a75be4a9b1849d3a6be..1d67e8bbb153280635626aa31a385d081513f3a1 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 6b7b3f65c1c8e4b943894fc2e5e4199bd930a090..a4246b9c93c9301698be3ee9d220b60dd90d7c2b 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); } /**