feat(old-electron-app-notification): Implement
Detects if Jitsi Meet is running in old jitsi-meet-electron app and warns the user for scurity issues.
This commit is contained in:
parent
4780e48be8
commit
6ce1eaba24
|
@ -460,7 +460,11 @@
|
||||||
"unmute": "Unmute",
|
"unmute": "Unmute",
|
||||||
"newDeviceCameraTitle": "New camera detected",
|
"newDeviceCameraTitle": "New camera detected",
|
||||||
"newDeviceAudioTitle": "New audio device detected",
|
"newDeviceAudioTitle": "New audio device detected",
|
||||||
"newDeviceAction": "Use"
|
"newDeviceAction": "Use",
|
||||||
|
"OldElectronAPPTitle": "Security vulnerability!",
|
||||||
|
"oldElectronClientDescription1": "You appear to be using an old verion of the Jitsi Meet client which has known security vulnerabilities. Please make sure you update to our ",
|
||||||
|
"oldElectronClientDescription2": "latest build",
|
||||||
|
"oldElectronClientDescription3": " now!"
|
||||||
},
|
},
|
||||||
"passwordSetRemotely": "set by another participant",
|
"passwordSetRemotely": "set by another participant",
|
||||||
"passwordDigitsOnly": "Up to {{number}} digits",
|
"passwordDigitsOnly": "Up to {{number}} digits",
|
||||||
|
|
|
@ -14,6 +14,7 @@ import '../../power-monitor';
|
||||||
import '../../room-lock';
|
import '../../room-lock';
|
||||||
import '../../talk-while-muted';
|
import '../../talk-while-muted';
|
||||||
import '../../video-layout';
|
import '../../video-layout';
|
||||||
|
import '../../old-client-notification';
|
||||||
|
|
||||||
import { AbstractApp } from './AbstractApp';
|
import { AbstractApp } from './AbstractApp';
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import { translate } from '../../base/i18n';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of the React {@code Component} props of {@link OldElectronAPPNotificationDescription}.
|
||||||
|
*/
|
||||||
|
type Props = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoked to obtain translated strings.
|
||||||
|
*/
|
||||||
|
t: Function
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A component that renders the description of the notification for old Jitsi Meet Electron clients.
|
||||||
|
*
|
||||||
|
* @extends AbstractApp
|
||||||
|
*/
|
||||||
|
export class OldElectronAPPNotificationDescription extends Component<Props> {
|
||||||
|
/**
|
||||||
|
* Implements React's {@link Component#render()}.
|
||||||
|
*
|
||||||
|
* @inheritdoc
|
||||||
|
* @returns {ReactElement}
|
||||||
|
*/
|
||||||
|
render() {
|
||||||
|
const { t } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{ t('notify.oldElectronClientDescription1') }
|
||||||
|
<a
|
||||||
|
href = 'https://github.com/jitsi/jitsi-meet-electron/releases/latest'
|
||||||
|
rel = 'noopener noreferrer'
|
||||||
|
target = '_blank'>
|
||||||
|
{ t('notify.oldElectronClientDescription2') }
|
||||||
|
</a>
|
||||||
|
{ t('notify.oldElectronClientDescription3') }
|
||||||
|
</div>);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export default translate(OldElectronAPPNotificationDescription);
|
|
@ -0,0 +1,3 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
export { default as OldElectronAPPNotificationDescription } from './OldElectronAPPNotificationDescription';
|
|
@ -0,0 +1,28 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
import { browser } from '../../../react/features/base/lib-jitsi-meet';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if Jitsi Meet is running in too old jitsi-meet-electron app and false otherwise.
|
||||||
|
*
|
||||||
|
* @returns {boolean} - True if Jitsi Meet is running in too old jitsi-meet-electron app and false otherwise.
|
||||||
|
*/
|
||||||
|
export function isOldJitsiMeetElectronApp() {
|
||||||
|
if (!browser.isElectron()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const match = navigator.userAgent.match(/(JitsiMeet)\s*\/\s*((\d+)\.[^\s]*)/);
|
||||||
|
|
||||||
|
if (!Array.isArray(match) || match.length < 3) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const majorVersion = Number(match[3]);
|
||||||
|
|
||||||
|
if (isNaN(majorVersion) || majorVersion >= 2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
import './middleware';
|
|
@ -0,0 +1,43 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { APP_WILL_MOUNT } from '../base/app';
|
||||||
|
import { MiddlewareRegistry } from '../base/redux';
|
||||||
|
import { showErrorNotification } from '../notifications';
|
||||||
|
|
||||||
|
import { isOldJitsiMeetElectronApp } from './functions';
|
||||||
|
import { OldElectronAPPNotificationDescription } from './components';
|
||||||
|
|
||||||
|
declare var interfaceConfig: Object;
|
||||||
|
|
||||||
|
MiddlewareRegistry.register(store => next => action => {
|
||||||
|
switch (action.type) {
|
||||||
|
case APP_WILL_MOUNT:
|
||||||
|
return _appWillMount(store, next, action);
|
||||||
|
}
|
||||||
|
|
||||||
|
return next(action);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies the feature that the action {@link APP_WILL_MOUNT} has being dispatched.
|
||||||
|
*
|
||||||
|
* @param {Store} store - The redux store in which the specified {@code action} is being dispatched.
|
||||||
|
* @param {Dispatch} next - The redux {@code dispatch} function to dispatch the specified {@code action}.
|
||||||
|
* @param {Action} action - The redux action {@code APP_WILL_MOUNT} which is being dispatched.
|
||||||
|
* @private
|
||||||
|
* @returns {Object} The new state that is the result of the reduction of the specified {@code action}.
|
||||||
|
*/
|
||||||
|
function _appWillMount(store, next, action) {
|
||||||
|
if (isOldJitsiMeetElectronApp()) {
|
||||||
|
const { dispatch } = store;
|
||||||
|
|
||||||
|
dispatch(showErrorNotification({
|
||||||
|
titleKey: 'notify.OldElectronAPPTitle',
|
||||||
|
description: <OldElectronAPPNotificationDescription />
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
return next(action);
|
||||||
|
}
|
Loading…
Reference in New Issue