xui.go 891 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package controller
  2. import (
  3. "github.com/gin-gonic/gin"
  4. )
  5. type XUIController struct {
  6. BaseController
  7. inboundController *InboundController
  8. settingController *SettingController
  9. }
  10. func NewXUIController(g *gin.RouterGroup) *XUIController {
  11. a := &XUIController{}
  12. a.initRouter(g)
  13. return a
  14. }
  15. func (a *XUIController) initRouter(g *gin.RouterGroup) {
  16. g = g.Group("/xui")
  17. g.Use(a.checkLogin)
  18. g.GET("/", a.index)
  19. g.GET("/inbounds", a.inbounds)
  20. g.GET("/setting", a.setting)
  21. a.inboundController = NewInboundController(g)
  22. a.settingController = NewSettingController(g)
  23. }
  24. func (a *XUIController) index(c *gin.Context) {
  25. html(c, "index.html", "pages.index.title", nil)
  26. }
  27. func (a *XUIController) inbounds(c *gin.Context) {
  28. html(c, "inbounds.html", "pages.inbounds.title", nil)
  29. }
  30. func (a *XUIController) setting(c *gin.Context) {
  31. html(c, "setting.html", "pages.setting.title", nil)
  32. }