aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/js/messaging.js2
-rw-r--r--src/js/storage.js20
2 files changed, 21 insertions, 1 deletions
diff --git a/src/js/messaging.js b/src/js/messaging.js
index 05b9ce9..98fd353 100644
--- a/src/js/messaging.js
+++ b/src/js/messaging.js
@@ -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(),
diff --git a/src/js/storage.js b/src/js/storage.js
index 8854fe9..66ec143 100644
--- a/src/js/storage.js
+++ b/src/js/storage.js
@@ -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);
};