fix 连不上Github可能导致无法启动的问题

This commit is contained in:
jxxghp 2024-02-10 20:38:34 +08:00
parent b75ec92368
commit e3faa388cf
2 changed files with 10 additions and 2 deletions

View File

@ -35,7 +35,11 @@ class PluginHelper(metaclass=Singleton):
res = RequestUtils(proxies=settings.PROXY, headers=settings.GITHUB_HEADERS,
timeout=10).get_res(f"{raw_url}package.json")
if res:
return json.loads(res.text)
try:
return json.loads(res.text)
except json.JSONDecodeError:
logger.error(f"插件包数据解析失败:{res.text}")
return {}
return {}
@staticmethod

View File

@ -34,7 +34,11 @@ class ResourceHelper(metaclass=Singleton):
logger.info("开始检测资源包版本...")
res = RequestUtils(proxies=settings.PROXY, headers=settings.GITHUB_HEADERS, timeout=10).get_res(self._repo)
if res:
resource_info = json.loads(res.text)
try:
resource_info = json.loads(res.text)
except json.JSONDecodeError:
logger.error("资源包仓库数据解析失败!")
return
else:
logger.warn("无法连接资源包仓库!")
return