From 00cf3ca64419bb428985f3e2b66a5300bd546782 Mon Sep 17 00:00:00 2001 From: Rodney Cullen <782506+rodcul@users.noreply.github.com> Date: Mon, 9 May 2022 13:39:46 +0100 Subject: [PATCH] Also allow hyphens in proxy username/password --- src/js/proxified-containers.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/js/proxified-containers.js b/src/js/proxified-containers.js index 241c86b..c1d8314 100644 --- a/src/js/proxified-containers.js +++ b/src/js/proxified-containers.js @@ -3,7 +3,7 @@ proxifiedContainers = { async retrieveAll() { const result = await browser.storage.local.get("proxifiedContainersKey"); - if(!result || !result["proxifiedContainersKey"]) { + if (!result || !result["proxifiedContainersKey"]) { return null; } @@ -12,7 +12,7 @@ proxifiedContainers = { async retrieve(cookieStoreId) { const result = await this.retrieveAll(); - if(!result) { + if (!result) { 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) parseProxy(proxy_str, mozillaVpnData = null) { - const proxyRegexp = /(?(https?)|(socks4?)):\/\/(\b(?\w+):(?\w+)@)?(?((?:\d{1,3}\.){3}\d{1,3}\b)|(\b([\w.-]+)+))(:(?\d+))?/; + const proxyRegexp = /(?(https?)|(socks4?)):\/\/(\b(?[\w.-]+):(?[\w.-]+)@)?(?((?:\d{1,3}\.){3}\d{1,3}\b)|(\b([\w.-]+)+))(:(?\d+))?/; const matches = proxyRegexp.exec(proxy_str); if (!matches) { return false; @@ -58,7 +58,10 @@ proxifiedContainers = { mozillaVpnData = MozillaVPN.getMozillaProxyInfoObj(); } - return {...matches.groups,...mozillaVpnData}; + return { + ...matches.groups, + ...mozillaVpnData + }; }, // Deletes the proxy information object for a specified cookieStoreId [useful for cleaning] @@ -73,4 +76,4 @@ proxifiedContainers = { proxifiedContainersKey: proxifiedContainersStore }); } -}; +}; \ No newline at end of file