mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 07:57:21 +08:00
feat: 适配最新api
This commit is contained in:
@@ -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{
|
||||
|
||||
@@ -13,18 +13,16 @@ type App struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Categories []string `json:"categories"`
|
||||
Depends string `json:"depends"`
|
||||
Depends string `json:"depends"` // 依赖表达式
|
||||
Channels []struct {
|
||||
Slug string `json:"slug"`
|
||||
Name string `json:"name"`
|
||||
Panel string `json:"panel"`
|
||||
Install string `json:"install"`
|
||||
Uninstall string `json:"uninstall"`
|
||||
Update string `json:"update"`
|
||||
Subs []struct {
|
||||
Log string `json:"log"`
|
||||
Version string `json:"version"`
|
||||
} `json:"subs"`
|
||||
Slug string `json:"slug"` // 渠道代号
|
||||
Name string `json:"name"` // 渠道名称
|
||||
Panel string `json:"panel"` // 最低支持面板版本
|
||||
Install string `json:"install"` // 安装脚本
|
||||
Uninstall string `json:"uninstall"` // 卸载脚本
|
||||
Update string `json:"update"` // 更新脚本
|
||||
Version string `json:"version"` // 版本号
|
||||
Log string `json:"log"` // 更新日志
|
||||
} `json:"channels"`
|
||||
Order int `json:"order"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user