diff --git a/app/src/Server.js b/app/src/Server.js index 5c24ab66..fcfe8227 100644 --- a/app/src/Server.js +++ b/app/src/Server.js @@ -40,7 +40,7 @@ dependencies: { * @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon * @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com - * @version 1.3.59 + * @version 1.3.60 * */ @@ -773,7 +773,18 @@ function startServer() { log.debug('Peer action', data); - const presenterActions = ['mute', 'unmute', 'hide', 'unhide', 'stop', 'start', 'eject', 'geoLocation']; + const presenterActions = [ + 'mute', + 'unmute', + 'hide', + 'unhide', + 'stop', + 'start', + 'eject', + 'ban', + 'geoLocation', + ]; + if (presenterActions.some((v) => data.action === v)) { const isPresenter = await isPeerPresenter( socket.room_id, @@ -786,7 +797,7 @@ function startServer() { const room = roomList.get(socket.room_id); - if (data.action === 'eject') room.addBannedPeer(data.to_peer_uuid); + if (data.action === 'ban') room.addBannedPeer(data.to_peer_uuid); data.broadcast ? room.broadCast(data.peer_id, 'peerAction', data) diff --git a/package.json b/package.json index 91944feb..ed6b083d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mirotalksfu", - "version": "1.3.59", + "version": "1.3.60", "description": "WebRTC SFU browser-based video calls", "main": "Server.js", "scripts": { @@ -38,8 +38,8 @@ "author": "Miroslav Pejic", "license": "AGPL-3.0", "dependencies": { - "@sentry/integrations": "7.98.0", - "@sentry/node": "7.98.0", + "@sentry/integrations": "7.99.0", + "@sentry/node": "7.99.0", "axios": "^1.6.7", "body-parser": "1.20.2", "colors": "1.4.0", diff --git a/public/js/Room.js b/public/js/Room.js index c77ee9ec..4ee35742 100644 --- a/public/js/Room.js +++ b/public/js/Room.js @@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h * @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon * @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com - * @version 1.3.59 + * @version 1.3.60 * */ @@ -48,6 +48,7 @@ const _PEER = { raiseHand: '', lowerHand: '', acceptPeer: '', + banPeer: '', ejectPeer: '', geoLocation: '', sendFile: '', @@ -3206,6 +3207,7 @@ function getParticipantsList(peers) { const peer_video = peer_info.peer_video ? _PEER.videoOn : _PEER.videoOff; const peer_screen = peer_info.peer_screen ? _PEER.screenOn : _PEER.screenOff; const peer_hand = peer_info.peer_hand ? _PEER.raiseHand : _PEER.lowerHand; + const peer_ban = _PEER.banPeer; const peer_eject = _PEER.ejectPeer; const peer_geoLocation = _PEER.geoLocation; const peer_sendFile = _PEER.sendFile; @@ -3247,6 +3249,7 @@ function getParticipantsList(peers) {
+ diff --git a/public/js/RoomClient.js b/public/js/RoomClient.js index 694a920e..5dd87ce2 100644 --- a/public/js/RoomClient.js +++ b/public/js/RoomClient.js @@ -9,7 +9,7 @@ * @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon * @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com - * @version 1.3.59 + * @version 1.3.60 * */ @@ -33,6 +33,8 @@ const html = { sendFile: 'fas fa-upload', sendMsg: 'fas fa-paper-plane', sendVideo: 'fab fa-youtube', + geolocation: 'fas fa-location-dot', + ban: 'fas fa-ban', kickOut: 'fas fa-times', ghost: 'fas fa-ghost', undo: 'fas fa-undo', @@ -1943,7 +1945,7 @@ class RoomClient { } handleConsumer(id, type, stream, peer_name, peer_info) { - let elem, vb, d, p, i, cm, au, pip, fs, ts, sf, sm, sv, ko, pb, pm, pv, pn; + let elem, vb, d, p, i, cm, au, pip, fs, ts, sf, sm, sv, ban, ko, pb, pm, pv, pn; console.log('PEER-INFO', peer_info); @@ -2004,6 +2006,9 @@ class RoomClient { au = document.createElement('button'); au.id = remotePeerId + '__audio'; au.className = remotePeerAudio ? html.audioOn : html.audioOff; + ban = document.createElement('button'); + ban.id = id + '___' + remotePeerId + '___ban'; + ban.className = html.ban; ko = document.createElement('button'); ko.id = id + '___' + remotePeerId + '___kickOut'; ko.className = html.kickOut; @@ -2023,6 +2028,7 @@ class RoomClient { pb.style.height = '1%'; pm.appendChild(pb); BUTTONS.consumerVideo.ejectButton && vb.appendChild(ko); + BUTTONS.consumerVideo.banButton && vb.appendChild(ban); BUTTONS.consumerVideo.audioVolumeInput && !this.isMobileDevice && vb.appendChild(pv); vb.appendChild(au); vb.appendChild(cm); @@ -2052,6 +2058,7 @@ class RoomClient { BUTTONS.consumerVideo.muteVideoButton && this.handleCM(cm.id); BUTTONS.consumerVideo.muteAudioButton && this.handleAU(au.id); this.handlePV(id + '___' + pv.id); + this.handleBAN(ban.id); this.handleKO(ko.id); this.handlePN(elem.id, pn.id, d.id, remoteIsScreen); this.handleZV(elem.id, d.id, remotePeerId); @@ -2072,6 +2079,7 @@ class RoomClient { this.setTippy(cm.id, 'Hide', 'bottom'); this.setTippy(au.id, 'Mute', 'bottom'); this.setTippy(pv.id, '🔊 Volume', 'bottom'); + this.setTippy(ban.id, 'Ban', 'bottom'); this.setTippy(ko.id, 'Eject', 'bottom'); } this.setPeerAudio(remotePeerId, remotePeerAudio); @@ -2154,7 +2162,7 @@ class RoomClient { setVideoOff(peer_info, remotePeer = false) { //console.log('setVideoOff', peer_info); - let d, vb, i, h, au, sf, sm, sv, ko, p, pm, pb, pv; + let d, vb, i, h, au, sf, sm, sv, ban, ko, p, pm, pb, pv; let peer_id = peer_info.peer_id; let peer_name = peer_info.peer_name; let peer_audio = peer_info.peer_audio; @@ -2184,6 +2192,9 @@ class RoomClient { sv = document.createElement('button'); sv.id = 'remotePeer___' + peer_id + '___sendVideo'; sv.className = html.sendVideo; + ban = document.createElement('button'); + ban.id = 'remotePeer___' + peer_id + '___ban'; + ban.className = html.ban; ko = document.createElement('button'); ko.id = 'remotePeer___' + peer_id + '___kickOut'; ko.className = html.kickOut; @@ -2208,6 +2219,7 @@ class RoomClient { pm.appendChild(pb); if (remotePeer) { BUTTONS.videoOff.ejectButton && vb.appendChild(ko); + BUTTONS.videoOff.banButton && vb.appendChild(ban); BUTTONS.videoOff.sendVideoButton && vb.appendChild(sv); BUTTONS.videoOff.sendFileButton && vb.appendChild(sf); BUTTONS.videoOff.sendMessageButton && vb.appendChild(sm); @@ -2226,6 +2238,7 @@ class RoomClient { this.handleSM(sm.id); this.handleSF(sf.id); this.handleSV(sv.id); + this.handleBAN(ban.id); this.handleKO(ko.id); } this.handleDD(d.id, peer_id, !remotePeer); @@ -2240,6 +2253,7 @@ class RoomClient { this.setTippy(sv.id, 'Send video', 'bottom'); this.setTippy(au.id, 'Mute', 'bottom'); this.setTippy(pv.id, '🔊 Volume', 'bottom'); + this.setTippy(ban.id, 'Ban', 'bottom'); this.setTippy(ko.id, 'Eject', 'bottom'); } remotePeer ? this.setPeerAudio(peer_id, peer_audio) : this.setIsAudio(peer_id, peer_audio); @@ -5357,6 +5371,23 @@ class RoomClient { } } + // #################################################### + // HANDLE BAN + // ################################################### + + handleBAN(uid) { + const words = uid.split('___'); + let peer_id = words[1] + '___pBan'; + let btnBan = this.getId(uid); + if (btnBan) { + btnBan.addEventListener('click', () => { + isPresenter + ? this.peerAction('me', peer_id, 'ban') + : this.userLog('warning', 'Only the presenter can ban the participants', 'top-end'); + }); + } + } + // #################################################### // HANDLE KICK-OUT // ################################################### @@ -5566,11 +5597,14 @@ class RoomClient { } } break; - case 'eject': + case 'ban': if (!isRulesActive || isPresenter) { const peer_info = await getRemotePeerInfo(peer_id); - console.log('EJECT PEER', peer_info); - if (peer_info) data.to_peer_uuid = peer_info.peer_uuid; + console.log('BAN PEER', peer_info); + if (peer_info) { + data.to_peer_uuid = peer_info.peer_uuid; + return this.confirmPeerAction(data.action, data); + } } break; default: @@ -5582,6 +5616,16 @@ class RoomClient { // receive... const peerActionAllowed = peer_id === this.peer_id || broadcast; switch (action) { + case 'ban': + if (peerActionAllowed) { + const message = `Will ban you from the room${ + msg ? `