增加对alook等所有ck的支持
增加页面添加CK
This commit is contained in:
parent
29f53fe2e9
commit
fe9f45fae1
@ -337,6 +337,94 @@ func (c *LoginController) IsAdmin() {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *LoginController) CkLogin() {
|
||||
cookies := c.GetString("ck")
|
||||
qq, _ := c.GetInt("qq")
|
||||
bz := c.GetString("bz")
|
||||
push := c.GetString("push")
|
||||
|
||||
if strings.Contains(cookies, "pt_key") {
|
||||
ptKey := FetchJdCookieValue("pt_key", cookies)
|
||||
ptPin := FetchJdCookieValue("pt_pin", cookies)
|
||||
ck := &models.JdCookie{
|
||||
PtKey: ptKey,
|
||||
PtPin: ptPin,
|
||||
Hack: models.False,
|
||||
QQ: qq,
|
||||
Note: bz,
|
||||
PushPlus: push,
|
||||
}
|
||||
if ptKey != "" && ptPin != "" {
|
||||
if models.CookieOK(ck) {
|
||||
if !models.HasPin(ptPin) {
|
||||
models.NewJdCookie(ck)
|
||||
c.Ctx.WriteString(fmt.Sprintf("添加成功"))
|
||||
} else if !models.HasKey(ptKey) {
|
||||
ck, _ := models.GetJdCookie(ptPin)
|
||||
ck.InPool(ptKey)
|
||||
c.Ctx.WriteString(fmt.Sprintf("更新成功"))
|
||||
}
|
||||
} else {
|
||||
c.Ctx.WriteString("CK过期")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
c.Ctx.WriteString("ck格式错误")
|
||||
|
||||
//if strings.Contains(ck,"pt_key") {
|
||||
// ptKey := FetchJdCookieValue("pt_key", msg)
|
||||
// ptPin := FetchJdCookieValue("pt_pin", msg)
|
||||
// if len(ptPin)>0 || len(ptKey)>0 {
|
||||
// ck := JdCookie{
|
||||
// PtKey: ptKey,
|
||||
// PtPin: ptPin,
|
||||
// }
|
||||
// if CookieOK(&ck) {
|
||||
// if HasKey(ck.PtKey) {
|
||||
// sender.Reply(fmt.Sprintf("重复提交"))
|
||||
// } else {
|
||||
// if nck, err := GetJdCookie(ck.PtPin); err == nil {
|
||||
// nck.InPool(ck.PtKey)
|
||||
// msg := fmt.Sprintf("更新账号,%s", ck.PtPin)
|
||||
// if sender.IsQQ() {
|
||||
// ck.Update(QQ, ck.QQ)
|
||||
// }
|
||||
// sender.Reply(fmt.Sprintf(msg))
|
||||
// (&JdCookie{}).Push(msg)
|
||||
// logs.Info(msg)
|
||||
// } else {
|
||||
// if Cdle {
|
||||
// ck.Hack = True
|
||||
// }
|
||||
// NewJdCookie(&ck)
|
||||
// msg := fmt.Sprintf("添加账号,账号名:%s", ck.PtPin)
|
||||
// if sender.IsQQ() {
|
||||
// ck.Update(QQ, ck.QQ)
|
||||
// }
|
||||
// sender.Reply(fmt.Sprintf(msg))
|
||||
// logs.Info(msg)
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// sender.Reply(fmt.Sprintf("无效"))
|
||||
// }
|
||||
// }
|
||||
//}else{
|
||||
// c.Ctx.WriteString("ck格式错误")
|
||||
//}
|
||||
|
||||
//if pin == "" {
|
||||
// c.Ctx.Redirect(302, "/")
|
||||
// c.StopRun()
|
||||
//} else {
|
||||
// if strings.EqualFold(models.Config.Master, pin) {
|
||||
// c.SetSession("pin", pin)
|
||||
// c.Ctx.WriteString("登录")
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
func (c *LoginController) Cookie() {
|
||||
cookies := c.Ctx.Input.Header("Set-Cookie")
|
||||
pt_key := FetchJdCookieValue("pt_key", cookies)
|
||||
|
||||
1
main.go
1
main.go
@ -56,6 +56,7 @@ func main() {
|
||||
web.Router("/api/login/query", &controllers.LoginController{}, "get:Query")
|
||||
web.Router("/api/login/cookie", &controllers.LoginController{}, "get:Cookie")
|
||||
web.Router("/api/login/admin", &controllers.LoginController{}, "post:IsAdmin")
|
||||
web.Router("/api/login/cklogin", &controllers.LoginController{}, "post:CkLogin")
|
||||
web.Router("/api/account", &controllers.AccountController{}, "get:List")
|
||||
web.Router("/api/account", &controllers.AccountController{}, "post:CreateOrUpdate")
|
||||
web.Router("/admin", &controllers.AccountController{}, "get:Admin")
|
||||
|
||||
@ -139,8 +139,10 @@ func updateCookie() {
|
||||
cks := GetJdCookies()
|
||||
l := len(cks)
|
||||
logs.Info(l)
|
||||
xx := 0
|
||||
for i := range cks {
|
||||
if len(cks[i].WsKey) > 0 {
|
||||
xx++
|
||||
time.Sleep(10 * time.Second)
|
||||
ck := cks[i]
|
||||
//JdCookie{}.Push(fmt.Sprintf("更新账号账号,%s", ck.Nickname))
|
||||
@ -187,7 +189,7 @@ func updateCookie() {
|
||||
}
|
||||
}
|
||||
}
|
||||
(&JdCookie{}).Push(fmt.Sprintf("所有CK转换完成,共%d个", len(cks)))
|
||||
(&JdCookie{}).Push(fmt.Sprintf("所有CK转换完成,共%d个", xx))
|
||||
}
|
||||
|
||||
func CookieOK(ck *JdCookie) bool {
|
||||
|
||||
@ -186,6 +186,52 @@ var handleMessage = func(msgs ...interface{}) interface{} {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
{
|
||||
if strings.Contains(msg, "pt_key") {
|
||||
ptKey := FetchJdCookieValue("pt_key", msg)
|
||||
ptPin := FetchJdCookieValue("pt_pin", msg)
|
||||
if len(ptPin) > 0 || len(ptKey) > 0 {
|
||||
ck := JdCookie{
|
||||
PtKey: ptKey,
|
||||
PtPin: ptPin,
|
||||
}
|
||||
if CookieOK(&ck) {
|
||||
if sender.IsQQ() {
|
||||
ck.QQ = sender.UserID
|
||||
} else if sender.IsTG() {
|
||||
ck.Telegram = sender.UserID
|
||||
}
|
||||
if HasKey(ck.PtKey) {
|
||||
sender.Reply(fmt.Sprintf("重复提交"))
|
||||
} else {
|
||||
if nck, err := GetJdCookie(ck.PtPin); err == nil {
|
||||
nck.InPool(ck.PtKey)
|
||||
msg := fmt.Sprintf("更新账号,%s", ck.PtPin)
|
||||
if sender.IsQQ() {
|
||||
ck.Update(QQ, ck.QQ)
|
||||
}
|
||||
sender.Reply(fmt.Sprintf(msg))
|
||||
(&JdCookie{}).Push(msg)
|
||||
logs.Info(msg)
|
||||
} else {
|
||||
if Cdle {
|
||||
ck.Hack = True
|
||||
}
|
||||
NewJdCookie(&ck)
|
||||
msg := fmt.Sprintf("添加账号,账号名:%s", ck.PtPin)
|
||||
if sender.IsQQ() {
|
||||
ck.Update(QQ, ck.QQ)
|
||||
}
|
||||
sender.Reply(fmt.Sprintf(msg))
|
||||
logs.Info(msg)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sender.Reply(fmt.Sprintf("无效"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{ //
|
||||
ss := regexp.MustCompile(`pt_key=([^;=\s]+);pt_pin=([^;=\s]+)`).FindAllStringSubmatch(msg, -1)
|
||||
|
||||
@ -272,3 +318,12 @@ var handleMessage = func(msgs ...interface{}) interface{} {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func FetchJdCookieValue(key string, cookies string) string {
|
||||
match := regexp.MustCompile(key + `=([^;]*);{0,1}`).FindStringSubmatch(cookies)
|
||||
if len(match) == 2 {
|
||||
return match[1]
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
@ -680,13 +680,13 @@ var codeSignals = []CodeSignal{
|
||||
if nck, err := GetJdCookie(ck.PtPin); err == nil {
|
||||
nck.InPool(ck.PtKey)
|
||||
msg := fmt.Sprintf("更新账号,%s", ck.PtPin)
|
||||
(&JdCookie{}).Push(msg)
|
||||
sender.Reply(msg)
|
||||
logs.Info(msg)
|
||||
} else {
|
||||
if Cdle {
|
||||
ck.Hack = True
|
||||
}
|
||||
(&JdCookie{}).Push("转换失败")
|
||||
sender.Reply("转换失败")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
65
theme/plus.html
Normal file
65
theme/plus.html
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user