[mirotalksfu] - improve whoAreYou logic
هذا الالتزام موجود في:
@@ -2,16 +2,46 @@
|
||||
|
||||
console.log(window.location);
|
||||
|
||||
const autoJoinRoom = false; // automatically join the guest to the meeting
|
||||
|
||||
const presenterLoginBtn = document.getElementById('presenterLoginButton');
|
||||
const guestJoinRoomBtn = document.getElementById('guestJoinRoomButton');
|
||||
|
||||
const pathParts = window.location.pathname.split('/');
|
||||
const roomPath = filterXSS(pathParts[pathParts.length - 1]);
|
||||
guestJoinRoomBtn.classList.add('disabled');
|
||||
|
||||
presenterLoginBtn.onclick = (e) => {
|
||||
const pathParts = window.location.pathname.split('/');
|
||||
const roomId = filterXSS(pathParts[pathParts.length - 1]);
|
||||
|
||||
presenterLoginBtn.onclick = () => {
|
||||
window.location.href = '/login';
|
||||
};
|
||||
|
||||
guestJoinRoomBtn.onclick = (e) => {
|
||||
window.location.href = '/join/' + roomPath;
|
||||
guestJoinRoomBtn.onclick = () => {
|
||||
window.location.href = '/join/' + roomId;
|
||||
};
|
||||
|
||||
function checkRoomStatus(roomId) {
|
||||
if (!roomId) {
|
||||
console.warn('Room ID empty!');
|
||||
return;
|
||||
}
|
||||
axios
|
||||
.post('/isRoomActive', { roomId })
|
||||
.then((response) => {
|
||||
console.log('isRoomActive', response.data);
|
||||
const roomActive = response.data.message;
|
||||
if (roomActive) {
|
||||
guestJoinRoomBtn.classList.remove('disabled');
|
||||
presenterLoginBtn.style.display = 'none';
|
||||
if (autoJoinRoom) guestJoinRoomBtn.click();
|
||||
} else {
|
||||
guestJoinRoomBtn.classList.add('disabled');
|
||||
presenterLoginBtn.style.display = 'inline-flex';
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error checking room status', error);
|
||||
});
|
||||
}
|
||||
|
||||
setInterval(() => checkRoomStatus(roomId), 5000); // Start checking room status every 5 seconds
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم