feat(etherpad): Drops duplicate command listener.

This commit is contained in:
damencho
2026-03-10 13:29:31 -05:00
committed by Дамян Минков
parent 0097e08d60
commit 1674a05ad0
3 changed files with 18 additions and 23 deletions

View File

@@ -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;