This commit is contained in:
MHSanaei 2026-04-19 21:21:08 +02:00
parent 0b45732422
commit 96f3768d53
No known key found for this signature in database
GPG key ID: 7E4060F2FBE5AB7A
4 changed files with 9 additions and 9 deletions

View file

@ -18,7 +18,7 @@ type APIController struct {
} }
// NewAPIController creates a new APIController instance and initializes its routes. // 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 := &APIController{}
a.initRouter(g, customGeo) a.initRouter(g, customGeo)
return a 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. // 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 // Main API group
api := g.Group("/panel/api") api := g.Group("/panel/api")
api.Use(a.checkAPIAuth) api.Use(a.checkAPIAuth)

View file

@ -15,10 +15,10 @@ import (
type CustomGeoController struct { type CustomGeoController struct {
BaseController 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 := &CustomGeoController{customGeoService: customGeo}
a.initRouter(g) a.initRouter(g)
return a return a

View file

@ -64,15 +64,15 @@ type CustomGeoUpdateAllResult struct {
} }
type CustomGeoService struct { type CustomGeoService struct {
serverService ServerService serverService *ServerService
updateAllGetAll func() ([]model.CustomGeoResource, error) updateAllGetAll func() ([]model.CustomGeoResource, error)
updateAllApply func(id int, onStartup bool) (string, error) updateAllApply func(id int, onStartup bool) (string, error)
updateAllRestart func() error updateAllRestart func() error
} }
func NewCustomGeoService() CustomGeoService { func NewCustomGeoService() *CustomGeoService {
s := CustomGeoService{ s := &CustomGeoService{
serverService: ServerService{}, serverService: &ServerService{},
} }
s.updateAllGetAll = s.GetAll s.updateAllGetAll = s.GetAll
s.updateAllApply = s.applyDownloadAndPersist s.updateAllApply = s.applyDownloadAndPersist

View file

@ -104,7 +104,7 @@ type Server struct {
xrayService service.XrayService xrayService service.XrayService
settingService service.SettingService settingService service.SettingService
tgbotService service.Tgbot tgbotService service.Tgbot
customGeoService service.CustomGeoService customGeoService *service.CustomGeoService
wsHub *websocket.Hub wsHub *websocket.Hub