add wskey转换 tg代理

This commit is contained in:
ZJY 2021-09-22 14:38:06 +08:00
parent b44e176b78
commit 6f55a20cbf
5 changed files with 14 additions and 5 deletions

View File

@ -23,6 +23,7 @@ resident:
user_agent:
telegram_bot_token:
telegram_user_id:
TGURL: #填写TG代理地址参考https://www.kejiwanjia.com/server/5221.html#3worker
qquid:
qqgid:
qbot_public_mode: true

View File

@ -168,7 +168,10 @@ func updateCookie() {
ck := cks[i]
//JdCookie{}.Push(fmt.Sprintf("更新账号账号,%s", ck.Nickname))
var pinky = fmt.Sprintf("pin=%s;wskey=%s;", ck.PtPin, ck.WsKey)
rsp := cmd(fmt.Sprintf(`python3 test.py "%s"`, pinky), &Sender{})
rsp, err := getKey(pinky)
if err != nil {
logs.Error(err)
}
if strings.Contains(rsp, "错误") {
ck.Push(fmt.Sprintf("Wskey失效账号%s", ck.PtPin))
(&JdCookie{}).Push(fmt.Sprintf("Wskey失效%s", ck.PtPin))
@ -234,7 +237,10 @@ func CookieOK(ck *JdCookie) bool {
if Config.Wskey {
if len(ck.WsKey) > 0 {
var pinky = fmt.Sprintf("pin=%s;wskey=%s;", ck.PtPin, ck.WsKey)
msg := cmd(fmt.Sprintf(`python3 test.py "%s"`, pinky), &Sender{})
msg, err := getKey(pinky)
if err != nil {
logs.Error(err)
}
JdCookie{}.Push(fmt.Sprintf("自动转换wskey---%s", msg))
//缺少错误判断
if strings.Contains(msg, "错误") {

View File

@ -37,6 +37,7 @@ type Yaml struct {
IsOldV4 bool `yaml:"IsOldV4"`
ApiToken string `yaml:"ApiToken"`
Wskey bool `yaml:"Wskey"`
TGURL string `yaml:"TGURL"`
Node string
Npm string
Python string

View File

@ -20,6 +20,7 @@ func initTgBot() {
}
var err error
b, err = tb.NewBot(tb.Settings{
URL: Config.TGURL,
Token: Config.TelegramBotToken,
Poller: &tb.LongPoller{Timeout: 10 * time.Second},
})

View File

@ -57,12 +57,12 @@ func getKey(WSCK string) (string, error) {
logs.Info(string(data))
logs.Info("获取token正常")
tokenKey, _ := jsonparser.GetString(data, "tokenKey")
pt_key, err := appjmp(tokenKey)
logs.Info(pt_key)
ptKey, err := appjmp(tokenKey)
logs.Info(ptKey)
if err != nil {
return "", err
}
return pt_key, nil
return ptKey, nil
}
func appjmp(tokenKey string) (string, error) {