Index: lib/subscriptionInit.js |
=================================================================== |
--- a/lib/subscriptionInit.js |
+++ b/lib/subscriptionInit.js |
@@ -53,28 +53,28 @@ |
if (firstRun && (!FilterStorage.firstRun || Prefs.currentVersion)) |
reinitialized = true; |
Prefs.currentVersion = info.addonVersion; |
} |
/** |
- * Determines whether to add the default ad blocking subscription. |
+ * Determines whether to add the default ad blocking subscriptions. |
* Returns true, if there are no filter subscriptions besides those |
* other subscriptions added automatically, and no custom filters. |
* |
* On first run, this logic should always result in true since there |
* is no data and therefore no subscriptions. But it also causes the |
- * default ad blocking subscription to be added again after some |
+ * default ad blocking subscriptions to be added again after some |
* data corruption or misconfiguration. |
* |
* @return {boolean} |
*/ |
-function shouldAddDefaultSubscription() |
+function shouldAddDefaultSubscriptions() |
{ |
for (let subscription of FilterStorage.subscriptions) |
{ |
if (subscription instanceof DownloadableSubscription && |
subscription.url != Prefs.subscriptions_exceptionsurl && |
subscription.url != Prefs.subscriptions_antiadblockurl) |
return false; |
@@ -205,18 +205,19 @@ |
let antiAdblockSubscription = Subscription.fromURL( |
Prefs.subscriptions_antiadblockurl |
); |
antiAdblockSubscription.disabled = true; |
subscriptions.push(antiAdblockSubscription); |
} |
} |
- // Add default ad blocking subscription (e.g. EasyList) |
- if (shouldAddDefaultSubscription()) |
+ // Add default ad blocking subscriptions (e.g. EasyList, Anti-Circumvention) |
+ let addDefaultSubscription = shouldAddDefaultSubscriptions(); |
+ if (addDefaultSubscription || !Prefs.subscriptions_checkedanticv) |
{ |
return fetch("subscriptions.xml") |
.then(response => response.text()) |
.then(text => |
{ |
let doc = new DOMParser().parseFromString(text, "application/xml"); |
let nodes = doc.getElementsByTagName("subscription"); |
@@ -227,22 +228,30 @@ |
{ |
let node = defaultSubscriptions[name]; |
if (!node) |
continue; |
let url = node.getAttribute("url"); |
if (url) |
{ |
+ // Make sure that we don't add Easylist again if we want |
+ // to just add the Anti-Circumvention subscription. |
+ let type = node.getAttribute("type"); |
+ if (!addDefaultSubscription && type != "circumvention") |
+ continue; |
+ |
let subscription = Subscription.fromURL(url); |
subscription.disabled = false; |
subscription.title = node.getAttribute("title"); |
subscription.homepage = node.getAttribute("homepage"); |
- subscription.type = node.getAttribute("type"); |
+ subscription.type = type; |
subscriptions.push(subscription); |
+ if (subscription.type == "circumvention") |
+ Prefs.subscriptions_checkedanticv = true; |
kzar
2018/07/16 16:37:47
Nit: Maybe "added" instead of "checked" in the pre
hub
2018/07/16 19:07:35
I use "checked" because the code checked it and to
kzar
2018/07/17 10:32:32
Up to you.
hub
2018/07/17 14:29:28
Changed it.
|
} |
} |
} |
return subscriptions; |
}); |
} |