From 7ac474a5e7ad12998f9070cfdcbe044803192f23 Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Tue, 17 Oct 2017 21:35:01 +0500 Subject: [PATCH] Parse credentialized (creded) proxies --- .../options/src/components/ProxyEditor.js | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ProxyEditor.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ProxyEditor.js index 85c31da..91661b3 100644 --- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ProxyEditor.js +++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ProxyEditor.js @@ -64,7 +64,7 @@ export default function getProxyEditor(theState) { { text-align: center; } - table.editor tr.proxyRow input[name="hostname"] { + table.editor tr.proxyRow input[name="crededHostname"] { padding: 0; } @@ -217,10 +217,10 @@ export default function getProxyEditor(theState) { }, {}); const type = that.state.selectedNewType; - const hostname = elements.newHostname; + const crededHostname = elements.newHostname; const port = elements.newPort; - const newValue = `${that.props.proxyStringRaw}; ${type} ${hostname}:${port}` + const newValue = `${that.props.proxyStringRaw}; ${type} ${crededHostname}:${port}` .trim().replace(/(\s*;\s*)+/, '; '); that.props.setProxyStringRaw(true, newValue); @@ -324,7 +324,12 @@ export default function getProxyEditor(theState) { { splitBySemi(this.props.proxyStringRaw).map((proxyAsString, index) => { - const [type, addr] = proxyAsString.trim().split(/\s+/); + const [type, crededAddr] = proxyAsString.trim().split(/\s+/); + let [creds, addr] = crededAddr.split('@'); + if (!addr) { + addr = creds; + creds = ''; + } const [hostname, port] = addr.split(':'); return ( @@ -335,7 +340,7 @@ export default function getProxyEditor(theState) { >X {type} - + {port}