1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

client: fix electron qq url

This commit is contained in:
wdvxdr 2023-02-11 20:14:09 +08:00
parent 841fef387a
commit 481c830f56
11 changed files with 107 additions and 91 deletions

View File

@ -456,7 +456,7 @@ type NotOnlineImage struct {
FileId proto.Option[int32] `protobuf:"varint,23,opt"` FileId proto.Option[int32] `protobuf:"varint,23,opt"`
ShowLen proto.Option[int32] `protobuf:"varint,24,opt"` ShowLen proto.Option[int32] `protobuf:"varint,24,opt"`
DownloadLen proto.Option[int32] `protobuf:"varint,25,opt"` DownloadLen proto.Option[int32] `protobuf:"varint,25,opt"`
PbReserve []byte `protobuf:"bytes,29,opt"` PbReserve *NotOnlineImage_PbReserve `protobuf:"bytes,29,opt"`
} }
type NotOnlineFile struct { type NotOnlineFile struct {
@ -886,3 +886,9 @@ type ElemFlags2_Inst struct {
InstId proto.Option[uint32] `protobuf:"varint,2,opt"` InstId proto.Option[uint32] `protobuf:"varint,2,opt"`
_ [0]func() _ [0]func()
} }
// TODO: find this message
type NotOnlineImage_PbReserve struct {
Url proto.Option[string] `protobuf:"bytes,30,opt"`
_ [0]func()
}

View File

@ -455,7 +455,12 @@ message NotOnlineImage {
optional int32 fileId = 23; optional int32 fileId = 23;
optional int32 showLen = 24; optional int32 showLen = 24;
optional int32 downloadLen = 25; optional int32 downloadLen = 25;
optional bytes pbReserve = 29;
// TODO: find this message
message PbReserve {
optional string url = 30;
}
optional PbReserve pbReserve = 29;
} }
message NotOnlineFile { message NotOnlineFile {

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-golite. DO NOT EDIT. // Code generated by protoc-gen-golite. DO NOT EDIT.
// source: pb/oidb/oidb0xd79.proto // source: pb/oidb/oidb0xD79.proto
package oidb package oidb

View File

@ -153,7 +153,6 @@ func (e *FriendImageElement) Pack() []*msg.Elem {
PicMd5: e.Md5, PicMd5: e.Md5,
DownloadPath: proto.Some(e.ImageId), DownloadPath: proto.Some(e.ImageId),
Original: proto.Int32(1), Original: proto.Int32(1),
PbReserve: []byte{0x78, 0x02},
} }
if e.Flash { if e.Flash {

View File

@ -514,25 +514,31 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
return []IMessageElement{face} return []IMessageElement{face}
} }
if elem.NotOnlineImage != nil { if elem.NotOnlineImage != nil {
var img string img := elem.NotOnlineImage
if elem.NotOnlineImage.OrigUrl.Unwrap() != "" {
img = "https://c2cpicdw.qpic.cn" + elem.NotOnlineImage.OrigUrl.Unwrap() var url string
} else { switch {
img = "https://c2cpicdw.qpic.cn/offpic_new/0" case img.PbReserve != nil && img.PbReserve.Url.Unwrap() != "":
downloadPath := elem.NotOnlineImage.ResId.Unwrap() url = fmt.Sprintf("https://c2cpicdw.qpic.cn%s&spec=0&rf=naio", img.PbReserve.Url.Unwrap())
if elem.NotOnlineImage.DownloadPath.Unwrap() != "" { case img.OrigUrl.Unwrap() != "":
downloadPath = elem.NotOnlineImage.DownloadPath.Unwrap() url = "https://c2cpicdw.qpic.cn" + img.OrigUrl.Unwrap()
default:
url = "https://c2cpicdw.qpic.cn/offpic_new/0"
downloadPath := img.ResId.Unwrap()
if img.DownloadPath.Unwrap() != "" {
downloadPath = img.DownloadPath.Unwrap()
} }
if !strings.HasPrefix(downloadPath, "/") { if !strings.HasPrefix(downloadPath, "/") {
img += "/" url += "/"
} }
img += downloadPath + "/0?term=3" url += downloadPath + "/0?term=3"
} }
res = append(res, &FriendImageElement{ res = append(res, &FriendImageElement{
ImageId: elem.NotOnlineImage.FilePath.Unwrap(), ImageId: img.FilePath.Unwrap(),
Size: elem.NotOnlineImage.FileLen.Unwrap(), Size: img.FileLen.Unwrap(),
Url: img, Url: url,
Md5: elem.NotOnlineImage.PicMd5, Md5: img.PicMd5,
}) })
} }
if elem.QQWalletMsg != nil && elem.QQWalletMsg.AioBody != nil { if elem.QQWalletMsg != nil && elem.QQWalletMsg.AioBody != nil {