mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
do not include unused entries in backup
This commit is contained in:
parent
d23b4e5a4f
commit
53d96cc88f
@ -980,7 +980,7 @@ var backupUserData = function(callback) {
|
|||||||
timeStamp: Date.now(),
|
timeStamp: Date.now(),
|
||||||
version: vAPI.app.version,
|
version: vAPI.app.version,
|
||||||
userSettings: µb.userSettings,
|
userSettings: µb.userSettings,
|
||||||
filterLists: µb.remoteBlacklists,
|
filterLists: µb.extractSelectedFilterLists(),
|
||||||
netWhitelist: µb.stringFromWhitelist(µb.netWhitelist),
|
netWhitelist: µb.stringFromWhitelist(µb.netWhitelist),
|
||||||
dynamicFilteringString: µb.permanentFirewall.toString(),
|
dynamicFilteringString: µb.permanentFirewall.toString(),
|
||||||
hostnameSwitchesString: µb.hnSwitches.toString(),
|
hostnameSwitchesString: µb.hnSwitches.toString(),
|
||||||
|
@ -91,6 +91,26 @@
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
// This will remove all unused filter list entries from
|
||||||
|
// µBlock.remoteBlacklists`. This helps reduce the size of backup files.
|
||||||
|
|
||||||
|
µBlock.extractSelectedFilterLists = function() {
|
||||||
|
var r = JSON.parse(JSON.stringify(this.remoteBlacklists));
|
||||||
|
|
||||||
|
for ( var path in r ) {
|
||||||
|
if ( r.hasOwnProperty(path) === false ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( r[path].off !== false ) {
|
||||||
|
delete r[path];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
};
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
µBlock.saveUserFilters = function(content, callback) {
|
µBlock.saveUserFilters = function(content, callback) {
|
||||||
return this.assets.put(this.userFiltersPath, content, callback);
|
return this.assets.put(this.userFiltersPath, content, callback);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user