[epiphany] adblock: Use EasyList in JSON as default ruleset



commit 58962d816ba7aeb76ff818ae3e9c682cbbca220e
Author: Adrian Perez de Castro <aperez igalia com>
Date:   Tue Jul 9 15:28:38 2019 +0300

    adblock: Use EasyList in JSON as default ruleset
    
    Switch from the EasyList ruleset in AdBlock Plus format (as needed
    by the old EphyURITester) to the JSON version, which can be directly
    consumed by WebKitUserContentFilterStore.
    
    Note that the EasyPrivacy ruleset is not available in JSON format,
    and therefore its URI removed from the default list of rulesets.
    
    This also renames the setting to "content-filters" in order to avoid
    mixups with the old "adblock-filters" setting.

 data/org.gnome.epiphany.gschema.xml | 8 ++++----
 embed/ephy-filters-manager.c        | 5 ++---
 lib/ephy-prefs.h                    | 2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 4cd1af720..e9fae6499 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -55,10 +55,10 @@
                         <summary>Whether to delay loading of tabs that are not immediately visible on 
session restore</summary>
                         <description>When this option is set to true, tabs will not start loading until the 
user switches to them, upon session restore.</description>
                 </key>
-                <key type="as" name="adblock-filters">
-                        <default>['https://easylist.to/easylist/easylist.txt', 
'https://easylist.to/easylist/easyprivacy.txt']</default>
+                <key type="as" name="content-filters">
+                        
<default>['https://easylist-downloads.adblockplus.org/easylist_min_content_blocker.json']</default>
                         <summary>List of adblock filters</summary>
-                        <description>List of URLs with filter rules to be used by the adblock.</description>
+                        <description>List of URLs with content filtering rules in JSON format to be used by 
the ad blocker.</description>
                 </key>
                 <key type="b" name="ask-for-default">
                         <default>true</default>
@@ -192,7 +192,7 @@
                <key type="b" name="do-not-track">
                        <default>true</default>
                        <summary>Do Not Track</summary>
-                       <description>Enables tracking query parameter removal. Note that when changing this 
setting from the preferences dialog, the adblock-filters setting will additionally be updated to add/remove 
EasyPrivacy filters.</description>
+                       <description>Enables tracking query parameter removal.</description>
                </key>
                <key type="b" name="enable-adblock">
                        <default>true</default>
diff --git a/embed/ephy-filters-manager.c b/embed/ephy-filters-manager.c
index d6c9148c7..9703c0fb4 100644
--- a/embed/ephy-filters-manager.c
+++ b/embed/ephy-filters-manager.c
@@ -771,8 +771,7 @@ update_adblock_filter_files_cb (GSettings          *settings,
                                             NULL,
                                             (GDestroyNotify)filter_info_free);
 
-  uris = g_settings_get_strv (EPHY_SETTINGS_MAIN,
-                              EPHY_PREFS_ADBLOCK_FILTERS);
+  uris = g_settings_get_strv (EPHY_SETTINGS_MAIN, EPHY_PREFS_CONTENT_FILTERS);
   for (unsigned i = 0; uris[i]; i++) {
     g_autofree char *filter_id = filter_info_identifier_for_source_uri (uris[i]);
     FilterInfo *filter_info = NULL;
@@ -866,7 +865,7 @@ ephy_filters_manager_constructed (GObject *object)
   manager->store = webkit_user_content_filter_store_new (saved_filters_dir);
 
   /* Note: up here because we must connect *before* reading the settings. */
-  g_signal_connect_object (EPHY_SETTINGS_MAIN, "changed::" EPHY_PREFS_ADBLOCK_FILTERS,
+  g_signal_connect_object (EPHY_SETTINGS_MAIN, "changed::" EPHY_PREFS_CONTENT_FILTERS,
                            G_CALLBACK (update_adblock_filter_files_cb), manager, 0);
   g_signal_connect_object (EPHY_SETTINGS_WEB, "changed::" EPHY_PREFS_WEB_ENABLE_ADBLOCK,
                            G_CALLBACK (update_adblock_filter_files_cb), manager, 0);
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index b23098051..cc2d0f776 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -169,7 +169,7 @@ static const char * const ephy_prefs_web_schema[] = {
 #define EPHY_PREFS_INTERNAL_VIEW_SOURCE               "internal-view-source"
 #define EPHY_PREFS_RESTORE_SESSION_POLICY             "restore-session-policy"
 #define EPHY_PREFS_RESTORE_SESSION_DELAYING_LOADS     "restore-session-delaying-loads"
-#define EPHY_PREFS_ADBLOCK_FILTERS                    "adblock-filters"
+#define EPHY_PREFS_CONTENT_FILTERS                    "content-filters"
 #define EPHY_PREFS_SEARCH_ENGINES                     "search-engines"
 #define EPHY_PREFS_DEFAULT_SEARCH_ENGINE              "default-search-engine"
 #define EPHY_PREFS_ASK_FOR_DEFAULT                    "ask-for-default"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]