feat(backend): implement WebSocket-based SSH terminal interface

This commit is contained in:
pycook
2025-08-18 18:09:54 +08:00
parent 6a4a64b69f
commit 0e96f10089
5 changed files with 348 additions and 3 deletions

View File

@@ -25,6 +25,17 @@ func LoggerMiddleware() gin.HandlerFunc {
return
}
// Skip logging WebSocket connections to avoid hijacked connection issues
if _, isWebSocket := ctx.Get("websocket_connection"); isWebSocket {
logger.L().Debug(url,
zap.String("method", ctx.Request.Method),
zap.Int("status", 200),
zap.String("ip", ctx.ClientIP()),
zap.Duration("cost", cost),
)
return
}
// Only log errors and slow requests
status := ctx.Writer.Status()
if status >= 400 || cost > 1*time.Second {