Also allow hyphens in proxy username/password
This commit is contained in:
parent
873ba0ab09
commit
00cf3ca644
1 changed files with 8 additions and 5 deletions
|
@ -3,7 +3,7 @@ proxifiedContainers = {
|
||||||
|
|
||||||
async retrieveAll() {
|
async retrieveAll() {
|
||||||
const result = await browser.storage.local.get("proxifiedContainersKey");
|
const result = await browser.storage.local.get("proxifiedContainersKey");
|
||||||
if(!result || !result["proxifiedContainersKey"]) {
|
if (!result || !result["proxifiedContainersKey"]) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ proxifiedContainers = {
|
||||||
|
|
||||||
async retrieve(cookieStoreId) {
|
async retrieve(cookieStoreId) {
|
||||||
const result = await this.retrieveAll();
|
const result = await this.retrieveAll();
|
||||||
if(!result) {
|
if (!result) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ proxifiedContainers = {
|
||||||
|
|
||||||
// Parses a proxy description string of the format type://host[:port] or type://username:password@host[:port] (port is optional)
|
// Parses a proxy description string of the format type://host[:port] or type://username:password@host[:port] (port is optional)
|
||||||
parseProxy(proxy_str, mozillaVpnData = null) {
|
parseProxy(proxy_str, mozillaVpnData = null) {
|
||||||
const proxyRegexp = /(?<type>(https?)|(socks4?)):\/\/(\b(?<username>\w+):(?<password>\w+)@)?(?<host>((?:\d{1,3}\.){3}\d{1,3}\b)|(\b([\w.-]+)+))(:(?<port>\d+))?/;
|
const proxyRegexp = /(?<type>(https?)|(socks4?)):\/\/(\b(?<username>[\w.-]+):(?<password>[\w.-]+)@)?(?<host>((?:\d{1,3}\.){3}\d{1,3}\b)|(\b([\w.-]+)+))(:(?<port>\d+))?/;
|
||||||
const matches = proxyRegexp.exec(proxy_str);
|
const matches = proxyRegexp.exec(proxy_str);
|
||||||
if (!matches) {
|
if (!matches) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -58,7 +58,10 @@ proxifiedContainers = {
|
||||||
mozillaVpnData = MozillaVPN.getMozillaProxyInfoObj();
|
mozillaVpnData = MozillaVPN.getMozillaProxyInfoObj();
|
||||||
}
|
}
|
||||||
|
|
||||||
return {...matches.groups,...mozillaVpnData};
|
return {
|
||||||
|
...matches.groups,
|
||||||
|
...mozillaVpnData
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
// Deletes the proxy information object for a specified cookieStoreId [useful for cleaning]
|
// Deletes the proxy information object for a specified cookieStoreId [useful for cleaning]
|
||||||
|
@ -73,4 +76,4 @@ proxifiedContainers = {
|
||||||
proxifiedContainersKey: proxifiedContainersStore
|
proxifiedContainersKey: proxifiedContainersStore
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
Loading…
Add table
Reference in a new issue