From 8538bc6abeb7d493179528a88aa5fda07b07c1fd Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 7 Dec 2024 23:50:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B3=E9=97=AD=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=97=B6EndGame=E8=B7=A8=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/open_live.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/api/open_live.py b/api/open_live.py index 78f4eda..d35d949 100644 --- a/api/open_live.py +++ b/api/open_live.py @@ -275,6 +275,17 @@ class EndGamePublicHandler(_PublicHandlerBase): _OPEN_LIVE_URL = END_GAME_OPEN_LIVE_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): _OPEN_LIVE_URL = END_GAME_OPEN_LIVE_URL