插件配置新增is_show控制是否显示在菜单中 (#1749)

This commit is contained in:
HibiKier 2024-11-29 10:01:50 +08:00 committed by GitHub
parent d00412e7fb
commit c7c759f2b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 0 deletions

View File

@ -29,6 +29,7 @@ __plugin_meta__ = PluginMetadata(
author="HibiKier",
version="0.1",
plugin_type=PluginType.DEPENDANT,
is_show=False,
configs=[
RegisterConfig(
key="type",

View File

@ -13,6 +13,7 @@ async def sort_type() -> dict[str, list[PluginInfo]]:
menu_type__not="",
load_status=True,
plugin_type__in=[PluginType.NORMAL, PluginType.DEPENDANT],
is_show=True,
)
sort_data = {}
for plugin in data:

View File

@ -136,6 +136,7 @@ async def _():
"version",
"admin_level",
"plugin_type",
"is_show",
]
)
update_list.append(plugin)

View File

@ -203,6 +203,8 @@ class PluginExtraData(BaseModel):
"""额外名称"""
sql_list: list[str] | None = None
"""常用sql"""
is_show: bool = True
"""是否显示在菜单中"""
class NoSuchConfig(Exception):

View File

@ -48,6 +48,8 @@ class PluginInfo(Model):
"""是否删除"""
parent = fields.CharField(max_length=255, null=True, description="父插件")
"""父插件"""
is_show = fields.BooleanField(default=True, description="是否显示在帮助中")
"""是否显示在帮助中"""
class Meta: # type: ignore
table = "plugin_info"
@ -81,4 +83,5 @@ class PluginInfo(Model):
async def _run_script(cls):
return [
"ALTER TABLE plugin_info ADD COLUMN parent character varying(255);",
"ALTER TABLE plugin_info ADD COLUMN is_show boolean DEFAULT true;",
]