feat: Optimise profile image
All checks were successful
Build Docker / BuildImage (push) Successful in 55s

This commit is contained in:
2025-10-26 22:24:28 +11:00
parent d4d6b47225
commit 4ae6f7bb99
4 changed files with 20 additions and 5 deletions

View File

@@ -12,6 +12,21 @@ HTTP_OK = 200
HTTP_BAD_REQUEST = 400
HTTP_NOT_FOUND = 404
CRAWLERS = [
"Googlebot",
"Bingbot",
"Chrome-Lighthouse",
"Slurp",
"DuckDuckBot",
"Baiduspider",
"YandexBot",
"Sogou",
"Exabot",
"facebot",
"ia_archiver",
"Twitterbot"
]
def getClientIP(request: Request) -> str:
"""
@@ -88,7 +103,7 @@ def isCrawler(request: Request) -> bool:
"""
if request.headers and request.headers.get("User-Agent"):
user_agent = request.headers.get("User-Agent", "")
return "Googlebot" in user_agent or "Bingbot" in user_agent
return any(crawler in user_agent for crawler in CRAWLERS)
return False
@cache