feat: add debug log stream support

This commit is contained in:
2026-04-02 23:27:46 +08:00
parent f1c16e89f0
commit 9ec25b94f1
15 changed files with 624 additions and 15 deletions

View File

@@ -48,6 +48,9 @@ func SetupRouter() *gin.Engine {
AllowCredentials: true,
MaxAge: 12 * time.Hour,
}))
if conf.IsDebugMode() {
r.Use(middleware.DebugHTTPLog())
}
wkHandler := handler.NewWKHandler()
sessionMiddleware := middleware.SessionMiddleware(wkHandler.Session)
// schedule.StartCron(wkHandler.Session)
@@ -65,6 +68,12 @@ func SetupRouter() *gin.Engine {
{
api.POST("/login", wkHandler.Login)
api.Any("/version", handler.Version)
if conf.IsDebugMode() {
debug := api.Group("/debug")
{
debug.GET("/ws/logs", handler.DebugLogWS)
}
}
v1 := api.Group("/v1")
{
v1.GET("/host", wkHandler.Host)