Skip to content

Commit

Permalink
Update MiraiGo
Browse files Browse the repository at this point in the history
  • Loading branch information
duo committed Mar 14, 2023
1 parent d3709a4 commit 918acf2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand All @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
14 changes: 7 additions & 7 deletions internal/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -45,7 +45,7 @@ var (
)

func init() {
warpper.DandelionEnergy = energy
wrapper.DandelionEnergy = energy
}

type resyncQueueItem struct {
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 918acf2

Please sign in to comment.