From 96f3768d53d942493694bd942b8a44cf593c0cb1 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Sun, 19 Apr 2026 21:21:08 +0200 Subject: [PATCH] fix --- web/controller/api.go | 4 ++-- web/controller/custom_geo.go | 4 ++-- web/service/custom_geo.go | 8 ++++---- web/web.go | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/web/controller/api.go b/web/controller/api.go index 8e9224ea..57d2e4cb 100644 --- a/web/controller/api.go +++ b/web/controller/api.go @@ -18,7 +18,7 @@ type APIController struct { } // NewAPIController creates a new APIController instance and initializes its routes. -func NewAPIController(g *gin.RouterGroup, customGeo service.CustomGeoService) *APIController { +func NewAPIController(g *gin.RouterGroup, customGeo *service.CustomGeoService) *APIController { a := &APIController{} a.initRouter(g, customGeo) return a @@ -35,7 +35,7 @@ func (a *APIController) checkAPIAuth(c *gin.Context) { } // initRouter sets up the API routes for inbounds, server, and other endpoints. -func (a *APIController) initRouter(g *gin.RouterGroup, customGeo service.CustomGeoService) { +func (a *APIController) initRouter(g *gin.RouterGroup, customGeo *service.CustomGeoService) { // Main API group api := g.Group("/panel/api") api.Use(a.checkAPIAuth) diff --git a/web/controller/custom_geo.go b/web/controller/custom_geo.go index 3626c21b..b0542581 100644 --- a/web/controller/custom_geo.go +++ b/web/controller/custom_geo.go @@ -15,10 +15,10 @@ import ( type CustomGeoController struct { BaseController - customGeoService service.CustomGeoService + customGeoService *service.CustomGeoService } -func NewCustomGeoController(g *gin.RouterGroup, customGeo service.CustomGeoService) *CustomGeoController { +func NewCustomGeoController(g *gin.RouterGroup, customGeo *service.CustomGeoService) *CustomGeoController { a := &CustomGeoController{customGeoService: customGeo} a.initRouter(g) return a diff --git a/web/service/custom_geo.go b/web/service/custom_geo.go index 068bc8cf..a8b7456b 100644 --- a/web/service/custom_geo.go +++ b/web/service/custom_geo.go @@ -64,15 +64,15 @@ type CustomGeoUpdateAllResult struct { } type CustomGeoService struct { - serverService ServerService + serverService *ServerService updateAllGetAll func() ([]model.CustomGeoResource, error) updateAllApply func(id int, onStartup bool) (string, error) updateAllRestart func() error } -func NewCustomGeoService() CustomGeoService { - s := CustomGeoService{ - serverService: ServerService{}, +func NewCustomGeoService() *CustomGeoService { + s := &CustomGeoService{ + serverService: &ServerService{}, } s.updateAllGetAll = s.GetAll s.updateAllApply = s.applyDownloadAndPersist diff --git a/web/web.go b/web/web.go index 81b9a499..462e88a0 100644 --- a/web/web.go +++ b/web/web.go @@ -104,7 +104,7 @@ type Server struct { xrayService service.XrayService settingService service.SettingService tgbotService service.Tgbot - customGeoService service.CustomGeoService + customGeoService *service.CustomGeoService wsHub *websocket.Hub