Merge remote-tracking branch 'upstream/develop' into mm-exporter

auto_join_3.3
Christian Hörtnagl 2020-04-22 10:49:05 +02:00
commit 8c7b741dea
32 changed files with 268 additions and 56 deletions

View File

@ -199,6 +199,9 @@ export default class RoomClient
// @type {mediasoupClient.Device}
this._mediasoupDevice = null;
// Put the browser info into state
store.dispatch(meActions.setBrowser(device));
// Our WebTorrent client
this._webTorrent = null;
@ -206,13 +209,10 @@ export default class RoomClient
store.dispatch(settingsActions.setVideoResolution(defaultResolution));
// Max spotlights
if (device.bowser.getPlatformType() === 'desktop')
if (device.platform === 'desktop')
this._maxSpotlights = lastN;
else
{
this._maxSpotlights = mobileLastN;
store.dispatch(meActions.setIsMobile());
}
store.dispatch(
settingsActions.setLastN(this._maxSpotlights));
@ -1317,6 +1317,28 @@ export default class RoomClient
roomActions.setClearChatInProgress(false));
}
async clearFileSharing()
{
logger.debug('clearFileSharing()');
store.dispatch(
roomActions.setClearFileSharingInProgress(true));
try
{
await this.sendRequest('moderator:clearFileSharing');
store.dispatch(fileActions.clearFiles());
}
catch (error)
{
logger.error('clearFileSharing() failed: %o', error);
}
store.dispatch(
roomActions.setClearFileSharingInProgress(false));
}
async kickPeer(peerId)
{
logger.debug('kickPeer() [peerId:"%s"]', peerId);
@ -2217,6 +2239,21 @@ export default class RoomClient
break;
}
case 'moderator:clearFileSharing':
{
store.dispatch(fileActions.clearFiles());
store.dispatch(requestActions.notify(
{
text : intl.formatMessage({
id : 'moderator.clearFiles',
defaultMessage : 'Moderator cleared the files'
})
}));
break;
}
case 'producerScore':
{
const { producerId, score } = notification.data;

View File

@ -32,4 +32,9 @@ export const setFileDone = (magnetUri, sharedFiles) =>
({
type : 'SET_FILE_DONE',
payload : { magnetUri, sharedFiles }
});
export const clearFiles = () =>
({
type : 'CLEAR_FILES'
});

View File

@ -4,9 +4,10 @@ export const setMe = ({ peerId, loginEnabled }) =>
payload : { peerId, loginEnabled }
});
export const setIsMobile = () =>
export const setBrowser = (browser) =>
({
type : 'SET_IS_MOBILE'
type : 'SET_BROWSER',
payload : { browser }
});
export const loggedIn = (flag) =>

View File

