From 9b7f533603e85b8baf536229c9ff45dc72407b40 Mon Sep 17 00:00:00 2001 From: Mrs4s Date: Thu, 15 Oct 2020 10:54:26 +0800 Subject: [PATCH] fix skey refresh. --- client/client.go | 8 ++++++-- client/highway.go | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/client.go b/client/client.go index 751f38df..bf3a742f 100644 --- a/client/client.go +++ b/client/client.go @@ -877,12 +877,16 @@ func (c *QQClient) SolveFriendRequest(req *NewFriendRequest, accept bool) { _ = c.send(pkt) } -func (c *QQClient) getCookies() string { +func (c *QQClient) getSKey() string { if c.sigInfo.sKeyExpiredTime < time.Now().Unix() { c.Debug("skey expired. refresh...") _, _ = c.sendAndWait(c.buildRequestTgtgtNopicsigPacket()) } - return fmt.Sprintf("uin=o%d; skey=%s;", c.Uin, c.sigInfo.sKey) + return string(c.sigInfo.sKey) +} + +func (c *QQClient) getCookies() string { + return fmt.Sprintf("uin=o%d; skey=%s;", c.Uin, c.getSKey()) } func (c *QQClient) getCookiesWithDomain(domain string) string { diff --git a/client/highway.go b/client/highway.go index 2183c342..fe55ff15 100644 --- a/client/highway.go +++ b/client/highway.go @@ -85,7 +85,7 @@ func (c *QQClient) uploadGroupPtt(ip, port int32, updKey, fileKey, data, md5 []b func (c *QQClient) uploadGroupHeadPortrait(groupCode int64, img []byte) error { url := fmt.Sprintf( "http://htdata3.qq.com/cgi-bin/httpconn?htcmd=0x6ff0072&ver=5520&ukey=%v&range=0&uin=%v&seq=23&groupuin=%v&filetype=3&imagetype=5&userdata=0&subcmd=1&subver=101&clip=0_0_0_0&filesize=%v", - string(c.sigInfo.sKey), + c.getSKey(), c.Uin, groupCode, len(img),