Skip to content

Commit

Permalink
fix plugin get_state
Browse files Browse the repository at this point in the history
  • Loading branch information
jxxghp committed Nov 5, 2023
1 parent cef06a8 commit 89a4932
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/core/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,12 @@ def get_online_plugins(self) -> List[dict]:
conf.update({"has_update": True})
# 运行状态
if plugin_obj and hasattr(plugin_obj, "get_state"):
conf.update({"state": plugin_obj.get_state()})
try:
state = plugin_obj.get_state()
except Exception as e:
logger.error(f"获取插件 {pid} 状态出错:{str(e)}")
state = False
conf.update({"state": state})
else:
conf.update({"state": False})
# 是否有详情页面
Expand Down Expand Up @@ -293,7 +298,12 @@ def get_local_plugins(self) -> List[dict]:
conf.update({"installed": False})
# 运行状态
if plugin_obj and hasattr(plugin_obj, "get_state"):
conf.update({"state": plugin_obj.get_state()})
try:
state = plugin_obj.get_state()
except Exception as e:
logger.error(f"获取插件 {pid} 状态出错:{str(e)}")
state = False
conf.update({"state": state})
else:
conf.update({"state": False})
# 是否有详情页面
Expand Down

0 comments on commit 89a4932

Please sign in to comment.