mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-21 10:27:14 +00:00
refactor: replace custom geo manager with Xray-core native geodata auto-update
Remove the panel-side custom geo download feature (service, controller, /panel/api/custom-geo/* endpoints, CustomGeoResource model, UI tab) in favor of Xray-core's native geodata section (https://xtls.github.io/config/geodata.html). - pass the top-level "geodata" key through xray.Config so it survives the template round-trip into the generated config - add a Geodata Auto-Update section to the Xray Updates modal that edits geodata (cron schedule, download outbound, asset list) in the config template and restarts Xray on save - previously downloaded geo files in the bin folder keep working in ext: routing rules; the orphaned custom_geo_resources table is left in place so existing source URLs stay recoverable
This commit is contained in:
+4
-9
@@ -26,7 +26,6 @@ import (
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/web/network"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/web/runtime"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/web/service"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/web/service/integration"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/web/service/panel"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/web/service/tgbot"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/web/websocket"
|
||||
@@ -107,10 +106,9 @@ type Server struct {
|
||||
api *controller.APIController
|
||||
ws *controller.WebSocketController
|
||||
|
||||
xrayService service.XrayService
|
||||
settingService service.SettingService
|
||||
tgbotService tgbot.Tgbot
|
||||
customGeoService *integration.CustomGeoService
|
||||
xrayService service.XrayService
|
||||
settingService service.SettingService
|
||||
tgbotService tgbot.Tgbot
|
||||
|
||||
wsHub *websocket.Hub
|
||||
|
||||
@@ -229,7 +227,7 @@ func (s *Server) initRouter() (*gin.Engine, error) {
|
||||
s.index = controller.NewIndexController(g)
|
||||
s.panel = controller.NewXUIController(g)
|
||||
g.GET("/panel/api/openapi.json", controller.ServeOpenAPISpec)
|
||||
s.api = controller.NewAPIController(g, s.customGeoService)
|
||||
s.api = controller.NewAPIController(g)
|
||||
|
||||
// Initialize WebSocket hub
|
||||
s.wsHub = websocket.NewHub()
|
||||
@@ -257,7 +255,6 @@ 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(restartXray bool) {
|
||||
s.customGeoService.EnsureOnStartup()
|
||||
if restartXray {
|
||||
err := s.xrayService.RestartXray(true)
|
||||
if err != nil {
|
||||
@@ -389,8 +386,6 @@ func (s *Server) start(restartXray bool, startTgBot bool) (err error) {
|
||||
SetNeedRestart: func() { s.xrayService.SetToNeedRestart() },
|
||||
}))
|
||||
|
||||
s.customGeoService = integration.NewCustomGeoService()
|
||||
|
||||
engine, err := s.initRouter()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user