mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
fix(api): Enable management routes based on secret key presence
This commit is contained in:
@@ -394,10 +394,14 @@ func (s *Server) setupRoutes() {
|
||||
|
||||
func (s *Server) managementAvailabilityMiddleware() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
if !s.managementRoutesEnabled.Load() {
|
||||
cfg := s.cfg
|
||||
if cfg == nil || cfg.RemoteManagement.SecretKey == "" {
|
||||
s.managementRoutesEnabled.Store(false)
|
||||
c.AbortWithStatus(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
s.managementRoutesEnabled.Store(true)
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user