diff --git a/app/src/RoomClient.js b/app/src/RoomClient.js index 0151e2b..dcebc75 100644 --- a/app/src/RoomClient.js +++ b/app/src/RoomClient.js @@ -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; diff --git a/app/src/actions/fileActions.js b/app/src/actions/fileActions.js index f9277d6..b5d90e5 100644 --- a/app/src/actions/fileActions.js +++ b/app/src/actions/fileActions.js @@ -32,4 +32,9 @@ export const setFileDone = (magnetUri, sharedFiles) => ({ type : 'SET_FILE_DONE', payload : { magnetUri, sharedFiles } + }); + +export const clearFiles = () => + ({ + type : 'CLEAR_FILES' }); \ No newline at end of file diff --git a/app/src/actions/meActions.js b/app/src/actions/meActions.js index fc72592..ec9f00d 100644 --- a/app/src/actions/meActions.js +++ b/app/src/actions/meActions.js @@ -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) => diff --git a/app/src/actions/roomActions.js b/app/src/actions/roomActions.js index 227969c..ac97179 100644 --- a/app/src/actions/roomActions.js +++ b/app/src/actions/roomActions.js @@ -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', diff --git a/app/src/components/Containers/Me.js b/app/src/components/Containers/Me.js index 6dc368f..b79c5d0 100644 --- a/app/src/components/Containers/Me.js +++ b/app/src/components/Containers/Me.js @@ -385,7 +385,7 @@ const Me = (props) => - { !me.isMobile && + { me.browser.platform !== 'mobile' &&
advancedMode, peer, activeSpeaker, - isMobile, + browser, micConsumer, webcamConsumer, screenConsumer, @@ -260,7 +260,7 @@ const Peer = (props) =>
- { !isMobile && + { browser.platform !== 'mobile' && }, 2000); }} > - { !isMobile && + { browser.platform !== 'mobile' && ...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 ); } } diff --git a/app/src/components/MeetingDrawer/FileSharing/FileSharing.js b/app/src/components/MeetingDrawer/FileSharing/FileSharing.js index a3ff80e..11857f6 100644 --- a/app/src/components/MeetingDrawer/FileSharing/FileSharing.js +++ b/app/src/components/MeetingDrawer/FileSharing/FileSharing.js @@ -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 ( + + ({ + 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 ( +
    +
  • + +
  • + +
+ ); +}; + +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))); \ No newline at end of file diff --git a/app/src/components/MeetingDrawer/ParticipantList/ListModerator.js b/app/src/components/MeetingDrawer/ParticipantList/ListModerator.js index 1c711a1..caaea73 100644 --- a/app/src/components/MeetingDrawer/ParticipantList/ListModerator.js +++ b/app/src/components/MeetingDrawer/ParticipantList/ListModerator.js @@ -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} diff --git a/app/src/components/Room.js b/app/src/components/Room.js index 4cc40c2..fbd4cc5 100644 --- a/app/src/components/Room.js +++ b/app/src/components/Room.js @@ -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 - { isMobile && + { browser.platform === 'mobile' && browser.os !== 'ios' && } @@ -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 ); diff --git a/app/src/deviceInfo.js b/app/src/deviceInfo.js index 3e5d361..deef6f5 100644 --- a/app/src/deviceInfo.js +++ b/app/src/deviceInfo.js @@ -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 }; } diff --git a/app/src/reducers/files.js b/app/src/reducers/files.js index 2475cff..7caf2f0 100644 --- a/app/src/reducers/files.js +++ b/app/src/reducers/files.js @@ -85,6 +85,9 @@ const files = (state = {}, action) => return { ...state, [magnetUri]: newFile }; } + case 'CLEAR_FILES': + return {}; + default: return state; } diff --git a/app/src/reducers/me.js b/app/src/reducers/me.js index 9ed18cd..7d60b4d 100644 --- a/app/src/reducers/me.js +++ b/app/src/reducers/me.js @@ -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': diff --git a/app/src/reducers/room.js b/app/src/reducers/room.js index cd702f2..6340b40 100644 --- a/app/src/reducers/room.js +++ b/app/src/reducers/room.js @@ -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; diff --git a/app/src/translations/cn.json b/app/src/translations/cn.json index 6f24a6a..81794f2 100644 --- a/app/src/translations/cn.json +++ b/app/src/translations/cn.json @@ -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 } \ No newline at end of file diff --git a/app/src/translations/cs.json b/app/src/translations/cs.json index 401eb2d..f1ddf62 100644 --- a/app/src/translations/cs.json +++ b/app/src/translations/cs.json @@ -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 } diff --git a/app/src/translations/de.json b/app/src/translations/de.json index ca61408..945f942 100644 --- a/app/src/translations/de.json +++ b/app/src/translations/de.json @@ -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 } diff --git a/app/src/translations/dk.json b/app/src/translations/dk.json index 839c94c..d3cd47e 100644 --- a/app/src/translations/dk.json +++ b/app/src/translations/dk.json @@ -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 } diff --git a/app/src/translations/el.json b/app/src/translations/el.json index 054853c..1957ac6 100644 --- a/app/src/translations/el.json +++ b/app/src/translations/el.json @@ -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 } \ No newline at end of file diff --git a/app/src/translations/en.json b/app/src/translations/en.json index 463a1d0..4e1d1d5 100644 --- a/app/src/translations/en.json +++ b/app/src/translations/en.json @@ -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" } \ No newline at end of file diff --git a/app/src/translations/es.json b/app/src/translations/es.json index 3170d3b..3391600 100644 --- a/app/src/translations/es.json +++ b/app/src/translations/es.json @@ -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 } diff --git a/app/src/translations/fr.json b/app/src/translations/fr.json index 10e9566..bf93610 100644 --- a/app/src/translations/fr.json +++ b/app/src/translations/fr.json @@ -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 } diff --git a/app/src/translations/hr.json b/app/src/translations/hr.json index efc47f6..e3c1713 100644 --- a/app/src/translations/hr.json +++ b/app/src/translations/hr.json @@ -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 } diff --git a/app/src/translations/hu.json b/app/src/translations/hu.json index 7f7f334..f6625be 100644 --- a/app/src/translations/hu.json +++ b/app/src/translations/hu.json @@ -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 } diff --git a/app/src/translations/it.json b/app/src/translations/it.json index 7cb7d99..b253ef9 100644 --- a/app/src/translations/it.json +++ b/app/src/translations/it.json @@ -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 } diff --git a/app/src/translations/nb.json b/app/src/translations/nb.json index 49398aa..20b9668 100644 --- a/app/src/translations/nb.json +++ b/app/src/translations/nb.json @@ -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" } \ No newline at end of file diff --git a/app/src/translations/pl.json b/app/src/translations/pl.json index 7cb17f2..cd13f2d 100644 --- a/app/src/translations/pl.json +++ b/app/src/translations/pl.json @@ -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 } \ No newline at end of file diff --git a/app/src/translations/pt.json b/app/src/translations/pt.json index 8d3848d..a5edc8a 100644 --- a/app/src/translations/pt.json +++ b/app/src/translations/pt.json @@ -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 } diff --git a/app/src/translations/ro.json b/app/src/translations/ro.json index 0439cdf..337d7fb 100644 --- a/app/src/translations/ro.json +++ b/app/src/translations/ro.json @@ -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 } diff --git a/app/src/translations/uk.json b/app/src/translations/uk.json index 961aef5..67d6495 100644 --- a/app/src/translations/uk.json +++ b/app/src/translations/uk.json @@ -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 } \ No newline at end of file diff --git a/server/config/config.example.js b/server/config/config.example.js index 6b030e1..22f3dcb 100644 --- a/server/config/config.example.js +++ b/server/config/config.example.js @@ -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 ] }, diff --git a/server/lib/Room.js b/server/lib/Room.js index 8bbedf1..acb2a10 100644 --- a/server/lib/Room.js +++ b/server/lib/Room.js @@ -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;