Update __init__.py

This commit is contained in:
H Lohaus 2025-10-30 16:46:36 +01:00 committed by GitHub
parent a9950deb39
commit 7c8cf45631
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -267,6 +267,13 @@ class Api:
return ErrorResponse.from_message("G4F API key expired", HTTP_401_UNAUTHORIZED)
else:
user = "admin"
count = 0
for char in string:
if char.isupper():
count += 1
if count > 5:
return ErrorResponse.from_message("Invalid user name", HTTP_401_UNAUTHORIZED)
path = request.url.path
if path.startswith("/v1") or path.startswith("/api/") or (AppConfig.demo and path == '/backend-api/v2/upload_cookies'):
if request.method != "OPTIONS" and not path.endswith("/models"):