[mirotalksfu] - FIx is valid URL
هذا الالتزام موجود في:
@@ -3037,17 +3037,12 @@ function startServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isValidHttpURL(input) {
|
function isValidHttpURL(input) {
|
||||||
const pattern = new RegExp(
|
try {
|
||||||
'^(https?:\\/\\/)?' + // protocol
|
const url = new URL(input);
|
||||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
|
return url.protocol === 'http:' || url.protocol === 'https:';
|
||||||
'localhost|' + // allow localhost
|
} catch (_) {
|
||||||
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
|
return false;
|
||||||
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
|
}
|
||||||
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
|
|
||||||
'(\\#[-a-z\\d_]*)?$',
|
|
||||||
'i',
|
|
||||||
); // fragment locator
|
|
||||||
return pattern.test(input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeMeData(room, peerName, isPresenter) {
|
function removeMeData(room, peerName, isPresenter) {
|
||||||
|
|||||||
@@ -5002,7 +5002,7 @@ class RoomClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isHtml(str) {
|
isHtml(str) {
|
||||||
var a = document.createElement('div');
|
const a = document.createElement('div');
|
||||||
a.innerHTML = str;
|
a.innerHTML = str;
|
||||||
for (var c = a.childNodes, i = c.length; i--; ) {
|
for (var c = a.childNodes, i = c.length; i--; ) {
|
||||||
if (c[i].nodeType == 1) return true;
|
if (c[i].nodeType == 1) return true;
|
||||||
@@ -5011,17 +5011,12 @@ class RoomClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isValidHttpURL(input) {
|
isValidHttpURL(input) {
|
||||||
const pattern = new RegExp(
|
try {
|
||||||
'^(https?:\\/\\/)?' + // protocol
|
new URL(input);
|
||||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
|
return true;
|
||||||
'localhost|' + // allow localhost
|
} catch (_) {
|
||||||
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
|
return false;
|
||||||
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
|
}
|
||||||
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
|
|
||||||
'(\\#[-a-z\\d_]*)?$',
|
|
||||||
'i',
|
|
||||||
); // fragment locator
|
|
||||||
return pattern.test(input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isImageURL(input) {
|
isImageURL(input) {
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم