Define migration replacement

This commit is contained in:
Ilya Ig. Petrov 2017-10-31 17:51:15 +05:00
parent 15e95d6e07
commit c9c7b15d9b
2 changed files with 5 additions and 5 deletions

View File

@ -527,10 +527,10 @@
console.log('Updating from', oldStorage.version, 'to', antiCensorRu.version); console.log('Updating from', oldStorage.version, 'to', antiCensorRu.version);
if (window.apis.version.isLeq(oldStorage.version, '0.0.1.5')) { if (window.apis.version.isLeq(oldStorage.version, '0.0.1.5')) {
// Change semicolons to newlines in proxy string (raw). // Change semicolons to semicolons followed by newlines in proxy string (raw).
// TODO: const migrateProxies = (oldStr) => oldStr.replace(/;\r?\n?/g, ';\n');
const modsMutated = window.apis.pacKitchen.getPacMods(); const modsMutated = window.apis.pacKitchen.getPacMods();
modsMutated['customProxyStringRaw'] = MIGRATE(conf.value); modsMutated['customProxyStringRaw'] = migrateProxies(conf.value);
window.apis.pacKitchen.keepCookedNowAsync(modsMutated, cb); window.apis.pacKitchen.keepCookedNowAsync(modsMutated, cb);
} }

View File

@ -161,10 +161,10 @@ export default function getProxyEditor(theState) {
const splitBySemi = (proxyString) => proxyString const splitBySemi = (proxyString) => proxyString
.replace(/#.*$/mg, '') .replace(/#.*$/mg, '')
.trim() .trim()
.split(/\s*;\s*/g) .split(/\s*;\r?\n\s*/g)
.filter((s) => s); .filter((s) => s);
const joinBySemi = (strs) => strs.join(';\n') + ';'; const joinBySemi = (strs) => strs.join(';\n') + ';\n';
const normalizeProxyString = (str) => joinBySemi(splitBySemi(str)); const normalizeProxyString = (str) => joinBySemi(splitBySemi(str));
const PROXY_TYPE_LABEL_PAIRS = [['PROXY', 'PROXY/HTTP'],['HTTPS'],['SOCKS4'],['SOCKS5'],['SOCKS']]; const PROXY_TYPE_LABEL_PAIRS = [['PROXY', 'PROXY/HTTP'],['HTTPS'],['SOCKS4'],['SOCKS5'],['SOCKS']];