[mirotalksfu] - improve whoAreYou logic

هذا الالتزام موجود في:
Miroslav Pejic
2024-10-21 02:00:28 +02:00
الأصل 114943715d
التزام 7a6dca51a3
7 ملفات معدلة مع 74 إضافات و11 حذوفات

عرض الملف

@@ -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