修复关闭页面时EndGame跨域

This commit is contained in:
John Smith 2024-12-07 23:50:35 +08:00
parent b73608af79
commit 8538bc6abe

View File

@ -275,6 +275,17 @@ class EndGamePublicHandler(_PublicHandlerBase):
_OPEN_LIVE_URL = END_GAME_OPEN_LIVE_URL _OPEN_LIVE_URL = END_GAME_OPEN_LIVE_URL
_COMMON_SERVER_URL = END_GAME_COMMON_SERVER_URL _COMMON_SERVER_URL = END_GAME_COMMON_SERVER_URL
def set_default_headers(self):
super().set_default_headers()
if self._headers.get('Access-Control-Allow-Origin', None) is None:
return
# 前端sendBeacon跨域发送JSON时会带凭证
self.set_header('Access-Control-Allow-Credentials', 'true')
self.set_header('Access-Control-Allow-Methods', 'POST')
self.set_header('Access-Control-Allow-Headers', 'Content-Type')
class EndGamePrivateHandler(_PrivateHandlerBase): class EndGamePrivateHandler(_PrivateHandlerBase):
_OPEN_LIVE_URL = END_GAME_OPEN_LIVE_URL _OPEN_LIVE_URL = END_GAME_OPEN_LIVE_URL