From c8a1e5931065324025e94cd04ff8d28ef4e3ab94 Mon Sep 17 00:00:00 2001 From: thsrite Date: Tue, 23 Apr 2024 16:16:39 +0800 Subject: [PATCH 1/2] fix plugin 403 msg --- app/helper/plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/helper/plugin.py b/app/helper/plugin.py index 4bcc2c92..848f4d31 100644 --- a/app/helper/plugin.py +++ b/app/helper/plugin.py @@ -135,7 +135,8 @@ class PluginHelper(metaclass=Singleton): if r is None: return None, "连接仓库失败" elif r.status_code != 200: - return None, f"连接仓库失败:{r.status_code} - {r.reason}" + return None, f"连接仓库失败:{r.status_code} - " \ + f"{'超出速率限制,请配置GITHUB_TOKEN环境变量或稍后重试' if r.status_code == 403 else r.reason}" ret = r.json() if ret and ret[0].get("message") == "Not Found": return None, "插件在仓库中不存在" From 228b1a11d0b746a4273774835eaacdce0dcac659 Mon Sep 17 00:00:00 2001 From: thsrite Date: Tue, 23 Apr 2024 16:18:30 +0800 Subject: [PATCH 2/2] fix --- app/helper/plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/helper/plugin.py b/app/helper/plugin.py index 848f4d31..36fde201 100644 --- a/app/helper/plugin.py +++ b/app/helper/plugin.py @@ -156,7 +156,8 @@ class PluginHelper(metaclass=Singleton): if not res: return False, f"文件 {item.get('name')} 下载失败!" elif res.status_code != 200: - return False, f"下载文件 {item.get('name')} 失败:{res.status_code} - {res.reason}" + return False, f"下载文件 {item.get('name')} 失败:{res.status_code} - " \ + f"{'超出速率限制,请配置GITHUB_TOKEN环境变量或稍后重试' if res.status_code == 403 else res.reason}" # 创建插件文件夹 file_path = Path(settings.ROOT_PATH) / "app" / item.get("path") if not file_path.parent.exists():