@ -135,6 +135,12 @@ export const setClearChatInProgress = (flag) =>
payload : { flag }
});
export const setClearFileSharingInProgress = (flag) =>
({
type : 'CLEAR_FILE_SHARING_IN_PROGRESS',
payload : { flag }
});
export const setUserRoles = (userRoles) =>
({
type : 'SET_USER_ROLES',

View File

@ -385,7 +385,7 @@ const Me = (props) =>
</Fab>
</div>
</Tooltip>
{ !me.isMobile &&
{ me.browser.platform !== 'mobile' &&
<Tooltip title={screenTip} placement='left'>
<div>
<Fab

View File

@ -121,7 +121,7 @@ const Peer = (props) =>
advancedMode,
peer,
activeSpeaker,
isMobile,
browser,
micConsumer,
webcamConsumer,
screenConsumer,
@ -260,7 +260,7 @@ const Peer = (props) =>
</div>
</Tooltip>
{ !isMobile &&
{ browser.platform !== 'mobile' &&
<Tooltip
title={intl.formatMessage({
id : 'label.newWindow',
@ -408,7 +408,7 @@ const Peer = (props) =>
}, 2000);
}}
>
{ !isMobile &&
{ browser.platform !== 'mobile' &&
<Tooltip
title={intl.formatMessage({
id : 'label.newWindow',
@ -509,7 +509,7 @@ Peer.propTypes =
screenConsumer : appPropTypes.Consumer,
windowConsumer : PropTypes.string,
activeSpeaker : PropTypes.bool,
isMobile : PropTypes.bool,
browser : PropTypes.object.isRequired,
spacing : PropTypes.number,
style : PropTypes.object,
smallButtons : PropTypes.bool,
@ -530,7 +530,7 @@ const makeMapStateToProps = (initialState, { id }) =>
...getPeerConsumers(state, id),
windowConsumer : state.room.windowConsumer,
activeSpeaker : id === state.room.activeSpeakerId,
isMobile : state.me.isMobile
browser : state.me.browser
};
};
@ -565,7 +565,7 @@ export default withRoomContext(connect(
prev.consumers === next.consumers &&
prev.room.activeSpeakerId === next.room.activeSpeakerId &&
prev.room.windowConsumer === next.room.windowConsumer &&
prev.me.isMobile === next.me.isMobile
prev.me.browser === next.me.browser
);
}
}

View File

@ -5,6 +5,7 @@ import { withStyles } from '@material-ui/core/styles';
import { withRoomContext } from '../../../RoomContext';
import { useIntl } from 'react-intl';
import FileList from './FileList';
import FileSharingModerator from './FileSharingModerator';
import Paper from '@material-ui/core/Paper';
import Button from '@material-ui/core/Button';
@ -58,6 +59,7 @@ const FileSharing = (props) =>
return (
<Paper className={classes.root}>
<FileSharingModerator />
<input
className={classes.input}
type='file'

View File

@ -0,0 +1,104 @@
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { withRoomContext } from '../../../RoomContext';
import { withStyles } from '@material-ui/core/styles';
import { useIntl, FormattedMessage } from 'react-intl';
import Button from '@material-ui/core/Button';
const styles = (theme) =>
({
root :
{
padding : theme.spacing(1),
width : '100%',
overflow : 'hidden',
cursor : 'auto',
display : 'flex',
listStyleType : 'none',
boxShadow : '0 2px 5px 2px rgba(0, 0, 0, 0.2)',
backgroundColor : 'rgba(255, 255, 255, 1)'
},
listheader :
{
padding : theme.spacing(1),
fontWeight : 'bolder'
},
actionButton :
{
marginLeft : 'auto'
}
});
const FileSharingModerator = (props) =>
{
const intl = useIntl();
const {
roomClient,
isFileSharingModerator,
room,
classes
} = props;
if (!isFileSharingModerator)
return;
return (
<ul className={classes.root}>
<li className={classes.listheader}>
<FormattedMessage
id='room.moderatoractions'
defaultMessage='Moderator actions'
/>
</li>
<Button
aria-label={intl.formatMessage({
id : 'room.clearFileSharing',
defaultMessage : 'Clear files'
})}
className={classes.actionButton}
variant='contained'
color='secondary'
disabled={room.clearFileSharingInProgress}
onClick={() => roomClient.clearFileSharing()}
>
<FormattedMessage
id='room.clearFileSharing'
defaultMessage='Clear files'
/>
</Button>
</ul>
);
};
FileSharingModerator.propTypes =
{
roomClient : PropTypes.any.isRequired,
isFileSharingModerator : PropTypes.bool,
room : PropTypes.object,
classes : PropTypes.object.isRequired
};
const mapStateToProps = (state) =>
({
isFileSharingModerator :
state.me.roles.some((role) =>
state.room.permissionsFromRoles.MODERATE_FILES.includes(role)),
room : state.room
});
export default withRoomContext(connect(
mapStateToProps,
null,
null,
{
areStatesEqual : (next, prev) =>
{
return (
prev.room === next.room &&
prev.me === next.me
);
}
}
)(withStyles(styles)(FileSharingModerator)));

View File

@ -16,10 +16,6 @@ const styles = (theme) =>
cursor : 'auto',
display : 'flex'
},
actionButtons :
{
display : 'flex'
},
divider :
{
marginLeft : theme.spacing(2)
@ -43,7 +39,6 @@ const ListModerator = (props) =>
id : 'room.muteAll',
defaultMessage : 'Mute all'
})}
className={classes.actionButton}
variant='contained'
color='secondary'
disabled={room.muteAllInProgress}
@ -60,7 +55,6 @@ const ListModerator = (props) =>
id : 'room.stopAllVideo',
defaultMessage : 'Stop all video'
})}
className={classes.actionButton}
variant='contained'
color='secondary'
disabled={room.stopAllVideoInProgress}
@ -77,7 +71,6 @@ const ListModerator = (props) =>
id : 'room.closeMeeting',
defaultMessage : 'Close meeting'
})}
className={classes.actionButton}
variant='contained'
color='secondary'
disabled={room.closeMeetingInProgress}

