From 18d3dda63e5d01532c112c3699e9cd50f5365cea Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Tue, 31 Oct 2017 18:43:30 +0500 Subject: [PATCH] Produce ;\n, but still take in old format --- .../pages/options/src/components/ProxyEditor.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 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 bb4db5d..83b6e78 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 @@ -161,10 +161,11 @@ export default function getProxyEditor(theState) { const splitBySemi = (proxyString) => proxyString .replace(/#.*$/mg, '') .trim() - .split(/\s*;\r?\n\s*/g) + .split(/\s*;\s*/g) + .map((s) => s.trim()) .filter((s) => s); - const joinBySemi = (strs) => strs.join(';\n') + ';\n'; + const joinBySemi = (strs) => strs.join(';\n'); const normalizeProxyString = (str) => joinBySemi(splitBySemi(str)); const PROXY_TYPE_LABEL_PAIRS = [['PROXY', 'PROXY/HTTP'],['HTTPS'],['SOCKS4'],['SOCKS5'],['SOCKS']]; @@ -225,8 +226,8 @@ export default function getProxyEditor(theState) { const crededHostname = elements.newHostname; const port = elements.newPort; - const newValue = `${that.props.proxyStringRaw}; ${type} ${crededHostname}:${port}` - .trim().replace(/(\s*;\s*)+/, '; '); + const newValue = `${that.props.proxyStringRaw};\n${type} ${crededHostname}:${port}` + .trim().replace(/(\s*;\s*)+/, ';\n'); that.props.setProxyStringRaw(true, newValue); }