From 51c675c6fe6195890d86cfdae339d8f0597346e4 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 1 Apr 2020 10:38:49 +0100 Subject: [PATCH] Give the jitsi wrapper its own external api script --- config.sample.json | 3 +-- docs/config.md | 3 --- package.json | 5 +++-- src/vector/jitsi/index.html | 2 ++ src/vector/jitsi/index.ts | 9 --------- 5 files changed, 6 insertions(+), 16 deletions(-) diff --git a/config.sample.json b/config.sample.json index b8dc2fbb4c..87fc63de03 100644 --- a/config.sample.json +++ b/config.sample.json @@ -53,7 +53,6 @@ "breadcrumbs": true }, "jitsi": { - "preferredDomain": "jitsi.riot.im", - "externalApiUrl": "https://jitsi.riot.im/libs/external_api.min.js" + "preferredDomain": "jitsi.riot.im" } } diff --git a/docs/config.md b/docs/config.md index 40e71361bb..1471faf9a4 100644 --- a/docs/config.md +++ b/docs/config.md @@ -88,9 +88,6 @@ For a good example, see https://riot.im/develop/config.json. 1. `preferredDomain`: The domain name of the preferred Jitsi instance. Defaults to `jitsi.riot.im`. This is used whenever a user clicks on the voice/video call buttons - integration managers may use a different domain. - 1. `externalApiUrl`: The URL to the Jitsi Meet API script. This is required - for showing any Jitsi widgets, no matter the source. Defaults to - `https://jitsi.riot.im/libs/external_api.min.js`. Note that `index.html` also has an og:image meta tag that is set to an image hosted on riot.im. This is the image used if links to your copy of Riot diff --git a/package.json b/package.json index 496c2a31f2..1de6446ef1 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,9 @@ "clean": "rimraf lib webapp electron_app/dist", "build": "yarn clean && yarn build:genfiles && yarn build:compile && yarn build:types && yarn build:bundle", "build-stats": "yarn clean && yarn build:genfiles && yarn build:compile && yarn build:types && yarn build:bundle-stats", + "build:jitsi": "curl -s https://jitsi.riot.im/libs/external_api.min.js > ./webapp/jitsi_external_api.min.js", "build:res": "node scripts/copy-res.js", - "build:genfiles": "yarn reskindex && yarn build:res", + "build:genfiles": "yarn reskindex && yarn build:res && yarn build:jitsi", "build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js", "build:compile": "babel -d lib --verbose --extensions \".ts,.js,.tsx\" src", "build:bundle": "cross-env NODE_ENV=production webpack -p --progress --bail --mode production", @@ -52,7 +53,7 @@ "install:electron": "electron-builder install-app-deps", "dist": "scripts/package.sh", "start": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n reskindex,reskindex-react,res,riot-js \"yarn reskindex:watch\" \"yarn reskindex:watch-react\" \"yarn start:res\" \"yarn start:js\"", - "start:res": "node scripts/copy-res.js -w", + "start:res": "yarn build:jitsi && node scripts/copy-res.js -w", "start:js": "webpack-dev-server --host=0.0.0.0 --output-filename=bundles/_dev_/[name].js --output-chunk-filename=bundles/_dev_/[name].js -w --progress --mode development", "electron": "yarn build && yarn install:electron && electron .", "lint": "yarn lint:types && yarn lint:ts && yarn lint:js && yarn lint:style", diff --git a/src/vector/jitsi/index.html b/src/vector/jitsi/index.html index 58184e0a5d..b9fc950e15 100644 --- a/src/vector/jitsi/index.html +++ b/src/vector/jitsi/index.html @@ -15,5 +15,7 @@ + + diff --git a/src/vector/jitsi/index.ts b/src/vector/jitsi/index.ts index 75b017a269..1108e70c18 100644 --- a/src/vector/jitsi/index.ts +++ b/src/vector/jitsi/index.ts @@ -52,7 +52,6 @@ let widgetApi: WidgetApi; // Set this up as early as possible because Riot will be hitting it almost immediately. widgetApi = new WidgetApi(qsParam('parentUrl'), qsParam('widgetId'), [ Capability.AlwaysOnScreen, - Capability.GetRiotWebConfig, ]); widgetApi.expectingExplicitReady = true; @@ -66,14 +65,6 @@ let widgetApi: WidgetApi; await widgetApi.waitReady(); await widgetApi.setAlwaysOnScreen(false); // start off as detachable from the screen - const riotConfig = await widgetApi.getRiotConfig(); - - // Get the Jitsi Meet API loaded up as fast as possible, but ensure that the widget's postMessage - // receiver (WidgetApi) is up and running first. - const scriptTag = document.createElement("script"); - scriptTag.src = riotConfig['jitsi']['externalApiUrl']; - document.body.appendChild(scriptTag); - // TODO: register widgetApi listeners for PTT controls (https://github.com/vector-im/riot-web/issues/12795) document.getElementById("joinButton").onclick = () => joinConference();