From a21e0922076259e05e82e778ab4823180979fa0c Mon Sep 17 00:00:00 2001 From: qinglong Date: Sat, 13 Jun 2026 17:56:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Sentinel=20SSE=20URL=20=E2=80=94=20/SenS?= =?UTF-8?q?u/plugin/...=20=E2=86=92=20/plugin/...=20(=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E8=B7=AF=E7=94=B1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/permissions/pending_requests.json | 88 ++++++++++++++++++++++++ config/permissions/plugin_status.json | 3 +- config/plugins/commands.yaml | 19 +++-- config/services/network_routes.yaml | 15 +++- plugins/sentinel/dashboard.html | 2 +- 5 files changed, 120 insertions(+), 7 deletions(-) diff --git a/config/permissions/pending_requests.json b/config/permissions/pending_requests.json index e078975..112562a 100644 --- a/config/permissions/pending_requests.json +++ b/config/permissions/pending_requests.json @@ -64,5 +64,93 @@ "framework.command.execute" ], "timestamp": 25949.800077287 + }, + "bc954d7a": { + "plugin_name": "example_plugin", + "permissions": [ + "plugin.example.read", + "plugin.example.write", + "plugin.example.execute", + "framework.event.subscribe", + "framework.command.execute" + ], + "timestamp": 26229.065811503 + }, + "ce4ac758": { + "plugin_name": "sentinel", + "permissions": [ + "plugin.sentinel.read", + "plugin.sentinel.write", + "plugin.network.access", + "framework.event.subscribe", + "framework.command.execute" + ], + "timestamp": 26229.070282128 + }, + "c8b48b80": { + "plugin_name": "example_plugin", + "permissions": [ + "plugin.example.read", + "plugin.example.write", + "plugin.example.execute", + "framework.event.subscribe", + "framework.command.execute" + ], + "timestamp": 26309.926670171 + }, + "79a90016": { + "plugin_name": "sentinel", + "permissions": [ + "plugin.sentinel.read", + "plugin.sentinel.write", + "plugin.network.access", + "framework.event.subscribe", + "framework.command.execute" + ], + "timestamp": 26309.928777723 + }, + "42572063": { + "plugin_name": "example_plugin", + "permissions": [ + "plugin.example.read", + "plugin.example.write", + "plugin.example.execute", + "framework.event.subscribe", + "framework.command.execute" + ], + "timestamp": 26336.230448858 + }, + "a7eb228c": { + "plugin_name": "sentinel", + "permissions": [ + "plugin.sentinel.read", + "plugin.sentinel.write", + "plugin.network.access", + "framework.event.subscribe", + "framework.command.execute" + ], + "timestamp": 26336.245063286 + }, + "87bfab61": { + "plugin_name": "example_plugin", + "permissions": [ + "plugin.example.read", + "plugin.example.write", + "plugin.example.execute", + "framework.event.subscribe", + "framework.command.execute" + ], + "timestamp": 26497.116175516 + }, + "d25e385d": { + "plugin_name": "sentinel", + "permissions": [ + "plugin.sentinel.read", + "plugin.sentinel.write", + "plugin.network.access", + "framework.event.subscribe", + "framework.command.execute" + ], + "timestamp": 26497.118727235 } } \ No newline at end of file diff --git a/config/permissions/plugin_status.json b/config/permissions/plugin_status.json index fc014fa..6b9ada4 100644 --- a/config/permissions/plugin_status.json +++ b/config/permissions/plugin_status.json @@ -1,3 +1,4 @@ { - "sentinel": "pending" + "sentinel": "pending", + "example_plugin": "pending" } \ No newline at end of file diff --git a/config/plugins/commands.yaml b/config/plugins/commands.yaml index 8777287..6518a58 100644 --- a/config/plugins/commands.yaml +++ b/config/plugins/commands.yaml @@ -9,6 +9,10 @@ commands: permissions: - framework.scaffold.plugin source: internal + echo: &id001 + description: echo input + permissions: [] + source: plugin.example_plugin help: description: 显示帮助信息 permissions: @@ -34,6 +38,10 @@ commands: permissions: - framework.permission.read source: internal + plugin_status: &id002 + description: show status + permissions: [] + source: plugin.example_plugin pm_plugin_status: description: '权限管理: 查看插件权限状态' permissions: @@ -79,7 +87,7 @@ commands: permissions: - framework.tui.control source: internal - sentinel: &id001 + sentinel: &id003 description: Sentinel 集群状态 permissions: [] source: plugin.sentinel @@ -93,8 +101,11 @@ commands: permissions: - framework.command.test source: internal -last_updated: 25949.782764527 +last_updated: 26497.09846161 plugin_commands: + example_plugin: + echo: *id001 + plugin_status: *id002 sentinel: - sentinel: *id001 -total_commands: 19 + sentinel: *id003 +total_commands: 21 diff --git a/config/services/network_routes.yaml b/config/services/network_routes.yaml index e551487..5195ee1 100644 --- a/config/services/network_routes.yaml +++ b/config/services/network_routes.yaml @@ -1,6 +1,19 @@ http_port: 4200 -last_updated: 25949.800680829 +last_updated: 26497.116694526 plugin_routes: + example_plugin: + - methods: + - GET + path: /example_plugin/api/example/info + require_auth: false + - methods: + - POST + path: /example_plugin/api/plugin/echo + require_auth: true + - methods: + - POST + path: /example_plugin/api/plugin/plugin_status + require_auth: true sentinel: - methods: - GET diff --git a/plugins/sentinel/dashboard.html b/plugins/sentinel/dashboard.html index 02a7a21..0bb0d8c 100644 --- a/plugins/sentinel/dashboard.html +++ b/plugins/sentinel/dashboard.html @@ -118,7 +118,7 @@ function connectSSE() { if (sseConn) { sseConn.close(); sseConn = null; } - sseConn = new EventSource("/SenSu/plugin/sentinel/sse"); + sseConn = new EventSource("/plugin/sentinel/sse"); sseConn.addEventListener("nodes_update", function(e){ var d = JSON.parse(e.data); if (d.nodes) renderNodes(d.nodes);