[mirotalksfu] - improve email validation

هذا الالتزام موجود في:
Miroslav Pejic
2025-10-20 06:54:17 +02:00
الأصل edbede0b58
التزام c9b3da5ad1
7 ملفات معدلة مع 25 إضافات و20 حذوفات

عرض الملف

@@ -64,7 +64,7 @@ dev dependencies: {
* @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.9.85
* @version 1.9.86
*
*/

عرض الملف

@@ -57,10 +57,8 @@ function hasPathTraversal(input) {
}
function isValidEmail(email) {
if (!email || typeof email !== 'string') return false;
const e = email.trim();
const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[A-Za-z]{2,}$/;
return re.test(e);
const emailRegex = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
return emailRegex.test(email);
}
module.exports = {

4
package-lock.json مولّد
عرض الملف

@@ -1,12 +1,12 @@
{
"name": "mirotalksfu",
"version": "1.9.85",
"version": "1.9.86",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mirotalksfu",
"version": "1.9.85",
"version": "1.9.86",
"license": "AGPL-3.0",
"dependencies": {
"@aws-sdk/client-s3": "^3.913.0",

عرض الملف

@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.9.85",
"version": "1.9.86",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {

عرض الملف

@@ -78,7 +78,7 @@ let BRAND = {
},
about: {
imageUrl: '../images/mirotalk-logo.gif',
title: '<strong>WebRTC SFU v1.9.85</strong>',
title: '<strong>WebRTC SFU v1.9.86</strong>',
html: `
<button
id="support-button"

عرض الملف

@@ -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.9.85
* @version 1.9.86
*
*/
@@ -920,6 +920,11 @@ function getPeerName() {
return 'Invalid name';
}
console.log('Direct join', { name: name });
if (isValidEmail(name)) {
getId('notifyEmailInput').value = name;
}
return name;
}
@@ -1258,6 +1263,10 @@ async function whoAreYou() {
}
setCookie(room_id + '_name', name, 30);
peer_name = name;
if (isValidEmail(peer_name)) {
getId('notifyEmailInput').value = peer_name;
}
},
}).then(async () => {
if (!usernameEmoji.classList.contains('hidden')) {
@@ -4000,6 +4009,11 @@ async function sound(name, force = false) {
}
}
function isValidEmail(email) {
const emailRegex = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
return emailRegex.test(email);
}
async function isImageURL(url) {
if (!url) return false;
try {
@@ -5711,7 +5725,7 @@ function showAbout() {
position: 'center',
imageUrl: BRAND.about?.imageUrl && BRAND.about.imageUrl.trim() !== '' ? BRAND.about.imageUrl : image.about,
customClass: { image: 'img-about' },
title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.9.85',
title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.9.86',
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.9.85
* @version 1.9.86
*
*/
@@ -3766,7 +3766,7 @@ class RoomClient {
}
isValidEmail(email) {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
const emailRegex = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
return emailRegex.test(email);
}
@@ -10725,13 +10725,6 @@ class RoomClient {
// HELPERS
// ####################################################
isValidEmail(email) {
if (!email || typeof email !== 'string') return false;
const e = email.trim();
const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[A-Za-z]{2,}$/;
return re.test(e);
}
toggleVideoMirror() {
const peerVideo = this.getName(this.peer_id);
if (peerVideo) peerVideo.classList.toggle('mirror');