Reject empty own proxies

This commit is contained in:
Ilya Ig. Petrov 2017-03-05 13:21:35 +00:00
parent 182a443cc4
commit 0bb3d57b26

View File

@ -581,16 +581,16 @@ HTTPS 11.22.33.44:8080;">${conf.value || localStorage.getItem(uiRaw) || ''}</tex
const taVal = liPs.querySelector('textarea').value;
if (oldMods[customProxyStringKey] !== false) {
const ifValid = taVal
const ifValidArr = taVal
.replace(/#.*$/mg)
.split(/\s*[;\n\r]+\s*/g)
.filter( (str) => str )
.every(
.filter( (str) => str );
const ifValid = ifValidArr.every(
(str) =>
/^(?:DIRECT|(?:(?:HTTPS?|PROXY|SOCKS(?:4|5)?)\s+\S+))$/g
.test(str)
);
if (!ifValid) {
if (!(ifValidArr.length && ifValid)) {
return showErrors(new TypeError(
'Неверный формат своих прокси. Свертесь с <a href="https://rebrand.ly/ac-own-proxy" data-in-bg="true">документацией</a>.'
));