From 91014d3fb0b4a8e5d1279f755f46a9140a4c16bc Mon Sep 17 00:00:00 2001 From: German Date: Fri, 14 Sep 2018 15:51:49 -0300 Subject: [PATCH 01/20] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 45876c7d4..02dc3f153 100644 --- a/README.md +++ b/README.md @@ -290,7 +290,7 @@ To enable this feature: 1. Create a Google API Console Project and client ID following the steps detailed here: https://developers.google.com/identity/sign-in/web/devconsole-project -2. Edit the config/config.json file in this applciation, and add the following properties: +2. Edit the config/config.json file in this application, and add the following properties: * `Google.clientId` -- Set this to your client ID. * `Google.hostedDomain` -- If you wish to limit sign in to accounts associated with a hosted domain, set the domain here. From f94a9cf8d13c0e86a69c8afe50803439e0dd888f Mon Sep 17 00:00:00 2001 From: Jeff Swartz Date: Mon, 1 Oct 2018 19:29:14 -0700 Subject: [PATCH 02/20] Feedback logging fix The feedback logging should post to a HTTP URL defined in the config. --- README.md | 13 +++++++---- config/example.json | 2 +- package-lock.json | 2 +- package.json | 2 +- server/serverConstants.js | 2 +- server/serverMethods.js | 6 ++--- test/unit/feedbackController_spec.js | 35 ++++++++++++++++++++++++---- test/unit/roomView_spec.html | 2 +- views/room.ejs | 3 ++- web/js/feedbackController.js | 9 +++++-- 10 files changed, 56 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 02dc3f153..633ad973e 100644 --- a/README.md +++ b/README.md @@ -357,11 +357,16 @@ sharing](tokbox.com/developer/guides/screen-sharing/). #### Feedback - `ENABLE_FEEDBACK`: Enable the "Give Demo Feedback" form. +The app lets the developer POST feedback data to an endpoint on your HTTP server: + + `FEEDBACK_URL`: The URL to send a POST request with feedback data. Leave this as an empty string or + undefined to disable issue reporting. + `REPORT_ISSUE_LEVEL`: The audio and video scores in the feedback form are between 1 (awful) and 5 (excellent). When the feedback form is submitted, if an audio or video score is less than or equal to the report issue level, the app calls `OT.reportIssue()`. This reports an issue, which you can view in OpenTok Inspector. (For more information, see [Reporting an issue](https://tokbox.com/developer/guides/debugging/js/#report-issue) in the OpenTok developer Guides.) The default value is 3, set to 0 to disable issue reporting. + ```json "Feedback": { - "enabled": true, + "url": "", "reportIssueLevel": 0 }, ``` @@ -431,7 +436,7 @@ endpoint sends a response with the HTTP status code set to 200 and the JSON like ```json { "name": "opentok-rtc", - "version": "4.1.0", + "version": "4.1.1", "gitHash": "312903cd043d5267bc11639718c47a9b313c1663", "opentok": true, "firebase": true, @@ -466,7 +471,7 @@ the HTTP status code set 400 and JSON like the following: ```json { "name": "opentok-rtc", - "version": "4.1.0", + "version": "4.1.1", "git_hash": "312903cd043d5267bc11639718c47a9b313c1663", "opentok": true, "firebase": false, diff --git a/config/example.json b/config/example.json index c539fdb4f..4392b7358 100644 --- a/config/example.json +++ b/config/example.json @@ -15,7 +15,7 @@ } }, "Feedback":{ - "enabled": false, + "url": "", "reportIssueLevel": 0 }, "Screensharing":{ diff --git a/package-lock.json b/package-lock.json index d02cdb739..ecbc27b64 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "opentok-rtc", - "version": "4.1.0", + "version": "4.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index e417779de..8a0c03e44 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opentok-rtc", - "version": "4.1.0", + "version": "4.1.1", "description": "OpenTokRTC sample application to show off the OpenTok API and platform capabilities ", "main": "server.js", "engines": { diff --git a/server/serverConstants.js b/server/serverConstants.js index 79ffbcf10..117a1bee0 100644 --- a/server/serverConstants.js +++ b/server/serverConstants.js @@ -57,7 +57,7 @@ E.ENABLE_ARCHIVE_MANAGER = { envVar: 'ENABLE_ARCHIVE_MANAGER', jsonPath: 'Archiv // Maximum time an empty room will keep it's history alive, in minutes. E.EMPTY_ROOM_LIFETIME = { envVar: 'EMPTY_ROOM_LIFETIME', jsonPath: 'Archiving.archiveManager.emptyRoomMaxLifetime', defaultValue: 3 }; -E.ENABLE_FEEDBACK = { envVar: 'ENABLE_FEEDBACK', jsonPath: 'Feedback.enabled', defaultValue: false, parser: parseBool }; +E.FEEDBACK_URL = { envVar: 'FEEDBACK_URL', jsonPath: 'Feedback.url', defaultValue: '' }; E.REPORT_ISSUE_LEVEL = { envVar: 'REPORT_ISSUE_LEVEL', jsonPath: 'Feedback.reportIssueLevel', defaultValue: 3 }; diff --git a/server/serverMethods.js b/server/serverMethods.js index 2c5d3c091..b6cbfee4a 100644 --- a/server/serverMethods.js +++ b/server/serverMethods.js @@ -140,7 +140,7 @@ function ServerMethods(aLogLevel, aModules) { var enableArchiveManager = enableArchiving && config.get(C.ENABLE_ARCHIVE_MANAGER); var enableScreensharing = config.get(C.ENABLE_SCREENSHARING); var enableAnnotations = enableScreensharing && config.get(C.ENABLE_ANNOTATIONS); - var enableFeedback = config.get(C.ENABLE_FEEDBACK); + var feedbackUrl = config.get(C.FEEDBACK_URL); var reportIssueLevel = config.get(C.REPORT_ISSUE_LEVEL); if (!firebaseConfigured && enableArchiveManager) { @@ -179,7 +179,7 @@ function ServerMethods(aLogLevel, aModules) { enableArchiveManager, enableScreensharing, enableAnnotations, - enableFeedback, + feedbackUrl, enableSip, opentokJsUrl, showTos, @@ -340,7 +340,7 @@ function ServerMethods(aLogLevel, aModules) { enableArchiveManager: tbConfig.enableArchiveManager, enableScreensharing: tbConfig.enableScreensharing, enableAnnotation: tbConfig.enableAnnotations, - enableFeedback: tbConfig.enableFeedback, + feedbackUrl: tbConfig.feedbackUrl, precallSessionId: testSession.sessionId, apiKey: tbConfig.apiKey, precallToken: tbConfig.otInstance.generateToken(testSession.sessionId, { diff --git a/test/unit/feedbackController_spec.js b/test/unit/feedbackController_spec.js index c418c5521..e77cd8654 100644 --- a/test/unit/feedbackController_spec.js +++ b/test/unit/feedbackController_spec.js @@ -51,26 +51,51 @@ describe('FeedbackController', () => { })); }); + // Fix describe('#feedbackView:sendFeedback event', () => { it('should send feedback event', sinon.test(function () { - var logEventStub = this.stub(window.OT.analytics, 'logEvent', (aLoggedEvent) => {}); + var xhr = sinon.useFakeXMLHttpRequest(); + var requests = this.requests = []; var report = { audioScore: 1, videoScore: 2, description: 'description', }; - window.dispatchEvent(new CustomEvent('feedbackView:sendFeedback', { detail: report })); - expect(logEventStub.calledOnce).to.be.true; - expect(logEventStub.calledWith({ + var timestamp = new Date().getTime(); + var sourceUrl = document.location.href; + + xhr.onCreate = function (xhr) { + requests.push(xhr); + }; + + var expectedRequestBody = { action: 'SessionQuality', partnerId: fakeOTHelper.session.apiKey, sessionId: fakeOTHelper.session.id, connectionId: fakeOTHelper.session.connection.id, publisherId: fakeOTHelper.publisherId, + clientSystemTime: timestamp, + source: sourceUrl, audioScore: report.audioScore, videoScore: report.videoScore, description: report.description, - })).to.be.true; + }; + + window.dispatchEvent(new CustomEvent('feedbackView:sendFeedback', { detail: report })); + expect(requests.length).to.equal(1); + expect(requests[0].method).to.equal('POST'); + var requestBodyObj = JSON.parse(requests[0].requestBody); + expect(requestBodyObj.action).to.equal('SessionQuality'); + expect(requestBodyObj.partnerId).to.equal(fakeOTHelper.session.apiKey); + expect(requestBodyObj.sessionId).to.equal(fakeOTHelper.session.id); + expect(requestBodyObj.connectionId).to.equal(fakeOTHelper.session.connection.id); + expect(requestBodyObj.publisherId).to.equal(fakeOTHelper.publisherId); + expect(requestBodyObj.clientSystemTime).to.equal(timestamp); + expect(requestBodyObj.source).to.equal(sourceUrl); + expect(requestBodyObj.audioScore).to.equal(report.audioScore); + expect(requestBodyObj.videoScore).to.equal(report.videoScore); + expect(requestBodyObj.description).to.equal(report.description); + xhr.restore(); })); }); diff --git a/test/unit/roomView_spec.html b/test/unit/roomView_spec.html index be6a39580..02a91af2f 100644 --- a/test/unit/roomView_spec.html +++ b/test/unit/roomView_spec.html @@ -94,7 +94,7 @@ -<% if (enableFeedback) { %> +<% if (feedbackUrl) { %> diff --git a/views/room.ejs b/views/room.ejs index 92b0ec646..289e3d67b 100755 --- a/views/room.ejs +++ b/views/room.ejs @@ -30,6 +30,7 @@ window.precallToken='<%=precallToken%>'; window.showTos=<%=showTos%> && !sessionStorage.tosAccepted; window.opentokJsUrl='<%=opentokJsUrl%>'; + window.feedbackUrl = '<%=feedbackUrl%>'; var isMobile = function() { return typeof window.orientation !== 'undefined'; } var mobileSettings = function() { @@ -158,7 +159,7 @@ - <% if (enableFeedback) { %> + <% if (feedbackUrl) { %> diff --git a/web/js/feedbackController.js b/web/js/feedbackController.js index 15e089675..dfc01d1f1 100644 --- a/web/js/feedbackController.js +++ b/web/js/feedbackController.js @@ -16,9 +16,14 @@ publisherId: otHelper.publisherId, audioScore: report.audioScore, videoScore: report.videoScore, - description: report.description + description: report.description, + clientSystemTime: new Date().getTime(), + source: document.location.href }; - OT.analytics.logEvent(loggedEvent); + var xhr = new XMLHttpRequest(); + var url = window.feedbackUrl; + xhr.open('POST', url, true); + xhr.send(JSON.stringify(loggedEvent)); }, reportIssue: function () { var loggedEvent = { From f97ac1624d9ad8201246a45ffa36fc0d51e0b4aa Mon Sep 17 00:00:00 2001 From: German Date: Tue, 23 Oct 2018 20:23:37 -0300 Subject: [PATCH 03/20] Remove deprecated chrome.webstore.install --- test/unit/roomView_spec.html | 4 ++-- test/unit/screenShareController_spec.js | 7 +++---- test/unit/screenShareView_spec.html | 4 ++-- test/unit/screenShareView_spec.js | 2 +- views/min.ejs | 4 ++-- views/room.ejs | 4 ++-- web/js/screenShareController.js | 21 ++++++--------------- 7 files changed, 18 insertions(+), 28 deletions(-) diff --git a/test/unit/roomView_spec.html b/test/unit/roomView_spec.html index be6a39580..7721f2a6f 100644 --- a/test/unit/roomView_spec.html +++ b/test/unit/roomView_spec.html @@ -137,9 +137,9 @@
-
Chrome extension was installed successfully.
+
You need a Chrome extension to share your screen.

