The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/otr/client/tabBar.ts

33 lines
812 B

import { useMemo, lazy, useEffect } from 'react';
import { OTR } from './rocketchat.otr';
import { useSetting } from '../../../client/contexts/SettingsContext';
import { addAction } from '../../../client/views/room/lib/Toolbox';
const template = lazy(() => import('../../../client/views/room/contextualBar/OTR'));
addAction('otr', () => {
const enabled = useSetting('OTR_Enable');
const shouldAddAction = enabled && window.crypto;
useEffect(() => {
if (shouldAddAction) {
OTR.crypto = window.crypto.subtle;
OTR.enabled.set(true);
} else {
OTR.enabled.set(false);
}
}, [shouldAddAction]);
return useMemo(() => (shouldAddAction
? {
groups: ['direct'],
id: 'otr',
title: 'OTR',
icon: 'shredder',
template,
order: 13,
full: true,
} : null), [shouldAddAction]);
});