mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-23 18:03:44 +03:00
Handle empty username case
This commit is contained in:
parent
8f1ce3b6ea
commit
9b35c413cc
|
@ -268,7 +268,7 @@
|
|||
proxyHostToCredsList[`${hostname}:${port}`] || [];
|
||||
const tries = proxyHostToCredsList[`${hostname}:${port}`];
|
||||
tries.push({
|
||||
username,
|
||||
username: username || '',
|
||||
password: password || '',
|
||||
});
|
||||
|
||||
|
|
|
@ -408,6 +408,8 @@ export default function getProxyEditor(theState) {
|
|||
creds,
|
||||
hostname,
|
||||
port,
|
||||
username,
|
||||
password,
|
||||
} = theState.utils.parseProxyScheme(proxyAsString);
|
||||
const crededAddr = `${creds ? `${creds}@` : ''}${hostname}:${port}`;
|
||||
|
||||
|
@ -417,11 +419,14 @@ export default function getProxyEditor(theState) {
|
|||
`Неверный тип ${type}. Известные типы: ${knownTypes.join(', ')}.`
|
||||
);
|
||||
}
|
||||
if (!(crededAddr && /^(?:[^@]+@)?[^:]+:\d+$/.test(crededAddr))) {
|
||||
if (!(crededAddr && /^(?:.+@)?[^:]+:\d+$/.test(crededAddr))) {
|
||||
return new Error(
|
||||
`Адрес прокси "${crededAddr || ''}" не соответствует формату "<опц_логин>:<опц_пароль>@<домен_или_IP>:<порт_из_цифр>".`
|
||||
);
|
||||
}
|
||||
if (password && !username) {
|
||||
return new Error('Вашему пользователю не хватает имени?');
|
||||
}
|
||||
const portInt = parseInt(port);
|
||||
if (portInt < 0 || portInt > 65535) {
|
||||
return new Error(
|
||||
|
|
Loading…
Reference in New Issue
Block a user