From c5459a2f19607a5d87a783b75cabcdfa4c0abd1d Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 10 Jan 2017 18:39:21 +0000 Subject: [PATCH] Enable screen sharing easter-egg in desktop app --- electron/src/electron-main.js | 2 ++ src/vector/platform/ElectronPlatform.js | 4 ++++ src/vector/platform/WebPlatform.js | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/electron/src/electron-main.js b/electron/src/electron-main.js index 2b135a03ed..675640a520 100644 --- a/electron/src/electron-main.js +++ b/electron/src/electron-main.js @@ -148,6 +148,8 @@ process.on('uncaughtException', function (error) { electron.ipcMain.on('install_update', installUpdate); +electron.app.commandLine.appendSwitch('--enable-usermedia-screen-capturing'); + electron.app.on('ready', () => { if (vectorConfig.update_base_url) { console.log("Starting auto update with base URL: " + vectorConfig.update_base_url); diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index 3b41822bda..68df88b096 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -127,4 +127,8 @@ export default class ElectronPlatform extends VectorBasePlatform { getDefaultDeviceDisplayName() { return "Riot Desktop on " + platformFriendlyName(); } + + screenCaptureErrorString() { + return null; + } } diff --git a/src/vector/platform/WebPlatform.js b/src/vector/platform/WebPlatform.js index c4ed4d5550..2029822b61 100644 --- a/src/vector/platform/WebPlatform.js +++ b/src/vector/platform/WebPlatform.js @@ -196,4 +196,12 @@ export default class WebPlatform extends VectorBasePlatform { return app_name + " via " + ua.getBrowser().name + " on " + ua.getOS().name; } + + screenCaptureErrorString() { + // it won't work at all if you're not on HTTPS so whine whine whine + if (!global.window || global.window.location.protocol !== "https:") { + return "You need to be using HTTPS to place a screen-sharing call."; + } + return null; + } }