relay_management.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package routes
  2. import (
  3. "github.com/Wei-Shaw/sub2api/internal/handler"
  4. "github.com/gin-gonic/gin"
  5. )
  6. // All routes inherit authentication, hierarchy checks and the administrative audit middleware.
  7. func registerRelayManagementRoutes(admin *gin.RouterGroup, h *handler.Handlers) {
  8. cleanup := admin.Group("/users/cleanup")
  9. cleanup.GET("/summary", h.Admin.UserCleanup.Summary)
  10. cleanup.POST("/preview", h.Admin.UserCleanup.Preview)
  11. cleanup.POST("/execute", h.Admin.UserCleanup.Execute)
  12. admin.GET("/users/:id/cleanup-guard", h.Admin.UserCleanup.GetGuard)
  13. admin.PUT("/users/:id/cleanup-guard", h.Admin.UserCleanup.UpdateGuard)
  14. admin.POST("/accounts/:id/protection", h.Admin.AntiDegrade.SetProtection)
  15. admin.GET("/accounts/:id/traffic-control", h.Admin.AccountTraffic.Get)
  16. admin.PUT("/accounts/:id/traffic-control", h.Admin.AccountTraffic.Update)
  17. admin.POST("/accounts/protection/enable-batch", h.Admin.AntiDegrade.EnableBatch)
  18. tests := admin.Group("/intelligent-tests")
  19. tests.GET("/accounts", h.Admin.IntelligentTest.Accounts)
  20. tests.GET("/records", h.Admin.IntelligentTest.Records)
  21. tests.GET("/records/:id", h.Admin.IntelligentTest.Get)
  22. tests.GET("/records/:id/image", h.Admin.IntelligentTest.Image)
  23. tests.POST("/records/:id/cancel", h.Admin.IntelligentTest.Cancel)
  24. tests.POST("/records/:id/reevaluate", h.Admin.IntelligentTest.Reevaluate)
  25. tests.POST("/evaluate-preview", h.Admin.IntelligentTest.PreviewEvaluation)
  26. tests.POST("/run", h.Admin.IntelligentTest.Run)
  27. tests.GET("/settings", h.Admin.IntelligentTest.Settings)
  28. tests.PUT("/settings/:test_type", h.Admin.IntelligentTest.UpdateSetting)
  29. }
  30. func registerAccountCapabilityRoutes(authenticated *gin.RouterGroup, h *handler.Handlers) {
  31. capabilities := authenticated.Group("/account-capabilities")
  32. capabilities.GET("", h.AccountCapability.List)
  33. capabilities.GET("/:account_id/tests", h.AccountCapability.History)
  34. capabilities.GET("/results/:id", h.AccountCapability.Get)
  35. capabilities.GET("/results/:id/image", h.AccountCapability.Image)
  36. }