[mirotalksfu] - fix direct join with password
هذا الالتزام موجود في:
@@ -108,6 +108,10 @@ module.exports = class Room {
|
|||||||
return this.peers;
|
return this.peers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPeersCount() {
|
||||||
|
return this.peers.size;
|
||||||
|
}
|
||||||
|
|
||||||
toJson() {
|
toJson() {
|
||||||
return {
|
return {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
|
|||||||
@@ -469,6 +469,16 @@ io.on('connection', (socket) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('getPeerCounts', async ({}, callback) => {
|
||||||
|
if (!roomList.has(socket.room_id)) return;
|
||||||
|
|
||||||
|
let peerCounts = roomList.get(socket.room_id).getPeersCount();
|
||||||
|
|
||||||
|
log.debug('Peer counts', { peerCounts: peerCounts });
|
||||||
|
|
||||||
|
callback({ peerCounts: peerCounts });
|
||||||
|
});
|
||||||
|
|
||||||
socket.on('roomAction', (data) => {
|
socket.on('roomAction', (data) => {
|
||||||
if (!roomList.has(socket.room_id)) return;
|
if (!roomList.has(socket.room_id)) return;
|
||||||
|
|
||||||
|
|||||||
@@ -3193,9 +3193,22 @@ class RoomClient {
|
|||||||
switch (action) {
|
switch (action) {
|
||||||
case 'lock':
|
case 'lock':
|
||||||
if (room_password) {
|
if (room_password) {
|
||||||
data.password = room_password;
|
this.socket
|
||||||
this.socket.emit('roomAction', data);
|
.request('getPeerCounts')
|
||||||
this.roomStatus(action);
|
.then(
|
||||||
|
async function (data) {
|
||||||
|
// Only the presenter can lock the room
|
||||||
|
if (isPresenter || data.peerCounts == 1) {
|
||||||
|
isPresenter = true;
|
||||||
|
data.password = room_password;
|
||||||
|
this.socket.emit('roomAction', data);
|
||||||
|
this.roomStatus(action);
|
||||||
|
}
|
||||||
|
}.bind(this),
|
||||||
|
)
|
||||||
|
.catch((err) => {
|
||||||
|
console.log('Get peer counts:', err);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
allowOutsideClick: false,
|
allowOutsideClick: false,
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم