Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: sync dev to master #2470

Merged
merged 21 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8ea182a
sync: master to dev (#2340)
fumiama Aug 1, 2023
ce119b7
Merge branch 'master' of https://github.com/Mrs4s/go-cqhttp into dev
fumiama Aug 1, 2023
ca20a3d
update deps
fumiama Aug 1, 2023
0714aac
fix: panic after -10005
fumiama Aug 1, 2023
94a3ff5
dowgrade mongo-driver to latest static
fumiama Aug 1, 2023
3b99a82
optimize(login): log打印
fumiama Aug 3, 2023
5db03c7
fix #2347: This mutex is not locked
fumiama Aug 4, 2023
977030e
Revert #2207 (#2397)
xiangxiangxiong9 Aug 23, 2023
da9f03f
fix #2368, which causes system lacked sufficient buffer space (#2372)
KomeiDiSanXian Aug 23, 2023
d85d697
Fix: SignServer TCP ping for custom port (#2353)
xiwangly2 Aug 23, 2023
f8354ec
修复TCP缓冲区不足问题;重构 qsign 签名服务对接部分;支持配置多个签名服务器 (#2389)
1umine Aug 27, 2023
79a194f
ci(chore): Fix stylings
github-actions[bot] Aug 27, 2023
fd6ef4a
optimize(qisgn): async operations
fumiama Aug 28, 2023
77b54fc
fix: nil pointer
fumiama Aug 29, 2023
417a0f2
fix: nil pointer
fumiama Aug 29, 2023
9e6d7b7
fix: nil pointer
fumiama Aug 29, 2023
f16d72f
!fixup: optimize(qisgn): async operations (#2415)
YumeMichi Aug 31, 2023
1c34643
fix nil pointer dereference caused by nil 'cs' (#2440)
1umine Oct 1, 2023
07214e3
尝试实现 #2421 (#2422)
xiangxiangxiong9 Oct 1, 2023
517d323
ci(chore): Fix stylings
github-actions[bot] Oct 1, 2023
bd785d3
尝试修复首次登录时容易出现 code -10005 和 packet timed out 的问题 (#2463)
1umine Oct 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
尝试修复首次登录时容易出现 code -10005 和 packet timed out 的问题 (#2463)
* try to fix: code -10005 and packet timed out (first login)
* 此问题猜测可能是成功登录前无法向服务器发送sso packet并获取结果。
  在有callback之前似乎没有出现这个问题,怀疑是这里的问题。
  等待 100s 后(以等待完成过滑块)再提交初始化包以尝试解决
* sign submit 内容改为仅在debug模式下打印

* impl #2455
* 在“群消息发送失败: 账号可能被风控”的时候提供group_id

* optimize: sign callback wait until online
* 等待至 bot 在线再发包,而不是简单地等待 100s
  • Loading branch information
1umine committed Oct 9, 2023
commit bd785d38948efaca9578d901e2cff46695a1c595
20 changes: 14 additions & 6 deletions cmd/gocq/qsign.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,15 @@ func energy(uin uint64, id string, _ string, salt []byte) ([]byte, error) {
// 提交回调 buffer
func signSubmit(uin string, cmd string, callbackID int64, buffer []byte, t string) {
buffStr := hex.EncodeToString(buffer)
tail := 64
endl := "..."
if len(buffStr) < tail {
tail = len(buffStr)
endl = "."
if base.Debug {
tail := 64
endl := "..."
if len(buffStr) < tail {
tail = len(buffStr)
endl = "."
}
log.Debugf("submit (%v): uin=%v, cmd=%v, callbackID=%v, buffer=%v%s", t, uin, cmd, callbackID, buffStr[:tail], endl)
}
log.Infof("submit (%v): uin=%v, cmd=%v, callbackID=%v, buffer=%v%s", t, uin, cmd, callbackID, buffStr[:tail], endl)

signServer, _, err := requestSignServer(
http.MethodGet,
Expand All @@ -208,6 +210,12 @@ func signSubmit(uin string, cmd string, callbackID int64, buffer []byte, t strin
// signCallback
// 刷新 token 和签名的回调
func signCallback(uin string, results []gjson.Result, t string) {
for { // 等待至在线
if cli.Online.Load() {
break
}
time.Sleep(1 * time.Second)
}
for _, result := range results {
cmd := result.Get("cmd").String()
callbackID := result.Get("callbackId").Int()
Expand Down
6 changes: 3 additions & 3 deletions coolq/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ func (bot *CQBot) CQSendGroupMessage(groupID int64, m gjson.Result, autoEscape b
} else {
str := m.String()
if str == "" {
log.Warn("群消息发送失败: 信息为空.")
log.Warnf("群 %v 消息发送失败: 信息为空.", groupID)
return Failed(100, "EMPTY_MSG_ERROR", "消息为空")
}
if autoEscape {
Expand Down Expand Up @@ -981,7 +981,7 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupID int64, m gjson.Result) globa
}
ret := bot.Client.SendGroupForwardMessage(groupID, fe)
if ret == nil || ret.Id == -1 {
log.Warnf("合并转发(群)消息发送失败: 账号可能被风控.")
log.Warnf("合并转发(群 %v)消息发送失败: 账号可能被风控.", groupID)
return Failed(100, "SEND_MSG_API_ERROR", "请参考 go-cqhttp 端输出")
}
mid := bot.InsertGroupMessage(ret, source)
Expand All @@ -1007,7 +1007,7 @@ func (bot *CQBot) CQSendPrivateForwardMessage(userID int64, m gjson.Result) glob
}
mid := bot.SendPrivateMessage(userID, 0, &message.SendingMessage{Elements: []message.IMessageElement{fe}})
if mid == -1 {
log.Warnf("合并转发(好友)消息发送失败: 账号可能被风控.")
log.Warnf("合并转发(好友 %v)消息发送失败: 账号可能被风控.", userID)
return Failed(100, "SEND_MSG_API_ERROR", "请参考 go-cqhttp 端输出")
}
log.Infof("发送好友 %v(%v) 的合并转发消息: %v (%v)", userID, userID, limitedString(m.String()), mid)
Expand Down
4 changes: 2 additions & 2 deletions coolq/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,14 @@ func (bot *CQBot) SendGroupMessage(groupID int64, m *message.SendingMessage) (in
newElem = append(newElem, e)
}
if len(newElem) == 0 {
log.Warnf("群消息发送失败: 消息为空.")
log.Warnf("群 %v 消息发送失败: 消息为空.", groupID)
return -1, errors.New("empty message")
}
m.Elements = newElem
bot.checkMedia(newElem, groupID)
ret := bot.Client.SendGroupMessage(groupID, m)
if ret == nil || ret.Id == -1 {
log.Warnf("群消息发送失败: 账号可能被风控.")
log.Warnf("群 %v 发送消息失败: 账号可能被风控.", groupID)
return -1, errors.New("send group message failed: blocked by server")
}
return bot.InsertGroupMessage(ret, source), nil
Expand Down
Loading