release: v0.1.3

This commit is contained in:
2026-04-03 14:24:29 +08:00
parent 98839e9782
commit 83ee4bb5ea
14 changed files with 413 additions and 132 deletions

View File

@@ -2,6 +2,7 @@ package middleware
import (
"bytes"
"ckwk/internal/conf"
"io"
"net/http"
"strings"
@@ -32,7 +33,12 @@ func (w *debugBodyWriter) WriteString(data string) (int, error) {
func DebugHTTPLog() gin.HandlerFunc {
return func(ctx *gin.Context) {
if isDebugLogRoute(ctx.Request.URL.Path) {
if !conf.IsRuntimeDebugEnabled() {
ctx.Next()
return
}
if !shouldCaptureBackendRoute(ctx.Request.URL.Path) {
ctx.Next()
return
}
@@ -85,5 +91,13 @@ func truncate(value string, limit int) string {
}
func isDebugLogRoute(path string) bool {
return strings.HasPrefix(path, "/api/debug/ws/logs")
return strings.HasPrefix(path, "/api/debug/")
}
func shouldCaptureBackendRoute(path string) bool {
if !strings.HasPrefix(path, "/api/") {
return false
}
return !isDebugLogRoute(path)
}