mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-10 19:46:34 +03:00
Fix bug with tmlp format, do raw migrate
This commit is contained in:
parent
c9c7b15d9b
commit
41913e7dad
|
@ -161,13 +161,13 @@
|
|||
|
||||
};
|
||||
|
||||
const getCurrentConfigs = function getCurrentConfigs() {
|
||||
const getCurrentConfigs = function getCurrentConfigs(ifRaw = false) {
|
||||
|
||||
const oldMods = kitchenState(modsKey);
|
||||
/*if (oldMods) {
|
||||
if (ifRaw) {
|
||||
// No migration!
|
||||
return oldMods;
|
||||
}*/
|
||||
}
|
||||
|
||||
// Client may expect mods.included and mods.excluded!
|
||||
// On first install they are not defined.
|
||||
|
@ -228,7 +228,7 @@
|
|||
if (self.customProxyStringRaw) {
|
||||
customProxyArray = self.customProxyStringRaw
|
||||
.replace(/#.*$/mg, '') // Strip comments.
|
||||
.split( /(?:[^\S\r\n]*(?:;|\r?\n)+[^\S\r\n]*)+/g ) // Split by (<other whitespace>*<semi-colon or newline>+<other whitespace>*)+
|
||||
.split( /(?:\s*(?:;\r?\n)+\s*)+/g )
|
||||
.map( (p) => p.trim() )
|
||||
.filter( (p) => p && /\s+/g.test(p) ); // At least one space is required.
|
||||
if (self.ifUseSecureProxiesOnly) {
|
||||
|
@ -294,6 +294,7 @@
|
|||
window.apis.pacKitchen = {
|
||||
|
||||
getPacMods: getCurrentConfigs,
|
||||
getPacModsRaw: () => getCurrentConfigs(true),
|
||||
getOrderedConfigs: getOrderedConfigsForUser,
|
||||
|
||||
cook(pacData, pacMods = mandatory()) {
|
||||
|
|
|
@ -524,24 +524,27 @@
|
|||
}
|
||||
|
||||
// UPDATE & MIGRATION
|
||||
console.log('Updating from', oldStorage.version, 'to', antiCensorRu.version);
|
||||
if (window.apis.version.isLeq(oldStorage.version, '0.0.1.5')) {
|
||||
|
||||
// Change semicolons to semicolons followed by newlines in proxy string (raw).
|
||||
const migrateProxies = (oldStr) => oldStr.replace(/;\r?\n?/g, ';\n');
|
||||
const modsMutated = window.apis.pacKitchen.getPacMods();
|
||||
modsMutated['customProxyStringRaw'] = migrateProxies(conf.value);
|
||||
window.apis.pacKitchen.keepCookedNowAsync(modsMutated, cb);
|
||||
|
||||
}
|
||||
|
||||
antiCensorRu.pushToStorageAsync(() => {
|
||||
const ifUpdatedCb = () => antiCensorRu.pushToStorageAsync(() => {
|
||||
|
||||
console.log('Extension updated.');
|
||||
resolve();
|
||||
|
||||
});
|
||||
|
||||
console.log('Updating from', oldStorage.version, 'to', antiCensorRu.version);
|
||||
if (window.apis.version.isLeq(oldStorage.version, '0.0.1.5')) {
|
||||
|
||||
// Change semicolons to semicolons followed by newlines in proxy string (raw).
|
||||
const migrateProxies = (oldStr) => oldStr.replace(/;\\r?\\n?/g, ';\\n');
|
||||
const modsMutated = window.apis.pacKitchen.getPacModsRaw();
|
||||
modsMutated['customProxyStringRaw'] = migrateProxies(conf.value);
|
||||
window.apis.pacKitchen.keepCookedNowAsync(modsMutated, ifUpdatedCb);
|
||||
|
||||
} else {
|
||||
ifUpdatedCb();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (antiCensorRu.getPacProvider()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user