浏览代码

update content rules adblocker

alqindiirsyam 5 月之前
父节点
当前提交
1de280edc8
共有 2 个文件被更改,包括 32 次插入200 次删除
  1. 16 100
      AppBuilder/AppBuilder/PrefsUtil.swift
  2. 16 100
      NexilisLite/NexilisLite/Source/View/BNIView/BNIBookingWebView.swift

+ 16 - 100
AppBuilder/AppBuilder/PrefsUtil.swift

@@ -131,116 +131,32 @@ class PrefsUtil {
     static let contentRulesAds = """
     [
         {
-            "trigger": {
-                "url-filter": ".*ads.*"
+            "trigger": { 
+                "url-filter": ".*(ads|adserver|advert|doubleclick|popads|popcash|onclickads|adfly|shorte).*", 
+                "resource-type": ["script", "image", "stylesheet", "document", "subdocument", "media"]
             },
-            "action": {
-                "type": "block"
-            }
-        },
-        {
-            "trigger": {
-                "url-filter": ".*doubleclick.*"
-            },
-            "action": {
-                "type": "block"
-            }
-        },
-        {
-            "trigger": {
-                "url-filter": ".*popads.*"
-            },
-            "action": {
-                "type": "block"
-            }
-        },
-        {
-            "trigger": {
-                "url-filter": ".*popcash.*"
-            },
-            "action": {
-                "type": "block"
-            }
-        },
-        {
-            "trigger": {
-                "url-filter": ".*onclickads.*"
-            },
-            "action": {
-                "type": "block"
-            }
-        },
-        {
-            "trigger": {
-                "url-filter": ".*adfly.*"
-            },
-            "action": {
-                "type": "block"
-            }
-        },
-        {
-            "trigger": {
-                "url-filter": ".*shorte.*"
-            },
-            "action": {
-                "type": "block"
-            }
-        },
-        {
-            "trigger": {
-                "url-filter": ".*taboola.*"
-            },
-            "action": {
-                "type": "block"
-            }
-        },
-        {
-            "trigger": {
-                "url-filter": ".*outbrain.*"
-            },
-            "action": {
-                "type": "block"
-            }
+            "action": { "type": "block" }
         },
         {
-            "trigger": {
-                "url-filter": ".*scorecardresearch.*"
+            "trigger": { 
+                "url-filter": ".*(taboola|outbrain|scorecardresearch|googlesyndication|tracking|track|pixel).*", 
+                "resource-type": ["script", "iframe", "xmlhttprequest"]
             },
-            "action": {
-                "type": "block"
-            }
-        },
-        {
-            "trigger": {
-                "url-filter": ".*google-analytics.*"
-            },
-            "action": {
-                "type": "block"
-            }
+            "action": { "type": "block" }
         },
         {
-            "trigger": {
-                "url-filter": ".*facebook.com/tr.*"
+            "trigger": { 
+                "url-filter": ".*(google-analytics|facebook.com/tr|analytics|gtag|data-collect|collect).*", 
+                "resource-type": ["script", "xmlhttprequest"]
             },
-            "action": {
-                "type": "block"
-            }
+            "action": { "type": "block" }
         },
         {
-            "trigger": {
-                "url-filter": ".*pixel.*"
+            "trigger": { 
+                "url-filter": ".*(banner|sponsored|clicktrack|beacon|stats|metrics).*", 
+                "resource-type": ["script", "image", "iframe"]
             },
-            "action": {
-                "type": "block"
-            }
-        },
-        {
-            "trigger": {
-                "url-filter": ".*analytics.*"
-            },
-            "action": {
-                "type": "block"
-            }
+            "action": { "type": "block" }
         }
     ]
     """

+ 16 - 100
NexilisLite/NexilisLite/Source/View/BNIView/BNIBookingWebView.swift

@@ -176,116 +176,32 @@ public class BNIBookingWebView: UIViewController, WKNavigationDelegate, UIScroll
         let contentRules = """
         [
             {
-                "trigger": {
-                    "url-filter": ".*ads.*"
+                "trigger": { 
+                    "url-filter": ".*(ads|adserver|advert|doubleclick|popads|popcash|onclickads|adfly|shorte).*", 
+                    "resource-type": ["script", "image", "stylesheet", "document", "subdocument", "media"]
                 },
-                "action": {
-                    "type": "block"
-                }
-            },
-            {
-                "trigger": {
-                    "url-filter": ".*doubleclick.*"
-                },
-                "action": {
-                    "type": "block"
-                }
-            },
-            {
-                "trigger": {
-                    "url-filter": ".*popads.*"
-                },
-                "action": {
-                    "type": "block"
-                }
-            },
-            {
-                "trigger": {
-                    "url-filter": ".*popcash.*"
-                },
-                "action": {
-                    "type": "block"
-                }
-            },
-            {
-                "trigger": {
-                    "url-filter": ".*onclickads.*"
-                },
-                "action": {
-                    "type": "block"
-                }
-            },
-            {
-                "trigger": {
-                    "url-filter": ".*adfly.*"
-                },
-                "action": {
-                    "type": "block"
-                }
-            },
-            {
-                "trigger": {
-                    "url-filter": ".*shorte.*"
-                },
-                "action": {
-                    "type": "block"
-                }
-            },
-            {
-                "trigger": {
-                    "url-filter": ".*taboola.*"
-                },
-                "action": {
-                    "type": "block"
-                }
-            },
-            {
-                "trigger": {
-                    "url-filter": ".*outbrain.*"
-                },
-                "action": {
-                    "type": "block"
-                }
+                "action": { "type": "block" }
             },
             {
-                "trigger": {
-                    "url-filter": ".*scorecardresearch.*"
+                "trigger": { 
+                    "url-filter": ".*(taboola|outbrain|scorecardresearch|googlesyndication|tracking|track|pixel).*", 
+                    "resource-type": ["script", "iframe", "xmlhttprequest"]
                 },
-                "action": {
-                    "type": "block"
-                }
-            },
-            {
-                "trigger": {
-                    "url-filter": ".*google-analytics.*"
-                },
-                "action": {
-                    "type": "block"
-                }
+                "action": { "type": "block" }
             },
             {
-                "trigger": {
-                    "url-filter": ".*facebook.com/tr.*"
+                "trigger": { 
+                    "url-filter": ".*(google-analytics|facebook.com/tr|analytics|gtag|data-collect|collect).*", 
+                    "resource-type": ["script", "xmlhttprequest"]
                 },
-                "action": {
-                    "type": "block"
-                }
+                "action": { "type": "block" }
             },
             {
-                "trigger": {
-                    "url-filter": ".*pixel.*"
+                "trigger": { 
+                    "url-filter": ".*(banner|sponsored|clicktrack|beacon|stats|metrics).*", 
+                    "resource-type": ["script", "image", "iframe"]
                 },
-                "action": {
-                    "type": "block"
-                }
-            },
-            {
-                "trigger": {
-                    "url-filter": ".*analytics.*"
-                },
-                "action": {
-                    "type": "block"
-                }
+                "action": { "type": "block" }
             }
         ]
         """