From e3d3087a5d1bd0f05528f20b23712a65abe396b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=AF=E5=A4=A7=E4=BE=A0?= Date: Fri, 13 Jun 2025 18:06:17 +0800 Subject: [PATCH] =?UTF-8?q?fix=20GitHub=E8=AF=B7=E6=B1=82=E5=A4=B4?= =?UTF-8?q?=E8=A1=A5=E4=B8=8AUA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 142a52d2..118bbee8 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -139,6 +139,7 @@ class ConfigModel(BaseModel): "api.github.com," "github.com," "raw.githubusercontent.com," + "codeload.github.com," "api.telegram.org") # DOH 解析服务器列表 DOH_RESOLVERS: str = "1.0.0.1,1.1.1.1,9.9.9.9,149.112.112.112" @@ -584,7 +585,8 @@ class Settings(BaseSettings, ConfigModel, LogConfigModel): """ if self.GITHUB_TOKEN: return { - "Authorization": f"Bearer {self.GITHUB_TOKEN}" + "Authorization": f"Bearer {self.GITHUB_TOKEN}", + "User-Agent": self.USER_AGENT, } return {} @@ -612,7 +614,8 @@ class Settings(BaseSettings, ConfigModel, LogConfigModel): print(f"无效的令牌或仓库信息: {token_pair}") continue headers[repo_info] = { - "Authorization": f"Bearer {token}" + "Authorization": f"Bearer {token}", + "User-Agent": self.USER_AGENT, } except Exception as e: print(f"处理令牌对 '{token_pair}' 时出错: {e}")