Merge pull request #21 from j93es/feat/ignore

일부 트래커와 cdn, 여러 파일 확장자를 제외했습니다.
This commit is contained in:
James 2025-07-01 21:42:24 +09:00 committed by GitHub
commit 4758d7a689
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,8 +29,40 @@ 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', '.md',
'.txt', '.csv'
]
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 +72,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 = [