🐛 fix(plugin-store): 优先获取commit号在进行插件下载 (#1853)

* 🐛  fix(plugin-store): 优先获取commit号在进行插件下载

* ✅  perf(github-utils): 使用sourcery建议,封装更新commit方法
This commit is contained in:
AkashiCoin
2025-02-18 15:32:26 +08:00
committed by GitHub
parent aef2597b46
commit 0e5a79ce2c
11 changed files with 485 additions and 25 deletions
@@ -80,12 +80,17 @@ class ShopManage:
返回:
dict: 插件信息数据
"""
default_github_url = await GithubUtils.parse_github_url(
DEFAULT_GITHUB_URL
).get_raw_download_urls("plugins.json")
extra_github_url = await GithubUtils.parse_github_url(
EXTRA_GITHUB_URL
).get_raw_download_urls("plugins.json")
default_github_repo = GithubUtils.parse_github_url(DEFAULT_GITHUB_URL)
extra_github_repo = GithubUtils.parse_github_url(EXTRA_GITHUB_URL)
for repo_info in [default_github_repo, extra_github_repo]:
if await repo_info.update_repo_commit():
logger.info(f"获取最新提交: {repo_info.branch}", "插件管理")
else:
logger.warning(f"获取最新提交失败: {repo_info}", "插件管理")
default_github_url = await default_github_repo.get_raw_download_urls(
"plugins.json"
)
extra_github_url = await extra_github_repo.get_raw_download_urls("plugins.json")
res = await AsyncHttpx.get(default_github_url)
res2 = await AsyncHttpx.get(extra_github_url)
@@ -218,6 +223,10 @@ class ShopManage:
files: list[str]
repo_api: RepoAPI
repo_info = GithubUtils.parse_github_url(github_url)
if await repo_info.update_repo_commit():
logger.info(f"获取最新提交: {repo_info.branch}", "插件管理")
else:
logger.warning(f"获取最新提交失败: {repo_info}", "插件管理")
logger.debug(f"成功获取仓库信息: {repo_info}", "插件管理")
for repo_api in GithubUtils.iter_api_strategies():
try: