mirror of https://github.com/gorhill/uBlock.git
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(),
|
||||
version: vAPI.app.version,
|
||||
userSettings: µb.userSettings,
|
||||
filterLists: µb.remoteBlacklists,
|
||||
filterLists: µb.extractSelectedFilterLists(),
|
||||
netWhitelist: µb.stringFromWhitelist(µb.netWhitelist),
|
||||
dynamicFilteringString: µb.permanentFirewall.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) {
|
||||
return this.assets.put(this.userFiltersPath, content, callback);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue