diff --git a/api.go b/api.go index 2f746f4..2e59b3f 100644 --- a/api.go +++ b/api.go @@ -45,10 +45,13 @@ func SetupRouter() *gin.Engine { api := r.Group("/api") { + // ---- 公开路由(不需要认证) ---- api.GET("/check/users", checkUsersHandler) api.POST("/register", registerHandler) api.POST("/login", loginHandler) + api.GET("/ping", pingHandler) // ← 移到这里 + // ---- 需要认证的路由 ---- auth := api.Group("/") auth.Use(AuthMiddleware()) { @@ -66,7 +69,7 @@ func SetupRouter() *gin.Engine { auth.POST("/frpc/stop", stopFrpcHandler) auth.GET("/frpc/status", getFrpcStatusHandler) auth.GET("/frpc/log", getFrpcLogHandler) - auth.GET("/ping", pingHandler) + auth.POST("/import/toml", importTomlHandler) auth.GET("/export/toml", ExportTomlHandler)