Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(etherpad): Drops duplicate command listener.
damencho1674a05ad00a
diff --git a/conference.js b/conference.jsindex 413c594725..b181a54fcc 100644--- a/conference.js+++ b/conference.js@@ -1641,12 +1641,6 @@ export default {JitsiE2ePingEvents.E2E_RTT_CHANGED,(...args) => APP.store.dispatch(e2eRttChanged(...args)));- room.addCommandListener(this.commands.defaults.ETHERPAD,- ({ value }) => {- APP.UI.initEtherpad(value);- }- );-room.addCommandListener(this.commands.defaults.EMAIL, (data, from) => {APP.store.dispatch(participantUpdated({conference: room,diff --git a/modules/UI/UI.js b/modules/UI/UI.jsindex eaa26b8b6d..140682b9a6 100644--- a/modules/UI/UI.js+++ b/modules/UI/UI.js@@ -3,15 +3,11 @@const UI = {};-import Logger from '@jitsi/logger';-import {conferenceWillInit} from '../../react/features/base/conference/actions';import { isMobileBrowser } from '../../react/features/base/environment/utils';import { setColorAlpha } from '../../react/features/base/util/helpers';-import { sanitizeUrl } from '../../react/features/base/util/uri';-import { setDocumentUrl } from '../../react/features/etherpad/actions';import {setNotificationsEnabled,showNotification@@ -28,8 +24,6 @@ import EtherpadManager from './etherpad/Etherpad';import UIUtil from './util/UIUtil';import VideoLayout from './videolayout/VideoLayout';-const logger = Logger.getLogger('ui:core');-let etherpadManager;/**@@ -117,24 +111,17 @@ UI.unbindEvents = () => {/*** Setup and show Etherpad.- * @param {string} name etherpad id*/-UI.initEtherpad = name => {- const { getState, dispatch } = APP.store;+UI.initEtherpad = () => {+ const { getState } = APP.store;const configState = getState()['features/base/config'];- const etherpadBaseUrl = sanitizeUrl(configState.etherpad_base);- if (etherpadManager || !etherpadBaseUrl || !name) {+ if (etherpadManager) {return;}- logger.log('Etherpad is enabled');etherpadManager = new EtherpadManager();- const url = new URL(name, etherpadBaseUrl);-- dispatch(setDocumentUrl(url.toString()));-if (configState.openSharedDocumentOnJoin) {etherpadManager.toggleEtherpad();}diff --git a/react/features/etherpad/middleware.ts b/react/features/etherpad/middleware.tsindex edcdfa74c8..40e9482559 100644--- a/react/features/etherpad/middleware.ts+++ b/react/features/etherpad/middleware.ts@@ -27,12 +27,21 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {conference.addCommandListener(ETHERPAD_COMMAND,({ value }: { value: string; }) => {+ if (!value) {+ return;+ }+let url;const { etherpad_base: etherpadBase } = getState()['features/base/config'];const etherpadBaseUrl = sanitizeUrl(etherpadBase);try {- new URL(_sanitizePath(value));+ const newValue = _sanitizePath(value);++ // The sanitizeUrl function will return 'about:blank' for invalid URLs+ if (newValue !== 'about:blank' && !newValue.startsWith('//')) {+ new URL(newValue);+ }logger.warn(`Received suspicious value for etherpad command: ${value}`);@@ -57,6 +66,11 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {}dispatch(setDocumentUrl(url));++ if (typeof APP !== 'undefined') {+ logger.log('Etherpad is enabled');+ APP.UI.initEtherpad();+ }});break;