2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 09:13:49 +08:00

feat: 适配最新api

This commit is contained in:
2025-10-02 01:16:28 +08:00
parent bbc928a150
commit 63278ee05f
7 changed files with 51 additions and 52 deletions

View File

@@ -25,7 +25,7 @@ func NewAPI(panelVersion, locale string, url ...string) *API {
panic("panel version is required")
}
if len(url) == 0 {
url = append(url, "https://panel.haozi.net/api")
url = append(url, "https://api.acepanel.net")
}
hostInfo, err := host.Info()
@@ -36,7 +36,12 @@ func NewAPI(panelVersion, locale string, url ...string) *API {
client := resty.New()
client.SetTimeout(10 * time.Second)
client.SetBaseURL(url[0])
client.SetHeader("User-Agent", fmt.Sprintf("rat-panel/%s %s/%s", panelVersion, hostInfo.Platform, hostInfo.PlatformVersion))
client.SetHeader(
"User-Agent",
fmt.Sprintf("acepanel/%s/%s %s/%s arch/%s kernel/%s",
panelVersion, locale, hostInfo.Platform, hostInfo.PlatformVersion, hostInfo.KernelArch, hostInfo.KernelVersion,
),
)
client.SetQueryParam("locale", locale)
return &API{