mirror of
https://github.com/j93es/oauth-backend.git
synced 2026-06-04 03:41:52 +09:00
일부 트래커와 cdn, 여러 파일 확장자를 제외했습니다.
뭔가 Type이 이슈가 있는거 같은데 아무래도 내 IDE 설정이 빡세서 그런거 같긴 하네요.
This commit is contained in:
parent
949b156f19
commit
5edab9244c
1 changed files with 33 additions and 2 deletions
|
|
@ -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 = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue