[mirotalksfu] - on eject ban user, update dep.
هذا الالتزام موجود في:
@@ -31,6 +31,7 @@ module.exports = class Room {
|
|||||||
this.survey = config.survey;
|
this.survey = config.survey;
|
||||||
this.redirect = config.redirect;
|
this.redirect = config.redirect;
|
||||||
this.peers = new Map();
|
this.peers = new Map();
|
||||||
|
this.bannedPeers = [];
|
||||||
this.router = null;
|
this.router = null;
|
||||||
this.createTheRouter();
|
this.createTheRouter();
|
||||||
}
|
}
|
||||||
@@ -325,6 +326,24 @@ module.exports = class Room {
|
|||||||
this.peers.get(socket_id).closeProducer(producer_id);
|
this.peers.get(socket_id).closeProducer(producer_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ####################################################
|
||||||
|
// HANDLE BANNED PEERS
|
||||||
|
// ####################################################
|
||||||
|
|
||||||
|
addBannedPeer(uuid) {
|
||||||
|
if (!this.bannedPeers.includes(uuid)) {
|
||||||
|
this.bannedPeers.push(uuid);
|
||||||
|
log.debug('Added to the banned list', {
|
||||||
|
uuid: uuid,
|
||||||
|
banned: this.bannedPeers,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isBanned(uuid) {
|
||||||
|
return this.bannedPeers.includes(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
// ####################################################
|
// ####################################################
|
||||||
// ROOM STATUS
|
// ROOM STATUS
|
||||||
// ####################################################
|
// ####################################################
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ dependencies: {
|
|||||||
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
|
* @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
|
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
|
||||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||||
* @version 1.3.57
|
* @version 1.3.58
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -782,6 +782,8 @@ function startServer() {
|
|||||||
|
|
||||||
const room = roomList.get(socket.room_id);
|
const room = roomList.get(socket.room_id);
|
||||||
|
|
||||||
|
if (data.action === 'eject') room.addBannedPeer(data.to_peer_uuid);
|
||||||
|
|
||||||
data.broadcast
|
data.broadcast
|
||||||
? room.broadCast(data.peer_id, 'peerAction', data)
|
? room.broadCast(data.peer_id, 'peerAction', data)
|
||||||
: room.sendTo(data.peer_id, 'peerAction', data);
|
: room.sendTo(data.peer_id, 'peerAction', data);
|
||||||
@@ -969,8 +971,7 @@ function startServer() {
|
|||||||
|
|
||||||
// User Auth required, we check if peer valid
|
// User Auth required, we check if peer valid
|
||||||
if (hostCfg.user_auth) {
|
if (hostCfg.user_auth) {
|
||||||
const peer_username = data.peer_info.peer_username;
|
const { peer_username, peer_password } = data.peer_info;
|
||||||
const peer_password = data.peer_info.peer_password;
|
|
||||||
|
|
||||||
const isPeerValid = isAuthPeer(peer_username, peer_password);
|
const isPeerValid = isAuthPeer(peer_username, peer_password);
|
||||||
|
|
||||||
@@ -989,6 +990,24 @@ function startServer() {
|
|||||||
|
|
||||||
const room = roomList.get(socket.room_id);
|
const room = roomList.get(socket.room_id);
|
||||||
|
|
||||||
|
// check if banned...
|
||||||
|
const peerUUID = data.peer_info.peer_uuid;
|
||||||
|
if (room.isBanned(peerUUID)) {
|
||||||
|
const { peer_name, peer_uuid, os_name, os_version, browser_name, browser_version } = data.peer_info;
|
||||||
|
log.info('[Join] - peer is banned!', {
|
||||||
|
room_id: data.room_id,
|
||||||
|
peer: {
|
||||||
|
name: peer_name,
|
||||||
|
uuid: peer_uuid,
|
||||||
|
os_name: os_name,
|
||||||
|
os_version: os_version,
|
||||||
|
browser_name: browser_name,
|
||||||
|
browser_version: browser_version,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return cb('isBanned');
|
||||||
|
}
|
||||||
|
|
||||||
room.addPeer(new Peer(socket.id, data));
|
room.addPeer(new Peer(socket.id, data));
|
||||||
|
|
||||||
const activeRooms = getActiveRooms();
|
const activeRooms = getActiveRooms();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mirotalksfu",
|
"name": "mirotalksfu",
|
||||||
"version": "1.3.57",
|
"version": "1.3.58",
|
||||||
"description": "WebRTC SFU browser-based video calls",
|
"description": "WebRTC SFU browser-based video calls",
|
||||||
"main": "Server.js",
|
"main": "Server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
"crypto-js": "4.2.0",
|
"crypto-js": "4.2.0",
|
||||||
"express": "4.18.2",
|
"express": "4.18.2",
|
||||||
"httpolyglot": "0.1.2",
|
"httpolyglot": "0.1.2",
|
||||||
"mediasoup": "3.13.16",
|
"mediasoup": "3.13.17",
|
||||||
"mediasoup-client": "3.7.2",
|
"mediasoup-client": "3.7.2",
|
||||||
"ngrok": "^4.3.3",
|
"ngrok": "^4.3.3",
|
||||||
"openai": "^4.26.0",
|
"openai": "^4.26.0",
|
||||||
|
|||||||
@@ -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 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
|
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
|
||||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||||
* @version 1.3.57
|
* @version 1.3.58
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -3091,6 +3091,14 @@ function wbDrawing(status) {
|
|||||||
// HANDLE PARTICIPANTS
|
// HANDLE PARTICIPANTS
|
||||||
// ####################################################
|
// ####################################################
|
||||||
|
|
||||||
|
async function getRemotePeerInfo(peer_id) {
|
||||||
|
const peers = await getRoomPeers();
|
||||||
|
for (let peer of Array.from(peers.keys()).filter((id) => id === peer_id)) {
|
||||||
|
return peers.get(peer).peer_info;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
async function getRoomPeers() {
|
async function getRoomPeers() {
|
||||||
let room_info = await rc.getRoomInfo();
|
let room_info = await rc.getRoomInfo();
|
||||||
return new Map(JSON.parse(room_info.peers));
|
return new Map(JSON.parse(room_info.peers));
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
|
* @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
|
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
|
||||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||||
* @version 1.3.57
|
* @version 1.3.58
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -356,6 +356,10 @@ class RoomClient {
|
|||||||
console.log('00-WARNING ----> Room Lobby Enabled, Wait to confirm my join');
|
console.log('00-WARNING ----> Room Lobby Enabled, Wait to confirm my join');
|
||||||
return this.waitJoinConfirm();
|
return this.waitJoinConfirm();
|
||||||
}
|
}
|
||||||
|
if (room === 'isBanned') {
|
||||||
|
console.log('00-WARNING ----> You are Banned from the Room!');
|
||||||
|
return this.isBanned();
|
||||||
|
}
|
||||||
const peers = new Map(JSON.parse(room.peers));
|
const peers = new Map(JSON.parse(room.peers));
|
||||||
for (let peer of Array.from(peers.keys()).filter((id) => id !== this.peer_id)) {
|
for (let peer of Array.from(peers.keys()).filter((id) => id !== this.peer_id)) {
|
||||||
let peer_info = peers.get(peer).peer_info;
|
let peer_info = peers.get(peer).peer_info;
|
||||||
@@ -5232,6 +5236,25 @@ class RoomClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isBanned() {
|
||||||
|
this.sound('alert');
|
||||||
|
Swal.fire({
|
||||||
|
allowOutsideClick: false,
|
||||||
|
allowEscapeKey: false,
|
||||||
|
showDenyButton: false,
|
||||||
|
showConfirmButton: true,
|
||||||
|
background: swalBackground,
|
||||||
|
imageUrl: image.forbidden,
|
||||||
|
title: 'Banned',
|
||||||
|
text: 'You are banned from this room!',
|
||||||
|
confirmButtonText: `Ok`,
|
||||||
|
showClass: { popup: 'animate__animated animate__fadeInDown' },
|
||||||
|
hideClass: { popup: 'animate__animated animate__fadeOutUp' },
|
||||||
|
}).then(() => {
|
||||||
|
this.exit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// ####################################################
|
// ####################################################
|
||||||
// HANDLE AUDIO VOLUME
|
// HANDLE AUDIO VOLUME
|
||||||
// ####################################################
|
// ####################################################
|
||||||
@@ -5394,7 +5417,7 @@ class RoomClient {
|
|||||||
// PEER ACTION
|
// PEER ACTION
|
||||||
// ####################################################
|
// ####################################################
|
||||||
|
|
||||||
peerAction(from_peer_name, id, action, emit = true, broadcast = false, info = true, msg = '') {
|
async peerAction(from_peer_name, id, action, emit = true, broadcast = false, info = true, msg = '') {
|
||||||
const words = id.split('___');
|
const words = id.split('___');
|
||||||
const peer_id = words[0];
|
const peer_id = words[0];
|
||||||
|
|
||||||
@@ -5403,6 +5426,7 @@ class RoomClient {
|
|||||||
from_peer_name: this.peer_name,
|
from_peer_name: this.peer_name,
|
||||||
from_peer_id: this.peer_id,
|
from_peer_id: this.peer_id,
|
||||||
from_peer_uuid: this.peer_uuid,
|
from_peer_uuid: this.peer_uuid,
|
||||||
|
to_peer_uuid: '',
|
||||||
peer_id: peer_id,
|
peer_id: peer_id,
|
||||||
action: action,
|
action: action,
|
||||||
message: '',
|
message: '',
|
||||||
@@ -5481,6 +5505,13 @@ class RoomClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'eject':
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم