[mirotalk] - fix inputValidator

This commit is contained in:
Miroslav Pejic
2025-06-01 23:06:58 +02:00
parent 0230f4410e
commit 37311e5ae5
8 changed files with 17 additions and 13 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ dependencies: {
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.14
* @version 1.5.15
*
*/
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "mirotalk",
"version": "1.5.14",
"version": "1.5.15",
"description": "A free WebRTC browser-based video call",
"main": "server.js",
"scripts": {
+1 -1
View File
@@ -73,7 +73,7 @@ let brand = {
},
about: {
imageUrl: '../images/mirotalk-logo.gif',
title: 'WebRTC P2P v1.5.14',
title: 'WebRTC P2P v1.5.15',
html: `
<button
id="support-button"
+9 -5
View File
@@ -15,7 +15,7 @@
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.14
* @version 1.5.15
*
*/
@@ -1511,7 +1511,7 @@ async function whoAreYou() {
position: 'center',
input: 'text',
inputPlaceholder: 'Enter your email or name',
inputAttributes: { maxlength: 32, id: 'usernameInput' },
inputAttributes: { maxlength: 254, id: 'usernameInput' },
inputValue: window.localStorage.peer_name ? window.localStorage.peer_name : '',
html: initUser, // inject html
confirmButtonText: `Join meeting`,
@@ -1523,8 +1523,12 @@ async function whoAreYou() {
},
inputValidator: async (value) => {
if (!value) return 'Please enter your email or name';
// Long name
if (value.length > 30) return 'Name must be max 30 char';
// Long email or name
const isEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
if ((isEmail && value.length > 254) || (!isEmail && value.length > 32)) {
return isEmail ? 'Email must be max 254 char' : 'Name must be max 32 char';
}
// prevent xss execution itself
myPeerName = filterXSS(value);
@@ -11145,7 +11149,7 @@ function showAbout() {
Swal.fire({
background: swBg,
position: 'center',
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.5.14',
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.5.15',
imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
customClass: { image: 'img-about' },
html: `
+2 -2
View File
@@ -279,7 +279,7 @@ access to use this app.
id="searchPeerBarName"
type="text"
placeholder=" 🔍 Search peer by name..."
maxlength="32"
maxlength="254"
name="search"
/>
</div>
@@ -857,7 +857,7 @@ access to use this app.
</div>
<br /><br />
<div>
<input id="myPeerNameSet" type="text" placeholder="Change name..." maxlength="32" />
<input id="myPeerNameSet" type="text" placeholder="Change name..." maxlength="254" />
<button id="myPeerNameSetBtn"><i class="fas fa-user-edit"></i>&nbsp;Change name</button>
</div>
</div>
+1 -1
View File
@@ -140,7 +140,7 @@
class="form-input"
type="text"
value="mirotalk"
maxlength="32"
maxlength="254"
/>
<button
id="genRoomButton"
+1 -1
View File
@@ -84,7 +84,7 @@
class="form-input"
type="name"
placeholder="Username"
maxlength="32"
maxlength="254"
required
/>
</div>
+1 -1
View File
@@ -134,7 +134,7 @@
class="form-input"
type="text"
value="mirotalk"
maxlength="32"
maxlength="254"
/>
<button
id="genRoomButton"