View File

@ -139,7 +139,7 @@ class Room extends React.PureComponent
{
const {
room,
isMobile,
browser,
advancedMode,
toolAreaOpen,
toggleToolArea,
@ -204,7 +204,7 @@ class Room extends React.PureComponent
</Hidden>
</nav>
{ isMobile &&
{ browser.platform === 'mobile' && browser.os !== 'ios' &&
<WakeLock />
}
@ -225,7 +225,7 @@ class Room extends React.PureComponent
Room.propTypes =
{
room : appPropTypes.Room.isRequired,
isMobile : PropTypes.bool.isRequired,
browser : PropTypes.object.isRequired,
advancedMode : PropTypes.bool.isRequired,
toolAreaOpen : PropTypes.bool.isRequired,
setToolbarsVisible : PropTypes.func.isRequired,
@ -237,7 +237,7 @@ Room.propTypes =
const mapStateToProps = (state) =>
({
room : state.room,
isMobile : state.me.isMobile,
browser : state.me.browser,
advancedMode : state.settings.advancedMode,
toolAreaOpen : state.toolarea.toolAreaOpen
});
@ -263,7 +263,7 @@ export default connect(
{
return (
prev.room === next.room &&
prev.me.isMobile === next.me.isMobile &&
prev.me.browser === next.me.browser &&
prev.settings.advancedMode === next.settings.advancedMode &&
prev.toolarea.toolAreaOpen === next.toolarea.toolAreaOpen
);

View File

@ -24,8 +24,10 @@ export default function()
return {
flag,
name : browser.getBrowserName(),
version : browser.getBrowserVersion(),
bowser : browser
os : browser.getOSName(true), // ios, android, linux...
platform : browser.getPlatformType(true), // mobile, desktop, tablet
name : browser.getBrowserName(),
version : browser.getBrowserVersion(),
bowser : browser
};
}

View File

@ -85,6 +85,9 @@ const files = (state = {}, action) =>
return { ...state, [magnetUri]: newFile };
}
case 'CLEAR_FILES':
return {};
default:
return state;
}

View File

@ -2,7 +2,7 @@ const initialState =
{
id : null,
picture : null,
isMobile : false,
browser : null,
roles : [ 'normal' ], // Default role
canSendMic : false,
canSendWebcam : false,
@ -39,9 +39,11 @@ const me = (state = initialState, action) =>
};
}
case 'SET_IS_MOBILE':
case 'SET_BROWSER':
{
return { ...state, isMobile: true };
const { browser } = action.payload;
return { ...state, browser };
}
case 'LOGGED_IN':

View File

@ -1,36 +1,38 @@
const initialState =
{
name : '',
state : 'new', // new/connecting/connected/disconnected/closed,
locked : false,
inLobby : false,
signInRequired : false,
accessCode : '', // access code to the room if locked and joinByAccessCode == true
joinByAccessCode : true, // if true: accessCode is a possibility to open the room
activeSpeakerId : null,
torrentSupport : false,
showSettings : false,
fullScreenConsumer : null, // ConsumerID
windowConsumer : null, // ConsumerID
toolbarsVisible : true,
mode : 'democratic',
selectedPeerId : null,
spotlights : [],
settingsOpen : false,
lockDialogOpen : false,
joined : false,
muteAllInProgress : false,
stopAllVideoInProgress : false,
closeMeetingInProgress : false,
clearChatInProgress : false,
userRoles : { NORMAL: 'normal' }, // Default role
permissionsFromRoles : {
name : '',
state : 'new', // new/connecting/connected/disconnected/closed,
locked : false,
inLobby : false,
signInRequired : false,
accessCode : '', // access code to the room if locked and joinByAccessCode == true
joinByAccessCode : true, // if true: accessCode is a possibility to open the room
activeSpeakerId : null,
torrentSupport : false,
showSettings : false,
fullScreenConsumer : null, // ConsumerID
windowConsumer : null, // ConsumerID
toolbarsVisible : true,
mode : 'democratic',
selectedPeerId : null,
spotlights : [],
settingsOpen : false,
lockDialogOpen : false,
joined : false,
muteAllInProgress : false,
stopAllVideoInProgress : false,
closeMeetingInProgress : false,
clearChatInProgress : false,
clearFileSharingInProgress : false,
userRoles : { NORMAL: 'normal' }, // Default role
permissionsFromRoles : {
CHANGE_ROOM_LOCK : [],
PROMOTE_PEER : [],
SEND_CHAT : [],
MODERATE_CHAT : [],
SHARE_SCREEN : [],
SHARE_FILE : [],
MODERATE_FILES : [],
MODERATE_ROOM : []
}
};
@ -189,6 +191,9 @@ const room = (state = initialState, action) =>
case 'CLEAR_CHAT_IN_PROGRESS':
return { ...state, clearChatInProgress: action.payload.flag };
case 'CLEAR_FILE_SHARING_IN_PROGRESS':
return { ...state, clearFileSharingInProgress: action.payload.flag };
case 'SET_USER_ROLES':
{
const { userRoles } = action.payload;

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": null,
"room.closeMeeting": null,
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": null,
"me.mutedPTT": null,
@ -147,6 +148,7 @@
"devices.cameraError": "访问相机时发生错误",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -52,6 +52,7 @@
"room.stopAllVideo": null,
"room.closeMeeting": null,
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": null,
"me.mutedPTT": null,
@ -142,6 +143,7 @@
"devices.cameraError": "Při přístupu k vaší kameře se vyskytla chyba",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": "Alle Videos stoppen",
"room.closeMeeting": "Meeting schließen",
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": "Dein Browser unterstützt keine Spracherkennung",
"me.mutedPTT": "Du bist stummgeschalted, Halte die SPACE-Taste um zu sprechen",
@ -147,6 +148,7 @@
"devices.cameraError": "Fehler mit deiner Kamera",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": null,
"room.closeMeeting": null,
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": null,
"me.mutedPTT": null,
@ -147,6 +148,7 @@
"device.cameraError": "Der opstod en fejl ved tilkobling af dit kamera",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": null,
"room.closeMeeting": null,
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": null,
"me.mutedPTT": null,
@ -147,6 +148,7 @@
"devices.cameraError": "Παρουσιάστηκε σφάλμα κατά την πρόσβαση στην κάμερά σας",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": "Stop all video",
"room.closeMeeting": "Close meeting",
"room.clearChat": "Clear chat",
"room.clearFileSharing": "Clear files",
"room.speechUnsupported": "Your browser does not support speech recognition",
"me.mutedPTT": "You are muted, hold down SPACE-BAR to talk",
@ -147,6 +148,7 @@
"devices.cameraError": "An error occured while accessing your camera",
"moderator.clearChat": "Moderator cleared the chat",
"moderator.clearFiles": "Moderator cleared the files",
"moderator.muteAudio": "Moderator muted your audio",
"moderator.muteVideo": "Moderator muted your video"
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": null,
"room.closeMeeting": null,
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": null,
"me.mutedPTT": null,
@ -147,6 +148,7 @@
"devices.cameraError": "Hubo un error al acceder a su cámara",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": null,
"room.closeMeeting": null,
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": null,
"me.mutedPTT": null,
@ -146,6 +147,7 @@
"devices.cameraError": "Une erreur est apparue lors de l'accès à votre caméra",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": "Ugasi sve kamere",
"room.closeMeeting": "Završi sastanak",
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": "Vaš preglednik ne podržava prepoznavanje govora",
"me.mutedPTT": "Utišani ste, pritisnite i držite SPACE tipku za razgovor",
@ -147,6 +148,7 @@
"devices.cameraError": "Greška prilikom pristupa kameri",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": null,
"room.closeMeeting": null,
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": null,
"me.mutedPTT": null,
@ -147,6 +148,7 @@
"devices.cameraError": "Hiba történt a kamera elérése során",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": null,
"room.closeMeeting": null,
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": null,
"me.mutedPTT": null,
@ -146,6 +147,7 @@
"devices.cameraError": "Errore con l'accesso alla videocamera",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": "Stopp all video",
"room.closeMeeting": "Avslutt møte",
"room.clearChat": "Tøm chat",
"room.clearFileSharing": "Fjern filer",
"room.speechUnsupported": "Din nettleser støtter ikke stemmegjenkjenning",
"me.mutedPTT": "Du er dempet, hold nede SPACE for å snakke",
@ -147,6 +148,7 @@
"devices.cameraError": "Det skjedde noe feil med kameraet ditt",
"moderator.clearChat": "Moderator tømte chatten",
"moderator.clearFiles": "Moderator fjernet filer",
"moderator.muteAudio": "Moderator mutet lyden din",
"moderator.muteVideo": "Moderator mutet videoen din"
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": null,
"room.closeMeeting": null,
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": null,
"me.mutedPTT": null,
@ -147,6 +148,7 @@
"devices.cameraError": "Wystąpił błąd podczas uzyskiwania dostępu do kamery",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": null,
"room.closeMeeting": null,
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": null,
"me.mutedPTT": null,
@ -147,6 +148,7 @@
"devices.cameraError": "Ocorreu um erro no acesso à sua câmara",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": null,
"room.closeMeeting": null,
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": null,
"me.mutedPTT": null,
@ -147,6 +148,7 @@
"devices.cameraError": "A apărut o eroare la accesarea camerei video",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -53,6 +53,7 @@
"room.stopAllVideo": null,
"room.closeMeeting": null,
"room.clearChat": null,
"room.clearFileSharing": null,
"room.speechUnsupported": null,
"tooltip.login": "Увійти",
@ -144,6 +145,7 @@
"devices.cameraError": "Під час доступу до камери сталася помилка",
"moderator.clearChat": null,
"moderator.clearFiles": null,
"moderator.muteAudio": null,
"moderator.muteVideo": null
}

View File

@ -235,6 +235,8 @@ module.exports =
SHARE_SCREEN : [ userRoles.NORMAL ],
// The role(s) have permission to share files
SHARE_FILE : [ userRoles.NORMAL ],
// The role(s) have permission to moderate files
MODERATE_FILES : [ userRoles.MODERATOR ],
// The role(s) have permission to moderate room (e.g. kick user)
MODERATE_ROOM : [ userRoles.MODERATOR ]
},

View File

@ -1178,6 +1178,24 @@ class Room extends EventEmitter
break;
}
case 'moderator:clearFileSharing':
{
if (
!peer.roles.some((role) => config.permissionsFromRoles.MODERATE_FILES.includes(role))
)
throw new Error('peer not authorized');
this._fileHistory = [];
// Spread to others
this._notification(peer.socket, 'moderator:clearFileSharing', null, true);
// Return no error
cb();
break;
}
case 'raiseHand':
{
const { raisedHand } = request.data;