xui.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. xraySettingController *XraySettingController
  10. }
  11. func NewXUIController(g *gin.RouterGroup) *XUIController {
  12. a := &XUIController{}
  13. a.initRouter(g)
  14. return a
  15. }
  16. func (a *XUIController) initRouter(g *gin.RouterGroup) {
  17. g = g.Group("/panel")
  18. g.Use(a.checkLogin)
  19. g.GET("/", a.index)
  20. g.GET("/inbounds", a.inbounds)
  21. g.GET("/settings", a.settings)
  22. g.GET("/xray", a.xraySettings)
  23. a.inboundController = NewInboundController(g)
  24. a.settingController = NewSettingController(g)
  25. a.xraySettingController = NewXraySettingController(g)
  26. }
  27. func (a *XUIController) index(c *gin.Context) {
  28. html(c, "index.html", "pages.index.title", nil)
  29. }
  30. func (a *XUIController) inbounds(c *gin.Context) {
  31. html(c, "inbounds.html", "pages.inbounds.title", nil)
  32. }
  33. func (a *XUIController) settings(c *gin.Context) {
  34. html(c, "settings.html", "pages.settings.title", nil)
  35. }
  36. func (a *XUIController) xraySettings(c *gin.Context) {
  37. html(c, "xray.html", "pages.xray.title", nil)
  38. }