[mirotalksfu] - Fix username on join

هذا الالتزام موجود في:
Miroslav Pejic
2023-04-09 21:56:15 +02:00
الأصل ec49aa751b
التزام 7e66fa6253
2 ملفات معدلة مع 40 إضافات و1 حذوفات

عرض الملف

@@ -265,7 +265,7 @@ class RoomClient {
room_id,
})
.catch((err) => {
console.log('Create room error:', err);
console.log('Create room:', err);
});
}
@@ -284,6 +284,14 @@ class RoomClient {
console.log('00-WARNING ----> Room Lobby Enabled, Wait to confirm my join');
return this.waitJoinConfirm();
}
const peers = new Map(JSON.parse(room.peers));
for (let peer of Array.from(peers.keys()).filter((id) => id !== this.peer_id)) {
let peer_info = peers.get(peer).peer_info;
if (peer_info.peer_name == this.peer_name) {
console.log('00-WARNING ----> Username already in use');
return this.userNameAlreadyInRoom();
}
}
await this.joinAllowed(room);
}.bind(this),
)
@@ -653,6 +661,35 @@ class RoomClient {
);
}
// ####################################################
// CHECK USER
// ####################################################
async userNameAlreadyInRoom() {
this.sound('alert');
Swal.fire({
allowOutsideClick: false,
allowEscapeKey: false,
background: swalBackground,
imageUrl: image.user,
position: 'center',
title: 'Username',
html: `The Username is already in use. <br/> Please try with another one`,
showDenyButton: false,
confirmButtonText: `OK`,
showClass: {
popup: 'animate__animated animate__fadeInDown',
},
hideClass: {
popup: 'animate__animated animate__fadeOutUp',
},
}).then((result) => {
if (result.isConfirmed) {
openURL((window.location.href = '/join/' + this.room_id));
}
});
}
// ####################################################
// START LOCAL AUDIO VIDEO MEDIA
// ####################################################