diff --git a/conf/demo_config.yaml b/conf/demo_config.yaml index d37bdd6..0f113bd 100644 --- a/conf/demo_config.yaml +++ b/conf/demo_config.yaml @@ -11,6 +11,7 @@ containers: AtTime: #填写1-12之间的数 填错自负默认为10 10点容易出现高峰超时。 IsHelp: #填写true或者false false IsOldV4: #填写true或者false false是否新版或者旧版V4 +ApiToken: #为空默认随机禁用 theme: static: ./static master: diff --git a/controllers/login.go b/controllers/login.go index ebad7bf..d0329ff 100644 --- a/controllers/login.go +++ b/controllers/login.go @@ -371,6 +371,7 @@ func (c *LoginController) CkLogin() { if !models.HasPin(ptPin) { models.NewJdCookie(ck) result.Message = fmt.Sprintf("添加成功") + result.Data = ck.Query() jsons, errs := json.Marshal(result) //转换成JSON返回的是byte[] if errs != nil { fmt.Println(errs.Error()) @@ -380,6 +381,7 @@ func (c *LoginController) CkLogin() { ck, _ := models.GetJdCookie(ptPin) ck.InPool(ptKey) result.Message = fmt.Sprintf("更新成功") + result.Data = ck.Query() jsons, errs := json.Marshal(result) //转换成JSON返回的是byte[] if errs != nil { fmt.Println(errs.Error()) diff --git a/models/config.go b/models/config.go index 82cd824..fbe3123 100644 --- a/models/config.go +++ b/models/config.go @@ -1,6 +1,7 @@ package models import ( + "github.com/Mrs4s/MiraiGo/utils" "io" "io/ioutil" "os" @@ -34,6 +35,7 @@ type Yaml struct { CTime string `yaml:"AtTime"` IsHelp bool `yaml:"IsHelp"` IsOldV4 bool `yaml:"IsOldV4"` + ApiToken string `yaml:"ApiToken"` Node string Npm string Python string @@ -102,6 +104,9 @@ func initConfig() { if Config.Npm == "" { Config.Npm = "npm" } + if Config.ApiToken == "" { + Config.ApiToken = utils.RandomString(17) + } if Config.Node == "" { Config.Node = "node" }