[mirotalksfu] - extend api room password
هذا الالتزام موجود في:
@@ -33,6 +33,7 @@ let rc = null;
|
||||
let producer = null;
|
||||
|
||||
let room_id = getRoomId();
|
||||
let room_password = getRoomPassword();
|
||||
let peer_name = getPeerName();
|
||||
let notify = getNotify();
|
||||
|
||||
@@ -282,6 +283,18 @@ function getPeerName() {
|
||||
return qs.get('name');
|
||||
}
|
||||
|
||||
function getRoomPassword() {
|
||||
let qs = new URLSearchParams(window.location.search);
|
||||
let roomPassword = qs.get('password');
|
||||
if (roomPassword) {
|
||||
let queryNoRoomPassword = roomPassword === '0' || roomPassword === 'false';
|
||||
if (queryNoRoomPassword != null) {
|
||||
return false;
|
||||
}
|
||||
return roomPassword;
|
||||
}
|
||||
}
|
||||
|
||||
// ####################################################
|
||||
// SOME PEER INFO
|
||||
// ####################################################
|
||||
@@ -593,6 +606,9 @@ function roomIsReady() {
|
||||
document.body.addEventListener('mousemove', (e) => {
|
||||
showButtons();
|
||||
});
|
||||
if (room_password) {
|
||||
lockRoomButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
function hide(elem) {
|
||||
|
||||
@@ -2522,33 +2522,39 @@ class RoomClient {
|
||||
if (emit) {
|
||||
switch (action) {
|
||||
case 'lock':
|
||||
Swal.fire({
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
showDenyButton: true,
|
||||
background: swalBackground,
|
||||
imageUrl: image.locked,
|
||||
input: 'text',
|
||||
inputPlaceholder: 'Set Room password',
|
||||
confirmButtonText: `OK`,
|
||||
denyButtonText: `Cancel`,
|
||||
showClass: {
|
||||
popup: 'animate__animated animate__fadeInDown',
|
||||
},
|
||||
hideClass: {
|
||||
popup: 'animate__animated animate__fadeOutUp',
|
||||
},
|
||||
inputValidator: (pwd) => {
|
||||
if (!pwd) return 'Please enter the Room password';
|
||||
this.RoomPassword = pwd;
|
||||
},
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
data.password = this.RoomPassword;
|
||||
this.socket.emit('roomAction', data);
|
||||
this.roomStatus(action);
|
||||
}
|
||||
});
|
||||
if (room_password) {
|
||||
data.password = room_password;
|
||||
this.socket.emit('roomAction', data);
|
||||
this.roomStatus(action);
|
||||
} else {
|
||||
Swal.fire({
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
showDenyButton: true,
|
||||
background: swalBackground,
|
||||
imageUrl: image.locked,
|
||||
input: 'text',
|
||||
inputPlaceholder: 'Set Room password',
|
||||
confirmButtonText: `OK`,
|
||||
denyButtonText: `Cancel`,
|
||||
showClass: {
|
||||
popup: 'animate__animated animate__fadeInDown',
|
||||
},
|
||||
hideClass: {
|
||||
popup: 'animate__animated animate__fadeOutUp',
|
||||
},
|
||||
inputValidator: (pwd) => {
|
||||
if (!pwd) return 'Please enter the Room password';
|
||||
this.RoomPassword = pwd;
|
||||
},
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
data.password = this.RoomPassword;
|
||||
this.socket.emit('roomAction', data);
|
||||
this.roomStatus(action);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'unlock':
|
||||
this.socket.emit('roomAction', data);
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم