From 8225f5e363aac1b46695c9b081b4b5b34ff7a5ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Fri, 24 Feb 2023 01:59:00 -0600 Subject: [PATCH] feat: Drops external connect optimization. (#12958) * feat: Drops external connect optimization. A bosh only optimization which is no longer used and does not bring any significant value when measured. * squash: Updates ljm. --- Makefile | 5 +- app.js | 11 --- config.js | 1 - connection.js | 53 +----------- connection_optimization/.eslintrc.js | 3 - .../connection_optimization.html | 0 .../do_external_connect.js | 86 ------------------- debian/jitsi-meet-web.install | 1 - doc/debian/jitsi-meet/jitsi-meet.example | 2 +- index.html | 2 - package-lock.json | 10 +-- package.json | 2 +- webpack.config.js | 10 --- 13 files changed, 12 insertions(+), 174 deletions(-) delete mode 100644 connection_optimization/.eslintrc.js delete mode 100644 connection_optimization/connection_optimization.html delete mode 100644 connection_optimization/do_external_connect.js diff --git a/Makefile b/Makefile index 32d14a9d7..2872b3485 100644 --- a/Makefile +++ b/Makefile @@ -44,8 +44,6 @@ deploy-appbundle: cp \ $(BUILD_DIR)/app.bundle.min.js \ $(BUILD_DIR)/app.bundle.min.js.map \ - $(BUILD_DIR)/do_external_connect.min.js \ - $(BUILD_DIR)/do_external_connect.min.js.map \ $(BUILD_DIR)/external_api.min.js \ $(BUILD_DIR)/external_api.min.js.map \ $(BUILD_DIR)/alwaysontop.min.js \ @@ -68,7 +66,6 @@ deploy-lib-jitsi-meet: $(LIBJITSIMEET_DIR)/dist/umd/lib-jitsi-meet.min.js \ $(LIBJITSIMEET_DIR)/dist/umd/lib-jitsi-meet.min.map \ $(LIBJITSIMEET_DIR)/dist/umd/lib-jitsi-meet.e2ee-worker.js \ - $(LIBJITSIMEET_DIR)/connection_optimization/external_connect.js \ $(LIBJITSIMEET_DIR)/modules/browser/capabilities.json \ $(DEPLOY_DIR) @@ -129,7 +126,7 @@ dev: deploy-init deploy-css deploy-rnnoise-binary deploy-tflite deploy-meet-mode source-package: mkdir -p source_package/jitsi-meet/css && \ - cp -r *.js *.html resources/*.txt connection_optimization favicon.ico fonts images libs static sounds LICENSE lang source_package/jitsi-meet && \ + cp -r *.js *.html resources/*.txt favicon.ico fonts images libs static sounds LICENSE lang source_package/jitsi-meet && \ cp css/all.css source_package/jitsi-meet/css && \ (cd source_package ; tar cjf ../jitsi-meet.tar.bz2 jitsi-meet) && \ rm -rf source_package diff --git a/app.js b/app.js index ac39d1c4c..5cabc0be3 100644 --- a/app.js +++ b/app.js @@ -33,17 +33,6 @@ window.APP = { API, conference, - // Used by do_external_connect.js if we receive the attach data after - // connect was already executed. status property can be 'initialized', - // 'ready', or 'connecting'. We are interested in 'ready' status only which - // means that connect was executed but we have to wait for the attach data. - // In status 'ready' handler property will be set to a function that will - // finish the connect process when the attach data or error is received. - connect: { - handler: null, - status: 'initialized' - }, - // Used for automated performance tests. connectionTimes: { 'index.loaded': window.indexLoadedTime diff --git a/config.js b/config.js index 02647606b..db811abe6 100644 --- a/config.js +++ b/config.js @@ -1372,7 +1372,6 @@ var config = { dialOutRegionUrl disableRemoteControl displayJids - externalConnectUrl e2eeLabels firefox_fake_device googleApiApplicationClientID diff --git a/connection.js b/connection.js index 74ee7552f..9b6f3f5d1 100644 --- a/connection.js +++ b/connection.js @@ -32,54 +32,6 @@ const logger = Logger.getLogger(__filename); */ export const DISCO_JIBRI_FEATURE = 'http://jitsi.org/protocol/jibri'; -/** - * Checks if we have data to use attach instead of connect. If we have the data - * executes attach otherwise check if we have to wait for the data. If we have - * to wait for the attach data we are setting handler to APP.connect.handler - * which is going to be called when the attach data is received otherwise - * executes connect. - * - * @param {string} [id] user id - * @param {string} [password] password - * @param {string} [roomName] the name of the conference. - */ -function checkForAttachParametersAndConnect(id, password, connection) { - if (window.XMPPAttachInfo) { - APP.connect.status = 'connecting'; - - // When connection optimization is not deployed or enabled the default - // value will be window.XMPPAttachInfo.status = "error" - // If the connection optimization is deployed and enabled and there is - // a failure the value will be window.XMPPAttachInfo.status = "error" - if (window.XMPPAttachInfo.status === 'error') { - connection.connect({ - id, - password - }); - - return; - } - - const attachOptions = window.XMPPAttachInfo.data; - - if (attachOptions) { - connection.attach(attachOptions); - delete window.XMPPAttachInfo.data; - } else { - connection.connect({ - id, - password - }); - } - } else { - APP.connect.status = 'ready'; - APP.connect.handler - = checkForAttachParametersAndConnect.bind( - null, - id, password, connection); - } -} - /** * Try to open connection using provided credentials. * @param {string} [id] @@ -182,7 +134,10 @@ export async function connect(id, password) { APP.store.dispatch(setPrejoinDisplayNameRequired()); } - checkForAttachParametersAndConnect(id, password, connection); + connection.connect({ + id, + password + }); }); } diff --git a/connection_optimization/.eslintrc.js b/connection_optimization/.eslintrc.js deleted file mode 100644 index 05aee778f..000000000 --- a/connection_optimization/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - 'extends': '../react/.eslintrc.js' -}; diff --git a/connection_optimization/connection_optimization.html b/connection_optimization/connection_optimization.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/connection_optimization/do_external_connect.js b/connection_optimization/do_external_connect.js deleted file mode 100644 index fbfcfdc21..000000000 --- a/connection_optimization/do_external_connect.js +++ /dev/null @@ -1,86 +0,0 @@ -/* global config, createConnectionExternally */ - -import getRoomName from '../react/features/base/config/getRoomName'; -import { parseURLParams } from '../react/features/base/util/parseURLParams'; - -/** - * Implements external connect using createConnectionExternally function defined - * in external_connect.js for Jitsi Meet. Parses the room name and JSON Web - * Token (JWT) from the URL and executes createConnectionExternally. - * - * NOTE: If you are using lib-jitsi-meet without Jitsi Meet, you should use this - * file as reference only because the implementation is Jitsi Meet-specific. - * - * NOTE: For optimal results this file should be included right after - * external_connect.js. - */ - -if (typeof createConnectionExternally === 'function') { - // URL params have higher priority than config params. - // Do not use external connect if websocket is enabled. - let url - = parseURLParams(window.location, true, 'hash')[ - 'config.externalConnectUrl'] - || config.websocket ? undefined : config.externalConnectUrl; - const isRecorder - = parseURLParams(window.location, true, 'hash')['config.iAmRecorder']; - - let roomName; - - if (url && (roomName = getRoomName()) && !isRecorder) { - url += `?room=${roomName}`; - - const token = parseURLParams(window.location, true, 'search').jwt; - - if (token) { - url += `&token=${token}`; - } - - createConnectionExternally( - url, - connectionInfo => { - // Sets that global variable to be used later by connect method - // in connection.js. - window.XMPPAttachInfo = { - status: 'success', - data: connectionInfo - }; - checkForConnectHandlerAndConnect(); - }, - errorCallback); - } else { - errorCallback(); - } -} else { - errorCallback(); -} - -/** - * Check if connect from connection.js was executed and executes the handler - * that is going to finish the connect work. - * - * @returns {void} - */ -function checkForConnectHandlerAndConnect() { - window.APP - && window.APP.connect.status === 'ready' - && window.APP.connect.handler(); -} - -/** - * Implements a callback to be invoked if anything goes wrong. - * - * @param {Error} error - The specifics of what went wrong. - * @returns {void} - */ -function errorCallback(error) { - // The value of error is undefined if external connect is disabled. - error && console.warn(error); - - // Sets that global variable to be used later by connect method in - // connection.js. - window.XMPPAttachInfo = { - status: 'error' - }; - checkForConnectHandlerAndConnect(); -} diff --git a/debian/jitsi-meet-web.install b/debian/jitsi-meet-web.install index c66a2ada0..67965926f 100644 --- a/debian/jitsi-meet-web.install +++ b/debian/jitsi-meet-web.install @@ -8,7 +8,6 @@ sounds /usr/share/jitsi-meet/ fonts /usr/share/jitsi-meet/ images /usr/share/jitsi-meet/ lang /usr/share/jitsi-meet/ -connection_optimization /usr/share/jitsi-meet/ resources/robots.txt /usr/share/jitsi-meet/ resources/*.sh /usr/share/jitsi-meet/scripts/ pwa-worker.js /usr/share/jitsi-meet/ diff --git a/doc/debian/jitsi-meet/jitsi-meet.example b/doc/debian/jitsi-meet/jitsi-meet.example index fd3914ecd..bcf26688f 100644 --- a/doc/debian/jitsi-meet/jitsi-meet.example +++ b/doc/debian/jitsi-meet/jitsi-meet.example @@ -93,7 +93,7 @@ server { } # ensure all static content can always be found first - location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$ + location ~ ^/(libs|css|static|images|fonts|lang|sounds|.well-known)/(.*)$ { add_header 'Access-Control-Allow-Origin' '*'; alias /usr/share/jitsi-meet/$1/$2; diff --git a/index.html b/index.html index f52251694..56d8ef092 100644 --- a/index.html +++ b/index.html @@ -182,8 +182,6 @@ 'error', loadErrHandler, true /* capture phase type of listener */); - - diff --git a/package-lock.json b/package-lock.json index 21a15533c..d59579d2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -71,7 +71,7 @@ "js-md5": "0.6.1", "js-sha512": "0.8.0", "jwt-decode": "2.2.0", - "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1583.0.0+931ca368/lib-jitsi-meet.tgz", + "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1585.0.0+362d1b2c/lib-jitsi-meet.tgz", "lodash": "4.17.21", "moment": "2.29.4", "moment-duration-format": "2.2.2", @@ -13399,8 +13399,8 @@ }, "node_modules/lib-jitsi-meet": { "version": "0.0.0", - "resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1583.0.0+931ca368/lib-jitsi-meet.tgz", - "integrity": "sha512-lzgRkJtdlZ7bfq2seBuONRM6UND8NJVjMOZPlVoq7uP4UuxffBztsoHGc0g5Y5zEqi1AnfYLwVZZvXkpd82iew==", + "resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1585.0.0+362d1b2c/lib-jitsi-meet.tgz", + "integrity": "sha512-g7JVvBfZixl1fKZI4ZMm3nvMasEz5sdapMzZdc76kA/eZSej2QuNK+W9cB8IypB7dqeTM4yzbfzi9rDipyWn+w==", "license": "Apache-2.0", "dependencies": { "@jitsi/js-utils": "2.0.0", @@ -30278,8 +30278,8 @@ } }, "lib-jitsi-meet": { - "version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1583.0.0+931ca368/lib-jitsi-meet.tgz", - "integrity": "sha512-lzgRkJtdlZ7bfq2seBuONRM6UND8NJVjMOZPlVoq7uP4UuxffBztsoHGc0g5Y5zEqi1AnfYLwVZZvXkpd82iew==", + "version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1585.0.0+362d1b2c/lib-jitsi-meet.tgz", + "integrity": "sha512-g7JVvBfZixl1fKZI4ZMm3nvMasEz5sdapMzZdc76kA/eZSej2QuNK+W9cB8IypB7dqeTM4yzbfzi9rDipyWn+w==", "requires": { "@jitsi/js-utils": "2.0.0", "@jitsi/logger": "2.0.0", diff --git a/package.json b/package.json index 284c11e18..8d497e9d1 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "js-md5": "0.6.1", "js-sha512": "0.8.0", "jwt-decode": "2.2.0", - "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1583.0.0+931ca368/lib-jitsi-meet.tgz", + "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1585.0.0+362d1b2c/lib-jitsi-meet.tgz", "lodash": "4.17.21", "moment": "2.29.4", "moment-duration-format": "2.2.2", diff --git a/webpack.config.js b/webpack.config.js index 2938fd4d7..d1309dd84 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -322,16 +322,6 @@ module.exports = (_env, argv) => { ], performance: getPerformanceHints(perfHintOptions, 800 * 1024) }), - Object.assign({}, config, { - entry: { - 'do_external_connect': './connection_optimization/do_external_connect.js' - }, - plugins: [ - ...config.plugins, - ...getBundleAnalyzerPlugin(analyzeBundle, 'do_external_connect') - ], - performance: getPerformanceHints(perfHintOptions, 5 * 1024) - }), Object.assign({}, config, { entry: { 'analytics-ga': './react/features/analytics/handlers/GoogleAnalyticsHandler.ts'