-

You need to refresh your browser in order to use it.

+

Once you have installed it, refresh your browser and click 'share screen' again.

diff --git a/test/unit/screenShareController_spec.js b/test/unit/screenShareController_spec.js index 1e62a0f2d..7327027d8 100644 --- a/test/unit/screenShareController_spec.js +++ b/test/unit/screenShareController_spec.js @@ -128,8 +128,6 @@ describe('ScreenShareController', () => { it('should respond correctly to screenShareView:installExtension when ' + 'installation works', (done) => { var event = new CustomEvent('screenShareView:installExtension'); - window.chrome.isGoingToWork = true; - window.addEventListener('screenShareController:extInstallationResult', function handlerTest(evt) { window.removeEventListener('screenShareController:extInstallationResult', handlerTest); @@ -145,14 +143,15 @@ describe('ScreenShareController', () => { it('should respond correctly to screenShareView:installExtension when ' + 'installation does not work', (done) => { var event = new CustomEvent('screenShareView:installExtension'); - window.chrome.isGoingToWork = false; + var realWindowOpen = window.open; + window.open = function () { return null }; window.addEventListener('screenShareController:extInstallationResult', function handlerTest(evt) { window.removeEventListener('screenShareController:extInstallationResult', handlerTest); expect(evt.detail.error).to.be.true; - expect(evt.detail.message).to.be.equal(window.chrome.error); done(); + window.open = realWindowOpen; }); ScreenShareController.init('usr', chromeExtId, otHelper).then(() => { diff --git a/test/unit/screenShareView_spec.html b/test/unit/screenShareView_spec.html index c1408deff..76619dbe5 100644 --- a/test/unit/screenShareView_spec.html +++ b/test/unit/screenShareView_spec.html @@ -15,9 +15,9 @@
-
Chrome extension was installed successfully.
+
You need a Chrome extension to share your screen.

-

You need to refresh your browser in order to use it.

+

Once you have installed it, refresh your browser and click 'share screen' again.

diff --git a/test/unit/screenShareView_spec.js b/test/unit/screenShareView_spec.js index 7c950f501..a578464f2 100644 --- a/test/unit/screenShareView_spec.js +++ b/test/unit/screenShareView_spec.js @@ -124,7 +124,7 @@ describe('ScreenShareView', () => { testMsgError(event, '', 'successful-installation', done); }); - it('should show installation success', (done) => { + it('should show installation failure', (done) => { var err = { error: true, message: 'Error message', diff --git a/views/min.ejs b/views/min.ejs index 7eb3a83a6..fdb9ea599 100644 --- a/views/min.ejs +++ b/views/min.ejs @@ -116,9 +116,9 @@
-
Chrome extension was installed successfully.
+
You need a Chrome extension to share your screen.

-

You need to refresh your browser in order to use it.

+

Once you have installed it, refresh your browser and click 'share screen' again.

diff --git a/views/room.ejs b/views/room.ejs index 92b0ec646..ebce796dc 100755 --- a/views/room.ejs +++ b/views/room.ejs @@ -201,9 +201,9 @@
-
Chrome extension was installed successfully.
+
You need a Chrome extension to share your screen.

-

You need to refresh your browser in order to use it.

+

Once you have installed it, refresh your browser and click 'share screen' again.

diff --git a/web/js/screenShareController.js b/web/js/screenShareController.js index 8d1e23a81..09a9fb734 100644 --- a/web/js/screenShareController.js +++ b/web/js/screenShareController.js @@ -74,21 +74,12 @@ var screenShareViewEvents = { installExtension: function () { - try { - chrome.webstore.install('https://chrome.google.com/webstore/detail/' + _chromeExtId, - function () { - Utils.sendEvent('screenShareController:extInstallationResult', - { error: false }); - }, function (err) { - Utils.sendEvent('screenShareController:extInstallationResult', - { error: true, message: err }); - }); - } catch (e) { - // WARNING!! This shouldn't happen - // If this message is displayed it could be because the extensionId is not - // registred and, in this case, we have a bug because this was already controlled - debug.error('Error installing extension:', e); - } + var newTab = window.open('https://chrome.google.com/webstore/detail/' + _chromeExtId, '_blank'); + var error = !newTab || typeof newTab !== 'object'; + Utils.sendEvent('screenShareController:extInstallationResult', { + error: error, + message: error ? 'It seems you have a Pop-Up blocker enabled. Please disabled it and try again.' : null + }); } }; From df9ba37ac65f1fad474bc170c1253cf72ba8acbb Mon Sep 17 00:00:00 2001 From: German Date: Tue, 23 Oct 2018 20:31:20 -0300 Subject: [PATCH 04/20] Fix typo --- screen-sharing-extension-chrome/content-script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/screen-sharing-extension-chrome/content-script.js b/screen-sharing-extension-chrome/content-script.js index 27f0d641f..3042048e4 100644 --- a/screen-sharing-extension-chrome/content-script.js +++ b/screen-sharing-extension-chrome/content-script.js @@ -43,7 +43,7 @@ window.addEventListener('message', function (event) { payload = event.data.payload; if(!payload.requestId) { - console.warn('Message to screen sharing extesnion does not have a requestId for replies.'); + console.warn('Message to screen sharing extension does not have a requestId for replies.'); return undefined; } From dee6b60719ecfb1949c818ee798f8fea40420255 Mon Sep 17 00:00:00 2001 From: German Date: Wed, 24 Oct 2018 09:33:29 -0300 Subject: [PATCH 05/20] Fix lint errors --- test/unit/screenShareController_spec.js | 2 +- web/js/screenShareController.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/unit/screenShareController_spec.js b/test/unit/screenShareController_spec.js index 7327027d8..83f68455b 100644 --- a/test/unit/screenShareController_spec.js +++ b/test/unit/screenShareController_spec.js @@ -144,7 +144,7 @@ describe('ScreenShareController', () => { 'installation does not work', (done) => { var event = new CustomEvent('screenShareView:installExtension'); var realWindowOpen = window.open; - window.open = function () { return null }; + window.open = () => null; window.addEventListener('screenShareController:extInstallationResult', function handlerTest(evt) { diff --git a/web/js/screenShareController.js b/web/js/screenShareController.js index 09a9fb734..ab268e44a 100644 --- a/web/js/screenShareController.js +++ b/web/js/screenShareController.js @@ -1,4 +1,4 @@ -/* global RoomView, OTHelper, chrome, ScreenShareView */ +/* global RoomView, OTHelper, ScreenShareView */ !(function (globals) { 'use strict'; @@ -80,6 +80,9 @@ error: error, message: error ? 'It seems you have a Pop-Up blocker enabled. Please disabled it and try again.' : null }); + if (debug) { + debug.error('Error opening Chrome Webstore'); + } } }; From 4a92fae72d875770f17d42565be656335d6537a5 Mon Sep 17 00:00:00 2001 From: German Date: Wed, 24 Oct 2018 09:56:20 -0300 Subject: [PATCH 06/20] Fix debug call --- web/js/screenShareController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/js/screenShareController.js b/web/js/screenShareController.js index ab268e44a..8c1443223 100644 --- a/web/js/screenShareController.js +++ b/web/js/screenShareController.js @@ -80,7 +80,7 @@ error: error, message: error ? 'It seems you have a Pop-Up blocker enabled. Please disabled it and try again.' : null }); - if (debug) { + if (error) { debug.error('Error opening Chrome Webstore'); } } From d82b20b6636da05663acc455870e018f66bdc2bf Mon Sep 17 00:00:00 2001 From: German Date: Wed, 24 Oct 2018 10:44:15 -0300 Subject: [PATCH 07/20] Avoid set the dataset in null --- web/js/screenShareView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/js/screenShareView.js b/web/js/screenShareView.js index a94d1d24b..c62e90e27 100644 --- a/web/js/screenShareView.js +++ b/web/js/screenShareView.js @@ -22,7 +22,7 @@ var installLink = shareError.querySelector('#screenShareErrorInstall button'); installLink.addEventListener('click', function () { - hideShareScreenError(); + Modal.hide('.screen-modal'); Utils.sendEvent('screenShareView:installExtension'); }); Utils.addEventsHandlers('screenShareController:', screenShareCtrlEvents, exports); From 37e2b87e8ff3b6d4fec55b33a8198da14d1faea0 Mon Sep 17 00:00:00 2001 From: Manik Sachdeva Date: Fri, 7 Dec 2018 22:50:00 +0100 Subject: [PATCH 08/20] Add hd archiving (#488) * update to use hd-archiving * only use for composed archiving --- server/serverMethods.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server/serverMethods.js b/server/serverMethods.js index b6cbfee4a..25d8a62e4 100644 --- a/server/serverMethods.js +++ b/server/serverMethods.js @@ -552,6 +552,7 @@ function ServerMethods(aLogLevel, aModules) { // falls through case 'startComposite': logger.log('Binding archiveOp to startArchive with sessionId:', sessionInfo.sessionId); + archiveOptions.resolution = '1280x720'; archiveOp = otInstance.startArchive_P.bind(otInstance, sessionInfo.sessionId, archiveOptions); break; From 786d7d85a52f11d2a37394d5125ac8a16240f8bf Mon Sep 17 00:00:00 2001 From: Manik Sachdeva Date: Mon, 10 Dec 2018 09:43:04 -0800 Subject: [PATCH 09/20] Revert "[ECO-3440] Remove deprecated chrome.webstore.install" (#489) --- .../content-script.js | 2 +- test/unit/roomView_spec.html | 4 ++-- test/unit/screenShareController_spec.js | 7 +++--- test/unit/screenShareView_spec.html | 4 ++-- test/unit/screenShareView_spec.js | 2 +- views/min.ejs | 4 ++-- views/room.ejs | 4 ++-- web/js/screenShareController.js | 24 ++++++++++++------- web/js/screenShareView.js | 2 +- 9 files changed, 30 insertions(+), 23 deletions(-) diff --git a/screen-sharing-extension-chrome/content-script.js b/screen-sharing-extension-chrome/content-script.js index 3042048e4..27f0d641f 100644 --- a/screen-sharing-extension-chrome/content-script.js +++ b/screen-sharing-extension-chrome/content-script.js @@ -43,7 +43,7 @@ window.addEventListener('message', function (event) { payload = event.data.payload; if(!payload.requestId) { - console.warn('Message to screen sharing extension does not have a requestId for replies.'); + console.warn('Message to screen sharing extesnion does not have a requestId for replies.'); return undefined; } diff --git a/test/unit/roomView_spec.html b/test/unit/roomView_spec.html index bf3a7cc6c..02a91af2f 100644 --- a/test/unit/roomView_spec.html +++ b/test/unit/roomView_spec.html @@ -137,9 +137,9 @@
-
You need a Chrome extension to share your screen.
+
Chrome extension was installed successfully.

-

Once you have installed it, refresh your browser and click 'share screen' again.

+

You need to refresh your browser in order to use it.

diff --git a/test/unit/screenShareController_spec.js b/test/unit/screenShareController_spec.js index 83f68455b..1e62a0f2d 100644 --- a/test/unit/screenShareController_spec.js +++ b/test/unit/screenShareController_spec.js @@ -128,6 +128,8 @@ describe('ScreenShareController', () => { it('should respond correctly to screenShareView:installExtension when ' + 'installation works', (done) => { var event = new CustomEvent('screenShareView:installExtension'); + window.chrome.isGoingToWork = true; + window.addEventListener('screenShareController:extInstallationResult', function handlerTest(evt) { window.removeEventListener('screenShareController:extInstallationResult', handlerTest); @@ -143,15 +145,14 @@ describe('ScreenShareController', () => { it('should respond correctly to screenShareView:installExtension when ' + 'installation does not work', (done) => { var event = new CustomEvent('screenShareView:installExtension'); - var realWindowOpen = window.open; - window.open = () => null; + window.chrome.isGoingToWork = false; window.addEventListener('screenShareController:extInstallationResult', function handlerTest(evt) { window.removeEventListener('screenShareController:extInstallationResult', handlerTest); expect(evt.detail.error).to.be.true; + expect(evt.detail.message).to.be.equal(window.chrome.error); done(); - window.open = realWindowOpen; }); ScreenShareController.init('usr', chromeExtId, otHelper).then(() => { diff --git a/test/unit/screenShareView_spec.html b/test/unit/screenShareView_spec.html index 76619dbe5..c1408deff 100644 --- a/test/unit/screenShareView_spec.html +++ b/test/unit/screenShareView_spec.html @@ -15,9 +15,9 @@
-
You need a Chrome extension to share your screen.
+
Chrome extension was installed successfully.

-

Once you have installed it, refresh your browser and click 'share screen' again.

+

You need to refresh your browser in order to use it.

diff --git a/test/unit/screenShareView_spec.js b/test/unit/screenShareView_spec.js index a578464f2..7c950f501 100644 --- a/test/unit/screenShareView_spec.js +++ b/test/unit/screenShareView_spec.js @@ -124,7 +124,7 @@ describe('ScreenShareView', () => { testMsgError(event, '', 'successful-installation', done); }); - it('should show installation failure', (done) => { + it('should show installation success', (done) => { var err = { error: true, message: 'Error message', diff --git a/views/min.ejs b/views/min.ejs index fdb9ea599..7eb3a83a6 100644 --- a/views/min.ejs +++ b/views/min.ejs @@ -116,9 +116,9 @@
-
You need a Chrome extension to share your screen.
+
Chrome extension was installed successfully.

-

Once you have installed it, refresh your browser and click 'share screen' again.

+

You need to refresh your browser in order to use it.

diff --git a/views/room.ejs b/views/room.ejs index 7a79d5377..289e3d67b 100755 --- a/views/room.ejs +++ b/views/room.ejs @@ -202,9 +202,9 @@
-
You need a Chrome extension to share your screen.
+
Chrome extension was installed successfully.

-

Once you have installed it, refresh your browser and click 'share screen' again.

+

You need to refresh your browser in order to use it.

diff --git a/web/js/screenShareController.js b/web/js/screenShareController.js index 8c1443223..8d1e23a81 100644 --- a/web/js/screenShareController.js +++ b/web/js/screenShareController.js @@ -1,4 +1,4 @@ -/* global RoomView, OTHelper, ScreenShareView */ +/* global RoomView, OTHelper, chrome, ScreenShareView */ !(function (globals) { 'use strict'; @@ -74,14 +74,20 @@ var screenShareViewEvents = { installExtension: function () { - var newTab = window.open('https://chrome.google.com/webstore/detail/' + _chromeExtId, '_blank'); - var error = !newTab || typeof newTab !== 'object'; - Utils.sendEvent('screenShareController:extInstallationResult', { - error: error, - message: error ? 'It seems you have a Pop-Up blocker enabled. Please disabled it and try again.' : null - }); - if (error) { - debug.error('Error opening Chrome Webstore'); + try { + chrome.webstore.install('https://chrome.google.com/webstore/detail/' + _chromeExtId, + function () { + Utils.sendEvent('screenShareController:extInstallationResult', + { error: false }); + }, function (err) { + Utils.sendEvent('screenShareController:extInstallationResult', + { error: true, message: err }); + }); + } catch (e) { + // WARNING!! This shouldn't happen + // If this message is displayed it could be because the extensionId is not + // registred and, in this case, we have a bug because this was already controlled + debug.error('Error installing extension:', e); } } }; diff --git a/web/js/screenShareView.js b/web/js/screenShareView.js index c62e90e27..a94d1d24b 100644 --- a/web/js/screenShareView.js +++ b/web/js/screenShareView.js @@ -22,7 +22,7 @@ var installLink = shareError.querySelector('#screenShareErrorInstall button'); installLink.addEventListener('click', function () { - Modal.hide('.screen-modal'); + hideShareScreenError(); Utils.sendEvent('screenShareView:installExtension'); }); Utils.addEventsHandlers('screenShareController:', screenShareCtrlEvents, exports); From c0148bb602dda5f33d757c570cbe932f2689ed0e Mon Sep 17 00:00:00 2001 From: Jeff Swartz Date: Fri, 25 Jan 2019 13:41:30 -0800 Subject: [PATCH 10/20] Config setting for separate precall API key/secret (#490) --- server/serverConstants.js | 4 ++++ server/serverMethods.js | 12 ++++++++++-- views/room.ejs | 1 + web/js/precallController.js | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/server/serverConstants.js b/server/serverConstants.js index 117a1bee0..aad4ffa24 100644 --- a/server/serverConstants.js +++ b/server/serverConstants.js @@ -29,6 +29,10 @@ E.OPENTOK_API_KEY = { envVar: 'TB_API_KEY', jsonPath: 'OpenTok.apiKey', required E.OPENTOK_API_SECRET = { envVar: 'TB_API_SECRET', jsonPath: 'OpenTok.apiSecret', required: true }; +E.OPENTOK_PRECALL_API_KEY = { envVar: 'TB_PRECALL_API_KEY', jsonPath: 'precallTest.apiKey' }; + +E.OPENTOK_PRECALL_API_SECRET = { envVar: 'TB_PRECALL_API_SECRET', jsonPath: 'precallTest.apiSecret' }; + E.OPENTOK_JS_URL = { envVar: 'TB_JS_URL', jsonPath: 'OpenTok.jsUrl', required: false, defaultValue: 'https://static.opentok.com/v2/js/opentok.min.js' }; E.FIREBASE_DATA_URL = { envVar: 'FB_DATA_URL', jsonPath: 'Firebase.dataUrl' }; diff --git a/server/serverMethods.js b/server/serverMethods.js index 25d8a62e4..560c23a03 100644 --- a/server/serverMethods.js +++ b/server/serverMethods.js @@ -93,12 +93,16 @@ function ServerMethods(aLogLevel, aModules) { var templatingSecret = config.get(C.TEMPLATING_SECRET); var apiKey = config.get(C.OPENTOK_API_KEY); var apiSecret = config.get(C.OPENTOK_API_SECRET); + var precallApiKey = config.get(C.OPENTOK_PRECALL_API_KEY) || config.get(C.OPENTOK_API_KEY); + var precallApiSecret = config.get(C.OPENTOK_PRECALL_API_SECRET) + || config.get(C.OPENTOK_API_SECRET); var opentokJsUrl = config.get(C.OPENTOK_JS_URL); logger.log('apiSecret', apiSecret); var archivePollingTO = config.get(C.ARCHIVE_POLLING_INITIAL_TIMEOUT); var archivePollingTOMultiplier = config.get(C.ARCHIVE_POLLING_TIMEOUT_MULTIPLIER); var otInstance = Utils.CachifiedObject(Opentok, apiKey, apiSecret); + var precallOtInstance = Utils.CachifiedObject(Opentok, precallApiKey, precallApiSecret); var allowIframing = config.get(C.ALLOW_IFRAMING); var archiveAlways = config.get(C.ARCHIVE_ALWAYS); @@ -161,8 +165,11 @@ function ServerMethods(aLogLevel, aModules) { return firebaseArchivesPromise .then(firebaseArchives => ({ otInstance, + precallOtInstance, apiKey, apiSecret, + precallApiKey, + precallApiSecret, archivePollingTO, archivePollingTOMultiplier, maxSessionAgeMs, @@ -319,7 +326,7 @@ function ServerMethods(aLogLevel, aModules) { var userName = query && query.userName; // Create a session ID and token for the network test - tbConfig.otInstance.createSession({ mediaMode: 'routed' }, (error, testSession) => { + tbConfig.precallOtInstance.createSession({ mediaMode: 'routed' }, (error, testSession) => { // We really don't want to cache this aRes.set('Cache-Control', 'no-cache, no-store, must-revalidate'); aRes.set('Pragma', 'no-cache'); @@ -343,7 +350,8 @@ function ServerMethods(aLogLevel, aModules) { feedbackUrl: tbConfig.feedbackUrl, precallSessionId: testSession.sessionId, apiKey: tbConfig.apiKey, - precallToken: tbConfig.otInstance.generateToken(testSession.sessionId, { + precallApiKey: tbConfig.precallApiKey, + precallToken: tbConfig.precallOtInstance.generateToken(testSession.sessionId, { role: 'publisher', }), hasSip: tbConfig.enableSip, diff --git a/views/room.ejs b/views/room.ejs index 289e3d67b..599928a5d 100755 --- a/views/room.ejs +++ b/views/room.ejs @@ -26,6 +26,7 @@ diff --git a/test/unit/firebase_spec.js b/test/unit/firebase_spec.js index 4cbe1c54a..3379770bc 100644 --- a/test/unit/firebase_spec.js +++ b/test/unit/firebase_spec.js @@ -33,7 +33,7 @@ describe('FirebaseModel', () => { it('should return a promise, and it should fulfill', (done) => { - initPromise = FirebaseModel.init(baseURL, 'fakeToken'); + initPromise = FirebaseModel.init(); expect(initPromise.then).to.be.a('function'); initPromise.then(() => { done(); diff --git a/test/unit/recordingsController_spec.js b/test/unit/recordingsController_spec.js index b7cf63662..64e862c0d 100644 --- a/test/unit/recordingsController_spec.js +++ b/test/unit/recordingsController_spec.js @@ -37,7 +37,7 @@ describe('RecordingsController', () => { return Promise.resolve(model); }); var enableArchiveManager = true; - RecordingsController.init(enableArchiveManager, 'valueA'); + RecordingsController.init(enableArchiveManager); })); }); }); diff --git a/test/unit/roomView_spec.html b/test/unit/roomView_spec.html index 02a91af2f..bf3a7cc6c 100644 --- a/test/unit/roomView_spec.html +++ b/test/unit/roomView_spec.html @@ -137,9 +137,9 @@
-
Chrome extension was installed successfully.
+
You need a Chrome extension to share your screen.

-

You need to refresh your browser in order to use it.

+

Once you have installed it, refresh your browser and click 'share screen' again.

diff --git a/test/unit/screenShareController_spec.js b/test/unit/screenShareController_spec.js index 1e62a0f2d..83f68455b 100644 --- a/test/unit/screenShareController_spec.js +++ b/test/unit/screenShareController_spec.js @@ -128,8 +128,6 @@ describe('ScreenShareController', () => { it('should respond correctly to screenShareView:installExtension when ' + 'installation works', (done) => { var event = new CustomEvent('screenShareView:installExtension'); - window.chrome.isGoingToWork = true; - window.addEventListener('screenShareController:extInstallationResult', function handlerTest(evt) { window.removeEventListener('screenShareController:extInstallationResult', handlerTest); @@ -145,14 +143,15 @@ describe('ScreenShareController', () => { it('should respond correctly to screenShareView:installExtension when ' + 'installation does not work', (done) => { var event = new CustomEvent('screenShareView:installExtension'); - window.chrome.isGoingToWork = false; + var realWindowOpen = window.open; + window.open = () => null; window.addEventListener('screenShareController:extInstallationResult', function handlerTest(evt) { window.removeEventListener('screenShareController:extInstallationResult', handlerTest); expect(evt.detail.error).to.be.true; - expect(evt.detail.message).to.be.equal(window.chrome.error); done(); + window.open = realWindowOpen; }); ScreenShareController.init('usr', chromeExtId, otHelper).then(() => { diff --git a/test/unit/screenShareView_spec.html b/test/unit/screenShareView_spec.html index c1408deff..76619dbe5 100644 --- a/test/unit/screenShareView_spec.html +++ b/test/unit/screenShareView_spec.html @@ -15,9 +15,9 @@
-
Chrome extension was installed successfully.
+
You need a Chrome extension to share your screen.

-

You need to refresh your browser in order to use it.

+

Once you have installed it, refresh your browser and click 'share screen' again.