diff --git a/models/container.go b/models/container.go index 4bc1b4f..d3c8037 100644 --- a/models/container.go +++ b/models/container.go @@ -237,7 +237,7 @@ func (c *Container) read() error { c.Available = true switch c.Type { case "ql": - if c.Version == "2.8" || c.Version == "2.9" { + if c.Version == "2.8" { type AutoGenerated struct { Code int `json:"code"` Data []struct { @@ -268,7 +268,39 @@ func (c *Container) read() error { } } return nil - } else { + } else if c.Version == "2.8"{ + 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 { var data, err = c.request("/api/cookies") if err != nil { c.Available = false