Skip to content

Commit

Permalink
fix 连不上Github可能导致无法启动的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
jxxghp committed Feb 10, 2024
1 parent b75ec92 commit e3faa38
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/helper/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ def get_plugins(self, repo_url: str) -> Dict[str, dict]:
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
Expand Down
6 changes: 5 additions & 1 deletion app/helper/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ def check(self):
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
Expand Down

0 comments on commit e3faa38

Please sign in to comment.