security: 前端 WebSocket 连接传递 panel_token 认证

- dashboard.js / logs.js: WS URL 追加 ?token= 查询参数
- app.js: 添加 getCookie() 工具函数

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
qinglong
2026-06-13 13:38:38 +08:00
parent f7b4908322
commit a75b9d0975
3 changed files with 10 additions and 2 deletions
+2 -1
View File
@@ -25,7 +25,8 @@ window.LogsModule = {
}
var base = window.location.pathname.split("/").slice(0, 2).join("/");
var ws = new WebSocket("ws://" + location.host + base + "/api/logs/ws");
var tok = getCookie("panel_token");
var ws = new WebSocket("ws://" + location.host + base + "/api/logs/ws?token=" + (tok || ""));
self.ws = ws;
ws.onopen = function() {