From 5edab9244c607c34be9026e78b124f6810209213 Mon Sep 17 00:00:00 2001 From: imnyang Date: Mon, 30 Jun 2025 21:44:08 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=EC=9D=BC=EB=B6=80=20=ED=8A=B8=EB=9E=98?= =?UTF-8?q?=EC=BB=A4=EC=99=80=20cdn,=20=EC=97=AC=EB=9F=AC=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=ED=99=95=EC=9E=A5=EC=9E=90=EB=A5=BC=20=EC=A0=9C?= =?UTF-8?q?=EC=99=B8=ED=96=88=EC=8A=B5=EB=8B=88=EB=8B=A4.=20=EB=AD=94?= =?UTF-8?q?=EA=B0=80=20Type=EC=9D=B4=20=EC=9D=B4=EC=8A=88=EA=B0=80=20?= =?UTF-8?q?=EC=9E=88=EB=8A=94=EA=B1=B0=20=EA=B0=99=EC=9D=80=EB=8D=B0=20?= =?UTF-8?q?=EC=95=84=EB=AC=B4=EB=9E=98=EB=8F=84=20=EB=82=B4=20IDE=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=EC=9D=B4=20=EB=B9=A1=EC=84=B8=EC=84=9C=20?= =?UTF-8?q?=EA=B7=B8=EB=9F=B0=EA=B1=B0=20=EA=B0=99=EA=B8=B4=20=ED=95=98?= =?UTF-8?q?=EB=84=A4=EC=9A=94.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addon/init.py | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/addon/init.py b/addon/init.py index d820f92..d0910fe 100644 --- a/addon/init.py +++ b/addon/init.py @@ -29,8 +29,39 @@ class AddonBase: else: self.google_login_hint = None + def should_ignore(self, flow: http.HTTPFlow) -> bool: + """Check if the request should be ignored.""" + ignore_domains = [ + ".googleapis.com", + "android.clients.google.com", # Added missing comma here + ".adtrafficquality.google", + ".googlesyndication.com", + "cdn.jsdelivr.net", + "update.googleapis.com", + ] + # Ignore .googleapis.com domains + for domain in ignore_domains: + if domain in flow.request.pretty_host: + return True + + # Ignore static files (JS, CSS, fonts, images, etc.) + # Split on '?' to remove query parameters before checking extension + path = flow.request.path.split('?')[0].lower() + static_extensions = [ + '.js', '.css', '.woff2', '.woff', '.ttf', '.otf', '.svg', + '.png', '.jpg', '.jpeg', '.gif', '.webp', '.ico', '.bmp', + '.tiff', '.tif', '.webm', '.mp4', '.avi', '.mov', '.pdf' + ] + + if any(path.endswith(ext) for ext in static_extensions): + return True + + return False + + + async def request(self, flow: http.HTTPFlow): - if false_true_varifing_task.is_verifing_false_true(): + if false_true_varifing_task.is_verifing_false_true() or self.should_ignore(flow): return tasks = [ @@ -40,7 +71,7 @@ class AddonBase: await asyncio.gather(*tasks) async def response(self, flow: http.HTTPFlow): - if false_true_varifing_task.is_verifing_false_true(): + if false_true_varifing_task.is_verifing_false_true() or self.should_ignore(flow): return tasks = [ From 87d5b0209c655e0af55c14696cd019cadefad58a Mon Sep 17 00:00:00 2001 From: imnyang Date: Mon, 30 Jun 2025 22:03:25 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[Enhance]=20=EC=A0=95=EC=A0=81=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=ED=99=95=EC=9E=A5=EC=9E=90=20=EB=AA=A9=EB=A1=9D?= =?UTF-8?q?=EC=97=90=20'.md'=20=EB=B0=8F=20'.txt'=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addon/init.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addon/init.py b/addon/init.py index d0910fe..4ea8a18 100644 --- a/addon/init.py +++ b/addon/init.py @@ -50,7 +50,8 @@ class AddonBase: static_extensions = [ '.js', '.css', '.woff2', '.woff', '.ttf', '.otf', '.svg', '.png', '.jpg', '.jpeg', '.gif', '.webp', '.ico', '.bmp', - '.tiff', '.tif', '.webm', '.mp4', '.avi', '.mov', '.pdf' + '.tiff', '.tif', '.webm', '.mp4', '.avi', '.mov', '.pdf', '.md', + '.txt', '.csv' ] if any(path.endswith(ext) for ext in static_extensions):