diff --git a/config/permissions/pending_requests.json b/config/permissions/pending_requests.json index d70379c..ad987f5 100644 --- a/config/permissions/pending_requests.json +++ b/config/permissions/pending_requests.json @@ -460,5 +460,27 @@ "framework.command.execute" ], "timestamp": 29166.973069289 + }, + "4dc1c6d5": { + "plugin_name": "example_plugin", + "permissions": [ + "plugin.example.read", + "plugin.example.write", + "plugin.example.execute", + "framework.event.subscribe", + "framework.command.execute" + ], + "timestamp": 29386.796805455 + }, + "0dd80fb1": { + "plugin_name": "sentinel", + "permissions": [ + "plugin.sentinel.read", + "plugin.sentinel.write", + "plugin.network.access", + "framework.event.subscribe", + "framework.command.execute" + ], + "timestamp": 29386.802027486 } } \ No newline at end of file diff --git a/config/plugins/commands.yaml b/config/plugins/commands.yaml index fea5425..8305f77 100644 --- a/config/plugins/commands.yaml +++ b/config/plugins/commands.yaml @@ -101,7 +101,7 @@ commands: permissions: - framework.command.test source: internal -last_updated: 29166.959137102 +last_updated: 29386.77279457 plugin_commands: example_plugin: echo: *id001 diff --git a/config/services/network_routes.yaml b/config/services/network_routes.yaml index 4a0b563..ca444e7 100644 --- a/config/services/network_routes.yaml +++ b/config/services/network_routes.yaml @@ -1,5 +1,5 @@ http_port: 4200 -last_updated: 29166.971388508 +last_updated: 29386.797962851 plugin_routes: example_plugin: - methods: diff --git a/services/web_panel/routes/plugins.py b/services/web_panel/routes/plugins.py index 47f0122..7e75016 100644 --- a/services/web_panel/routes/plugins.py +++ b/services/web_panel/routes/plugins.py @@ -55,15 +55,21 @@ async def plugin_stats(req): sm = req.app.get("service_manager") ps = sm.get_service("plugin") if sm else None total = len(ps.plugin_info) if ps else 0 - loaded = len(ps.plugins) if ps else 0 + loaded = sum(1 for n, info in ps.plugin_info.items() if n in ps.plugins) if ps else 0 disabled = total - loaded + # 启动失败: 插件目录存在但未成功加载 + 导入失败记录 failed = len(_IMPORT_FAILS) + if ps: + for name, info in ps.plugin_info.items(): + if getattr(info, "error_count", 0) > 0 and name not in _IMPORT_FAILS: + failed += 1 + _IMPORT_FAILS[name] = f"启动失败 (错误数: {info.error_count})" return web.json_response({ "total": total, "loaded": loaded, "disabled": max(0, disabled), "failed": failed, - "fail_details": _IMPORT_FAILS, + "fail_details": dict(_IMPORT_FAILS), }) diff --git a/static/web_panel/pages/plugins.html b/static/web_panel/pages/plugins.html index 564b48e..7a12360 100644 --- a/static/web_panel/pages/plugins.html +++ b/static/web_panel/pages/plugins.html @@ -6,7 +6,7 @@