[mirotalksfu] - add Validator, update dep

هذا الالتزام موجود في:
Miroslav Pejic
2024-08-05 21:17:38 +02:00
الأصل 8cc6cd8da4
التزام 8414e4e108
6 ملفات معدلة مع 97 إضافات و22 حذوفات

عرض الملف

@@ -214,13 +214,28 @@ function getUUID4() {
}
function joinRoom() {
const roomName = filterXSS(document.getElementById('roomName').value);
if (roomName) {
window.location.href = '/join/' + roomName;
window.localStorage.lastRoom = roomName;
} else {
const roomName = filterXSS(document.getElementById('roomName').value).trim();
const roomValid = isValidRoomName(roomName);
if (!roomName) {
alert('Room name empty!\nPlease pick a room name.');
return;
}
if (!roomValid) {
alert('Invalid Room name!\nMust be a UUID4 or an alphanumeric string without special characters or spaces.');
return;
}
window.location.href = '/join/' + roomName;
window.localStorage.lastRoom = roomName;
}
function isValidRoomName(input) {
if (typeof input !== 'string') {
return false;
}
const pattern =
/^(?:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|[A-Za-z0-9-_]+)$/;
return pattern.test(input);
}
function adultContent() {

عرض الملف

@@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.39
* @version 1.5.40
*
*/
@@ -4335,7 +4335,7 @@ function showAbout() {
imageUrl: image.about,
customClass: { image: 'img-about' },
position: 'center',
title: 'WebRTC SFU v1.5.39',
title: 'WebRTC SFU v1.5.40',
html: `
<br />
<div id="about">

عرض الملف

@@ -9,7 +9,7 @@
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.39
* @version 1.5.40
*
*/
@@ -399,6 +399,12 @@ class RoomClient {
.request('join', data)
.then(async (room) => {
console.log('##### JOIN ROOM #####', room);
if (room === 'invalid') {
console.log(
'00-WARNING ----> Room is Invalid! Must be a UUID4 or an alphanumeric string without special characters or spaces',
);
return this.roomInvalid();
}
if (room === 'notAllowed') {
console.log(
'00-WARNING ----> Room is Unauthorized for current user, please provide a valid room name for this user',
@@ -6147,6 +6153,23 @@ class RoomClient {
// HANDLE ROOM ACTION
// ####################################################
roomInvalid() {
this.sound('alert');
Swal.fire({
allowOutsideClick: false,
allowEscapeKey: false,
background: swalBackground,
imageUrl: image.forbidden,
title: 'Oops, Room not valid',
text: 'Invalid room name! Must be a UUID4 or an alphanumeric string without special characters or spaces',
confirmButtonText: `OK`,
showClass: { popup: 'animate__animated animate__fadeInDown' },
hideClass: { popup: 'animate__animated animate__fadeOutUp' },
}).then(() => {
openURL(`/`);
});
}
userRoomNotAllowed() {
this.sound('alert');
Swal.fire({