fix regexp server validation (#140)
This commit is contained in:
parent
c6c551360b
commit
1ff125a477
|
@ -42,7 +42,7 @@ const RocketChat = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async testServer(url) {
|
async testServer(url) {
|
||||||
if (/^(https?:\/\/)?(((\w|[0-9])+(\.(\w|[0-9-_])+)+)|localhost)(:\d+)?$/.test(url)) {
|
if (/^(https?:\/\/)?(((\w|[0-9-_])+(\.(\w|[0-9-_])+)+)|localhost)(:\d+)?$/.test(url)) {
|
||||||
const response = await fetch(url, { method: 'HEAD' });
|
const response = await fetch(url, { method: 'HEAD' });
|
||||||
if (response.status === 200 && response.headers.get('x-instance-id') != null && response.headers.get('x-instance-id').length) {
|
if (response.status === 200 && response.headers.get('x-instance-id') != null && response.headers.get('x-instance-id').length) {
|
||||||
return url;
|
return url;
|
||||||
|
|
Loading…
Reference in New Issue