mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-05-06 22:12:23 +08:00
- Introduced `WebSocketTrustedOrigins` setting in `app.example.ini` and corresponding documentation. - Refactored WebSocket origin checks across multiple API endpoints to utilize the new middleware for improved security. - Added tests for the new origin validation logic to ensure proper handling of trusted origins and node secret requests.
19 lines
427 B
Go
19 lines
427 B
Go
package mcp
|
|
|
|
import (
|
|
"github.com/0xJacky/Nginx-UI/internal/mcp"
|
|
"github.com/0xJacky/Nginx-UI/internal/middleware"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func InitRouter(r *gin.Engine) {
|
|
r.Any("/mcp", middleware.IPWhiteList(), middleware.AuthRequired(),
|
|
func(c *gin.Context) {
|
|
mcp.ServeHTTP(c)
|
|
})
|
|
r.Any("/mcp_message", middleware.IPWhiteList(), middleware.AuthRequired(),
|
|
func(c *gin.Context) {
|
|
mcp.ServeHTTP(c)
|
|
})
|
|
}
|