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.
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)

View file

@ -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

View file

@ -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

View file

@ -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