diff options
| author | Vladislav Tupikin <MrRefactoring@yandex.ru> | 2026-04-19 22:24:24 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-19 22:24:24 +0300 |
| commit | 7466916e0206d55826d74f37c251bb5e40182c00 (patch) | |
| tree | 2c887558c71f34b76e541c7bf7d57a420ed3c9ed /web/web.go | |
| parent | 96b568b8389fd5a3ce228d5fb82ec9742d145b15 (diff) | |
Add custom geosite/geoip URL sources (#3980)
* feat: add custom geosite/geoip URL sources
Register DB model, panel API, index/xray UI, and i18n.
* fix
Diffstat (limited to 'web/web.go')
| -rw-r--r-- | web/web.go | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -101,9 +101,10 @@ type Server struct { api *controller.APIController ws *controller.WebSocketController - xrayService service.XrayService - settingService service.SettingService - tgbotService service.Tgbot + xrayService service.XrayService + settingService service.SettingService + tgbotService service.Tgbot + customGeoService *service.CustomGeoService wsHub *websocket.Hub @@ -268,7 +269,7 @@ func (s *Server) initRouter() (*gin.Engine, error) { s.index = controller.NewIndexController(g) s.panel = controller.NewXUIController(g) - s.api = controller.NewAPIController(g) + s.api = controller.NewAPIController(g, s.customGeoService) // Initialize WebSocket hub s.wsHub = websocket.NewHub() @@ -295,6 +296,7 @@ func (s *Server) initRouter() (*gin.Engine, error) { // startTask schedules background jobs (Xray checks, traffic jobs, cron // jobs) which the panel relies on for periodic maintenance and monitoring. func (s *Server) startTask() { + s.customGeoService.EnsureOnStartup() err := s.xrayService.RestartXray(true) if err != nil { logger.Warning("start xray failed:", err) @@ -388,6 +390,8 @@ func (s *Server) Start() (err error) { s.cron = cron.New(cron.WithLocation(loc), cron.WithSeconds()) s.cron.Start() + s.customGeoService = service.NewCustomGeoService() + engine, err := s.initRouter() if err != nil { return err |
