1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00
This commit is contained in:
fumiama 2022-01-15 11:12:02 +08:00
commit 82a55321e5
4 changed files with 7 additions and 4 deletions

View File

@ -3,13 +3,13 @@ package client
import ( import (
"bytes" "bytes"
"encoding/hex" "encoding/hex"
"image"
"io" "io"
"math/rand" "math/rand"
"os" "os"
"strings" "strings"
"time" "time"
"github.com/fumiama/imgsz"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/Mrs4s/MiraiGo/binary" "github.com/Mrs4s/MiraiGo/binary"
@ -82,7 +82,7 @@ func (c *QQClient) UploadGroupImage(groupCode int64, img io.ReadSeeker) (*messag
return nil, errors.Wrap(err, "upload failed") return nil, errors.Wrap(err, "upload failed")
ok: ok:
_, _ = img.Seek(0, io.SeekStart) _, _ = img.Seek(0, io.SeekStart)
i, _, _ := image.DecodeConfig(img) i, _, _ := imgsz.DecodeSize(img)
var imageType int32 = 1000 var imageType int32 = 1000
_, _ = img.Seek(0, io.SeekStart) _, _ = img.Seek(0, io.SeekStart)
tmp := make([]byte, 4) tmp := make([]byte, 4)
@ -135,7 +135,7 @@ func (c *QQClient) UploadGroupImageByFile(groupCode int64, path string) (*messag
return nil, errors.Wrap(err, "upload failed") return nil, errors.Wrap(err, "upload failed")
ok: ok:
_, _ = img.Seek(0, io.SeekStart) _, _ = img.Seek(0, io.SeekStart)
i, _, _ := image.DecodeConfig(img) i, _, _ := imgsz.DecodeSize(img)
var imageType int32 = 1000 var imageType int32 = 1000
_, _ = img.Seek(0, io.SeekStart) _, _ = img.Seek(0, io.SeekStart)
tmp := make([]byte, 4) tmp := make([]byte, 4)

1
go.mod
View File

@ -4,6 +4,7 @@ go 1.17
require ( require (
github.com/RomiChan/protobuf v0.0.0-20211223055824-048df49a8956 github.com/RomiChan/protobuf v0.0.0-20211223055824-048df49a8956
github.com/fumiama/imgsz v0.0.2
github.com/klauspost/compress v1.13.6 github.com/klauspost/compress v1.13.6
github.com/pierrec/lz4/v4 v4.1.11 github.com/pierrec/lz4/v4 v4.1.11
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1

2
go.sum
View File

@ -3,6 +3,8 @@ github.com/RomiChan/protobuf v0.0.0-20211223055824-048df49a8956/go.mod h1:CKKOWC
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fumiama/imgsz v0.0.2 h1:fAkC0FnIscdKOXwAxlyw3EUba5NzxZdSxGaq3Uyfxak=
github.com/fumiama/imgsz v0.0.2/go.mod h1:dR71mI3I2O5u6+PCpd47M9TZptzP+39tRBcbdIkoqM4=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc=

View File

@ -4,7 +4,7 @@ import "github.com/Mrs4s/MiraiGo/binary"
func T545(imei []byte) []byte { func T545(imei []byte) []byte {
return binary.NewWriterF(func(w *binary.Writer) { return binary.NewWriterF(func(w *binary.Writer) {
w.WriteUInt16(0x108) w.WriteUInt16(0x545)
w.WriteBytesShort(imei) w.WriteBytesShort(imei)
}) })
} }