feat: Modify the dialogue apikey generation rules (#4583)

This commit is contained in:
shaohuzhang1 2025-12-30 11:35:48 +08:00 committed by GitHub
parent 9586c1b6de
commit 36bbacf518
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,7 +25,9 @@ class CrossDomainMiddleware(MiddlewareMixin):
def process_response(self, request, response):
auth = request.META.get('HTTP_AUTHORIZATION')
origin = request.META.get('HTTP_ORIGIN')
if auth is not None and str(auth).startswith("Bearer application-") and origin is not None:
if auth is not None and any([str(auth).startswith(prefix) for prefix in
['Bearer application-', 'Bearer agent-']]) and origin is not None:
application_api_key = get_application_api_key(str(auth), True)
cross_domain_list = application_api_key.get('cross_domain_list', [])
allow_cross_domain = application_api_key.get('allow_cross_domain', False)