fix plugin state
This commit is contained in:
parent
79a57b0576
commit
803717d4c3
@ -186,8 +186,11 @@ class PluginManager(metaclass=Singleton):
|
|||||||
else:
|
else:
|
||||||
conf.update({"installed": False})
|
conf.update({"installed": False})
|
||||||
# 运行状态
|
# 运行状态
|
||||||
if hasattr(plugin, "get_state"):
|
if pid in self._running_plugins.keys() and hasattr(plugin, "get_state"):
|
||||||
conf.update({"state": plugin.get_state()})
|
plugin_obj = self._running_plugins.get(pid)
|
||||||
|
conf.update({"state": plugin_obj.get_state()})
|
||||||
|
else:
|
||||||
|
conf.update({"state": False})
|
||||||
# 名称
|
# 名称
|
||||||
if hasattr(plugin, "plugin_name"):
|
if hasattr(plugin, "plugin_name"):
|
||||||
conf.update({"plugin_name": plugin.plugin_name})
|
conf.update({"plugin_name": plugin.plugin_name})
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from typing import Optional
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
@ -7,24 +9,26 @@ class Plugin(BaseModel):
|
|||||||
"""
|
"""
|
||||||
id: str = None
|
id: str = None
|
||||||
# 插件名称
|
# 插件名称
|
||||||
plugin_name: str = None
|
plugin_name: Optional[str] = None
|
||||||
# 插件描述
|
# 插件描述
|
||||||
plugin_desc: str = None
|
plugin_desc: Optional[str] = None
|
||||||
# 插件图标
|
# 插件图标
|
||||||
plugin_icon: str = None
|
plugin_icon: Optional[str] = None
|
||||||
# 主题色
|
# 主题色
|
||||||
plugin_color: str = None
|
plugin_color: Optional[str] = None
|
||||||
# 插件版本
|
# 插件版本
|
||||||
plugin_version: str = None
|
plugin_version: Optional[str] = None
|
||||||
# 插件作者
|
# 插件作者
|
||||||
plugin_author: str = None
|
plugin_author: Optional[str] = None
|
||||||
# 作者主页
|
# 作者主页
|
||||||
author_url: str = None
|
author_url: Optional[str] = None
|
||||||
# 插件配置项ID前缀
|
# 插件配置项ID前缀
|
||||||
plugin_config_prefix: str = None
|
plugin_config_prefix: Optional[str] = None
|
||||||
# 加载顺序
|
# 加载顺序
|
||||||
plugin_order: int = 0
|
plugin_order: Optional[int] = 0
|
||||||
# 可使用的用户级别
|
# 可使用的用户级别
|
||||||
auth_level: int = 0
|
auth_level: Optional[int] = 0
|
||||||
# 是否已安装
|
# 是否已安装
|
||||||
installed: bool = False
|
installed: Optional[bool] = False
|
||||||
|
# 运行状态
|
||||||
|
state: Optional[bool] = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user