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"`
ShowLen proto.Option[int32] `protobuf:"varint,24,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 {
@ -886,3 +886,9 @@ type ElemFlags2_Inst struct {
InstId proto.Option[uint32] `protobuf:"varint,2,opt"`
_ [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 showLen = 24;
optional int32 downloadLen = 25;
optional bytes pbReserve = 29;
// TODO: find this message
message PbReserve {
optional string url = 30;
}
optional PbReserve pbReserve = 29;
}
message NotOnlineFile {

View File

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

View File

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

View File

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