mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-04 19:17:37 +08:00
update dep & add limitation for qrcode login
This commit is contained in:
parent
3a60e081f2
commit
73bd3c92f3
@ -161,12 +161,7 @@ func loginResponseProcessor(res *client.LoginResponse) error {
|
|||||||
var text string
|
var text string
|
||||||
switch res.Error {
|
switch res.Error {
|
||||||
case client.SliderNeededError:
|
case client.SliderNeededError:
|
||||||
log.Warnf("登录需要滑条验证码, 请选择验证方式: ")
|
log.Warnf("登录需要滑条验证码, 请验证后重试.")
|
||||||
log.Warnf("1. 使用浏览器抓取滑条并登录")
|
|
||||||
log.Warnf("2. 使用手机QQ扫码验证 (需要手Q和gocq在同一网络下).")
|
|
||||||
log.Warn("请输入(1 - 2):")
|
|
||||||
text = readIfTTY("1")
|
|
||||||
if strings.Contains(text, "1") {
|
|
||||||
ticket := getTicket(res.VerifyUrl)
|
ticket := getTicket(res.VerifyUrl)
|
||||||
if ticket == "" {
|
if ticket == "" {
|
||||||
log.Infof("按 Enter 继续....")
|
log.Infof("按 Enter 继续....")
|
||||||
@ -175,12 +170,6 @@ func loginResponseProcessor(res *client.LoginResponse) error {
|
|||||||
}
|
}
|
||||||
res, err = cli.SubmitTicket(ticket)
|
res, err = cli.SubmitTicket(ticket)
|
||||||
continue
|
continue
|
||||||
}
|
|
||||||
cli.Disconnect()
|
|
||||||
cli.Release()
|
|
||||||
cli = client.NewClientEmpty()
|
|
||||||
cli.UseDevice(device)
|
|
||||||
return qrcodeLogin()
|
|
||||||
case client.NeedCaptcha:
|
case client.NeedCaptcha:
|
||||||
log.Warnf("登录需要验证码.")
|
log.Warnf("登录需要验证码.")
|
||||||
_ = os.WriteFile("captcha.jpg", res.CaptchaImage, 0o644)
|
_ = os.WriteFile("captcha.jpg", res.CaptchaImage, 0o644)
|
||||||
|
@ -226,6 +226,11 @@ func LoginInteract() {
|
|||||||
isQRCodeLogin := (base.Account.Uin == 0 || len(base.Account.Password) == 0) && !base.Account.Encrypt
|
isQRCodeLogin := (base.Account.Uin == 0 || len(base.Account.Password) == 0) && !base.Account.Encrypt
|
||||||
isTokenLogin := false
|
isTokenLogin := false
|
||||||
|
|
||||||
|
if isQRCodeLogin && cli.Device().Protocol != 2 {
|
||||||
|
log.Warn("当前协议不支持二维码登录, 请配置账号密码登录.")
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
// 加载本地版本信息, 一般是在上次登录时保存的
|
// 加载本地版本信息, 一般是在上次登录时保存的
|
||||||
versionFile := path.Join(global.VersionsPath, fmt.Sprint(int(cli.Device().Protocol))+".json")
|
versionFile := path.Join(global.VersionsPath, fmt.Sprint(int(cli.Device().Protocol))+".json")
|
||||||
if global.PathExists(versionFile) {
|
if global.PathExists(versionFile) {
|
||||||
|
2
go.mod
2
go.mod
@ -5,7 +5,7 @@ go 1.20
|
|||||||
require (
|
require (
|
||||||
github.com/FloatTech/sqlite v1.5.7
|
github.com/FloatTech/sqlite v1.5.7
|
||||||
github.com/Microsoft/go-winio v0.6.0
|
github.com/Microsoft/go-winio v0.6.0
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20230314181550-5e7ade149fff
|
github.com/Mrs4s/MiraiGo v0.0.0-20230317162854-fd83d24f6794
|
||||||
github.com/RomiChan/syncx v0.0.0-20221202055724-5f842c53020e
|
github.com/RomiChan/syncx v0.0.0-20221202055724-5f842c53020e
|
||||||
github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc
|
github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc
|
||||||
github.com/fumiama/go-base16384 v1.6.1
|
github.com/fumiama/go-base16384 v1.6.1
|
||||||
|
4
go.sum
4
go.sum
@ -4,8 +4,8 @@ github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b h1:tvciXWq2nuvTbFeJG
|
|||||||
github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
|
github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
|
||||||
github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg=
|
github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg=
|
||||||
github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE=
|
github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE=
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20230314181550-5e7ade149fff h1:VOc0uHpfTQde3c+1hdXbvuZiinF3bm3Qc7eNf6waonk=
|
github.com/Mrs4s/MiraiGo v0.0.0-20230317162854-fd83d24f6794 h1:V2hkbdJhTGX6tfwEsCg53rUCx/skTGBfwRMHB5/hy7E=
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20230314181550-5e7ade149fff/go.mod h1:mU3fBFU+7eO0kaGes7YRKtzIDtwIU84nSSwTV7NK2b0=
|
github.com/Mrs4s/MiraiGo v0.0.0-20230317162854-fd83d24f6794/go.mod h1:mU3fBFU+7eO0kaGes7YRKtzIDtwIU84nSSwTV7NK2b0=
|
||||||
github.com/RomiChan/protobuf v0.1.1-0.20230204044148-2ed269a2e54d h1:/Xuj3fIiMY2ls1TwvPKmaqQrtJsPY+c9s+0lOScVHd8=
|
github.com/RomiChan/protobuf v0.1.1-0.20230204044148-2ed269a2e54d h1:/Xuj3fIiMY2ls1TwvPKmaqQrtJsPY+c9s+0lOScVHd8=
|
||||||
github.com/RomiChan/protobuf v0.1.1-0.20230204044148-2ed269a2e54d/go.mod h1:2Ie+hdBFQpQFDHfeklgxoFmQRCE7O+KwFpISeXq7OwA=
|
github.com/RomiChan/protobuf v0.1.1-0.20230204044148-2ed269a2e54d/go.mod h1:2Ie+hdBFQpQFDHfeklgxoFmQRCE7O+KwFpISeXq7OwA=
|
||||||
github.com/RomiChan/syncx v0.0.0-20221202055724-5f842c53020e h1:wR3MXQ3VbUlPKOOUwLOYgh/QaJThBTYtsl673O3lqSA=
|
github.com/RomiChan/syncx v0.0.0-20221202055724-5f842c53020e h1:wR3MXQ3VbUlPKOOUwLOYgh/QaJThBTYtsl673O3lqSA=
|
||||||
|
Loading…
x
Reference in New Issue
Block a user