修复V2.9面板问题

This commit is contained in:
ZJY 2021-08-29 19:27:08 +08:00
parent f3d9d1e2bb
commit 752dc1c530

View File

@ -237,7 +237,7 @@ func (c *Container) read() error {
c.Available = true
switch c.Type {
case "ql":
if c.Version == "2.8" {
if c.Version == "2.9" {
type AutoGenerated struct {
Code int `json:"code"`
Data []struct {
@ -268,39 +268,7 @@ func (c *Container) read() error {
}
}
return nil
} else if c.Version == "2.9"{
type AutoGenerated struct {
Code int `json:"code"`
Data []struct {
Value string `json:"value"`
ID string `json:"_id"`
Created int64 `json:"created"`
Status int `json:"status"`
Timestamp string `json:"timestamp"`
Position float64 `json:"position"`
Name string `json:"name"`
Remarks string `json:"remarks,omitempty"`
} `json:"data"`
}
var data, err = c.request("/api/envs?searchValue=JD_COOKIE")
a := AutoGenerated{}
err = json.Unmarshal(data, &a)
if err != nil {
c.Available = false
return err
}
c.Delete = []string{}
for _, env := range a.Data {
c.Delete = append(c.Delete, fmt.Sprintf("\"%s\"", env.ID))
res := regexp.MustCompile(`pt_key=(\S+);pt_pin=([^\s;]+);?`).FindAllStringSubmatch(env.Value, -1)
for _, v := range res {
CheckIn(v[2], v[1])
}
}
return nil
}
else {
} else {
var data, err = c.request("/api/cookies")
if err != nil {
c.Available = false