Files
waf-platform/EdgeAdmin/internal/web/actions/default/settings/ip-library/init.go

98 lines
3.7 KiB
Go

//go:build plus
package iplibrary
import (
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
"github.com/TeaOSLab/EdgeAdmin/internal/plus"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/ip-library/cities"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/ip-library/countries"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/ip-library/creating"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/ip-library/libraries"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/ip-library/library"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/ip-library/providers"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/ip-library/provinces"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/ip-library/towns"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/settingutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(plus.NewBasicHelper()).
Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeSetting)).
Helper(NewHelper()).
Helper(settingutils.NewHelper("ipLibrary")).
// IP库
Prefix("/settings/ip-library").
Get("", new(IndexAction)).
GetPost("/upload", new(UploadAction)).
Get("/download", new(DownloadAction)).
Post("/delete", new(DeleteAction)).
Post("/updatePublic", new(UpdatePublicAction)).
// IP库
Prefix("/settings/ip-library/libraries").
Get("", new(libraries.IndexAction)).
GetPost("/create", new(libraries.CreateAction)).
Post("/delete", new(libraries.DeleteAction)).
// 创建
Prefix("/settings/ip-library/creating").
Post("/testFormat", new(creating.TestFormatAction)).
Post("/upload", new(creating.UploadAction)).
Post("/countries", new(creating.CountriesAction)).
Post("/provinces", new(creating.ProvincesAction)).
Post("/cities", new(creating.CitiesAction)).
Post("/towns", new(creating.TownsAction)).
Post("/providers", new(creating.ProvidersAction)).
Post("/addCountryCustomCode", new(creating.AddCountryCustomCodeAction)).
Post("/addProvinceCustomCode", new(creating.AddProvinceCustomCodeAction)).
Post("/addCityCustomCode", new(creating.AddCityCustomCodeAction)).
Post("/addTownCustomCode", new(creating.AddTownCustomCodeAction)).
Post("/addProviderCustomCode", new(creating.AddProviderCustomCodeAction)).
Post("/finish", new(creating.FinishAction)).
Post("/generate", new(creating.GenerateAction)).
// 单个IP库
Prefix("/settings/ip-library/library").
Get("", new(library.IndexAction)).
Get("/download", new(library.DownloadAction)).
GetPost("/test", new(library.TestAction)).
// 国家/地区
Prefix("/settings/ip-library/countries").
Get("", new(countries.IndexAction)).
GetPost("/updatePopup", new(countries.UpdatePopupAction)).
// 省份
Prefix("/settings/ip-library/provinces").
Get("", new(provinces.IndexAction)).
GetPost("/updatePopup", new(provinces.UpdatePopupAction)).
// 城市
Prefix("/settings/ip-library/cities").
Get("", new(cities.IndexAction)).
GetPost("/updatePopup", new(cities.UpdatePopupAction)).
Post("/provinceOptions", new(cities.ProvinceOptionsAction)).
// 区县
Prefix("/settings/ip-library/towns").
Get("", new(towns.IndexAction)).
GetPost("/updatePopup", new(towns.UpdatePopupAction)).
Post("/provinceOptions", new(towns.ProvinceOptionsAction)).
Post("/cityOptions", new(towns.CityOptionsAction)).
// ISP
Prefix("/settings/ip-library/providers").
Get("", new(providers.IndexAction)).
GetPost("/updatePopup", new(providers.UpdatePopupAction)).
//
EndAll()
})
}