feat: add monitoring dashboard page and backend entry point.

This commit is contained in:
2026-01-30 11:58:28 +08:00
parent 59441adc99
commit b9c5b42f4e
2 changed files with 11 additions and 8 deletions

View File

@@ -286,7 +286,7 @@ func handleS2AProxy(w http.ResponseWriter, r *http.Request) {
targetURL += "?" + r.URL.RawQuery targetURL += "?" + r.URL.RawQuery
} }
logger.Info(fmt.Sprintf("S2A Proxy: %s -> %s", r.URL.Path, targetURL), "", "proxy") logger.Info(fmt.Sprintf("S2A Proxy: %s", targetPath), "", "proxy")
// 创建代理请求 // 创建代理请求
proxyReq, err := http.NewRequest(r.Method, targetURL, r.Body) proxyReq, err := http.NewRequest(r.Method, targetURL, r.Body)
@@ -295,9 +295,8 @@ func handleS2AProxy(w http.ResponseWriter, r *http.Request) {
return return
} }
// 设置认证头 - 尝试多种格式 // 设置认证头
adminKey := config.Global.S2AAdminKey adminKey := config.Global.S2AAdminKey
logger.Info(fmt.Sprintf("Using admin key (len=%d, prefix=%s...)", len(adminKey), adminKey[:min(8, len(adminKey))]), "", "proxy")
proxyReq.Header.Set("Authorization", "Bearer "+adminKey) proxyReq.Header.Set("Authorization", "Bearer "+adminKey)
proxyReq.Header.Set("X-API-Key", adminKey) proxyReq.Header.Set("X-API-Key", adminKey)
@@ -323,9 +322,8 @@ func handleS2AProxy(w http.ResponseWriter, r *http.Request) {
return return
} }
// 记录响应状态和内容摘要 // 记录响应状态(仅显示状态码和长度)
logger.Info(fmt.Sprintf("S2A 响应: status=%d, len=%d, body=%s", logger.Info(fmt.Sprintf("S2A 响应: status=%d, len=%d", resp.StatusCode, len(bodyBytes)), "", "proxy")
resp.StatusCode, len(bodyBytes), string(bodyBytes[:min(200, len(bodyBytes))])), "", "proxy")
// 复制响应头 // 复制响应头
for key, values := range resp.Header { for key, values := range resp.Header {

View File

@@ -477,8 +477,13 @@ export default function Monitor() {
min={10} min={10}
max={300} max={300}
value={pollingInterval} value={pollingInterval}
onChange={(e) => setPollingInterval(Number(e.target.value))} onChange={(e) => {
hint="自动刷新号池状态的间隔时间" const val = parseInt(e.target.value, 10)
if (!isNaN(val)) {
setPollingInterval(val)
}
}}
hint="自动刷新号池状态的间隔时间 (10-300秒)"
/> />
<div className="p-4 rounded-lg bg-slate-50 dark:bg-slate-800/50"> <div className="p-4 rounded-lg bg-slate-50 dark:bg-slate-800/50">
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">