diff --git a/go.mod b/go.mod index f4d210f..26a6803 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,9 @@ module github.com/duo/matrix-qq go 1.20 require ( - github.com/Mrs4s/MiraiGo v0.0.0-20230307172929-fee6c23736c1 + github.com/Mrs4s/MiraiGo v0.0.0-20230312172304-71e86b9b3dc4 github.com/antchfx/xmlquery v1.3.15 - github.com/gabriel-vasile/mimetype v1.4.1 + github.com/gabriel-vasile/mimetype v1.4.2 github.com/lib/pq v1.10.7 github.com/mattn/go-sqlite3 v1.14.16 github.com/tidwall/gjson v1.14.4 diff --git a/go.sum b/go.sum index d681589..c3d4320 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= -github.com/Mrs4s/MiraiGo v0.0.0-20230307172929-fee6c23736c1 h1:A3sBjwY0pSbXlN0PVDVwTZHrTNtT/tIyc9ZftockquI= -github.com/Mrs4s/MiraiGo v0.0.0-20230307172929-fee6c23736c1/go.mod h1:mU3fBFU+7eO0kaGes7YRKtzIDtwIU84nSSwTV7NK2b0= +github.com/Mrs4s/MiraiGo v0.0.0-20230312172304-71e86b9b3dc4 h1:eqpgTvnexYSBxNtCKWc8OJL3CtGSzvEBOTQ41ViKWqs= +github.com/Mrs4s/MiraiGo v0.0.0-20230312172304-71e86b9b3dc4/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/go.mod h1:2Ie+hdBFQpQFDHfeklgxoFmQRCE7O+KwFpISeXq7OwA= github.com/RomiChan/syncx v0.0.0-20221202055724-5f842c53020e h1:wR3MXQ3VbUlPKOOUwLOYgh/QaJThBTYtsl673O3lqSA= @@ -18,8 +18,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/fumiama/imgsz v0.0.2 h1:fAkC0FnIscdKOXwAxlyw3EUba5NzxZdSxGaq3Uyfxak= github.com/fumiama/imgsz v0.0.2/go.mod h1:dR71mI3I2O5u6+PCpd47M9TZptzP+39tRBcbdIkoqM4= -github.com/gabriel-vasile/mimetype v1.4.1 h1:TRWk7se+TOjCYgRth7+1/OYLNiRNIotknkFtf/dnN7Q= -github.com/gabriel-vasile/mimetype v1.4.1/go.mod h1:05Vi0w3Y9c/lNvJOdmIwvrrAhX3rYhfQQCaf9VJcv7M= +github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= +github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -88,7 +88,6 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= diff --git a/internal/user.go b/internal/user.go index b6effe6..844eafb 100644 --- a/internal/user.go +++ b/internal/user.go @@ -19,7 +19,7 @@ import ( "github.com/Mrs4s/MiraiGo/client" "github.com/Mrs4s/MiraiGo/message" - "github.com/Mrs4s/MiraiGo/warpper" + "github.com/Mrs4s/MiraiGo/wrapper" "maunium.net/go/mautrix" "maunium.net/go/mautrix/appservice" "maunium.net/go/mautrix/bridge" @@ -45,7 +45,7 @@ var ( ) func init() { - warpper.DandelionEnergy = energy + wrapper.DandelionEnergy = energy } type resyncQueueItem struct { @@ -1041,20 +1041,20 @@ func setClientProtocol(device *client.DeviceInfo, protocol int) { } } -func energy(id string, salt []byte) []byte { +func energy(uin uint64, id string, salt []byte) ([]byte, error) { // temporary solution response, err := Request{ Method: http.MethodPost, URL: "https://captcha.go-cqhttp.org/sdk/dandelion/energy", Header: map[string]string{"Content-Type": "application/x-www-form-urlencoded"}, - Body: bytes.NewReader([]byte(fmt.Sprintf("id=%s&salt=%s", id, hex.EncodeToString(salt)))), + Body: bytes.NewReader([]byte(fmt.Sprintf("uin=%v&id=%s&salt=%s", uin, id, hex.EncodeToString(salt)))), }.Bytes() if err != nil { - return nil + return nil, err } sign, err := hex.DecodeString(gjson.GetBytes(response, "result").String()) if err != nil { - return nil + return nil, err } - return sign + return sign, nil } diff --git a/main.go b/main.go index 55b5f27..f89a7e3 100644 --- a/main.go +++ b/main.go @@ -26,7 +26,7 @@ func main() { Name: "matrix-qq", URL: "https://github.com/duo/matrix-qq", Description: "A Matrix-QQ puppeting bridge.", - Version: "0.1.5", + Version: "0.1.6", ProtocolName: "QQ", CryptoPickleKey: "github.com/duo/matrix-qq",