From 7605dc463565c248252c53aa4983b642ecde8c7c Mon Sep 17 00:00:00 2001 From: Mrs4s Date: Thu, 7 Jan 2021 23:57:45 +0800 Subject: [PATCH] feature short video upload & sending. --- client/builders.go | 26 - client/client.go | 9 - client/decoders.go | 13 - client/highway.go | 11 +- client/image.go | 2 +- client/pb/pttcenter/shortvideo.pb.go | 866 +++++++++++++++++++++++---- client/pb/pttcenter/shortvideo.proto | 49 ++ client/ptt.go | 174 +++++- message/elements.go | 12 +- message/pack.go | 30 + utils/sys.go | 41 ++ 11 files changed, 1035 insertions(+), 198 deletions(-) diff --git a/client/builders.go b/client/builders.go index 43077524..5c26da5a 100644 --- a/client/builders.go +++ b/client/builders.go @@ -16,7 +16,6 @@ import ( "github.com/Mrs4s/MiraiGo/client/pb/cmd0x352" "github.com/Mrs4s/MiraiGo/client/pb/msg" "github.com/Mrs4s/MiraiGo/client/pb/oidb" - "github.com/Mrs4s/MiraiGo/client/pb/pttcenter" "github.com/Mrs4s/MiraiGo/client/pb/structmsg" "github.com/Mrs4s/MiraiGo/message" "github.com/Mrs4s/MiraiGo/protocol/crypto" @@ -1010,31 +1009,6 @@ func (c *QQClient) buildImageOcrRequestPacket(url, md5 string, size, weight, hei return seq, packet } -// PttCenterSvr.ShortVideoDownReq -func (c *QQClient) buildPttShortVideoDownReqPacket(uuid, md5 []byte) (uint16, []byte) { - seq := c.nextSeq() - body := &pttcenter.ShortVideoReqBody{ - Cmd: 400, - Seq: int32(seq), - PttShortVideoDownloadReq: &pttcenter.ShortVideoDownloadReq{ - FromUin: c.Uin, - ToUin: c.Uin, - ChatType: 1, - ClientType: 7, - FileId: string(uuid), - GroupCode: 1, - FileMd5: md5, - BusinessType: 1, - FileType: 2, - DownType: 2, - SceneType: 2, - }, - } - payload, _ := proto.Marshal(body) - packet := packets.BuildUniPacket(c.Uin, seq, "PttCenterSvr.ShortVideoDownReq", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload) - return seq, packet -} - // LightAppSvc.mini_app_info.GetAppInfoById func (c *QQClient) buildAppInfoRequestPacket(id string) (uint16, []byte) { seq := c.nextSeq() diff --git a/client/client.go b/client/client.go index 2a6aacf4..4311c136 100644 --- a/client/client.go +++ b/client/client.go @@ -139,7 +139,6 @@ var decoders = map[string]func(*QQClient, uint16, []byte) (interface{}, error){ "OidbSvc.0xd79": decodeWordSegmentation, "OidbSvc.0x990": decodeTranslateResponse, "SummaryCard.ReqSummaryCard": decodeSummaryCardResponse, - "PttCenterSvr.ShortVideoDownReq": decodePttShortVideoDownResponse, "LightAppSvc.mini_app_info.GetAppInfoById": decodeAppInfoResponse, "PttCenterSvr.pb_pttCenter_CMD_REQ_APPLY_UPLOAD-500": decodePrivatePttStoreResponse, } @@ -421,14 +420,6 @@ func (c *QQClient) GetFriendList() (*FriendListResponse, error) { return r, nil } -func (c *QQClient) GetShortVideoUrl(uuid, md5 []byte) string { - i, err := c.sendAndWait(c.buildPttShortVideoDownReqPacket(uuid, md5)) - if err != nil { - return "" - } - return i.(string) -} - func (c *QQClient) SendPrivateMessage(target int64, m *message.SendingMessage) *message.PrivateMessage { mr := int32(rand.Uint32()) seq := c.nextFriendSeq() diff --git a/client/decoders.go b/client/decoders.go index 834ee50c..2d241511 100644 --- a/client/decoders.go +++ b/client/decoders.go @@ -12,7 +12,6 @@ import ( "time" "github.com/Mrs4s/MiraiGo/client/pb/notify" - "github.com/Mrs4s/MiraiGo/client/pb/pttcenter" "github.com/Mrs4s/MiraiGo/client/pb/qweb" "github.com/pkg/errors" @@ -992,18 +991,6 @@ func decodeImageOcrResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, }, nil } -// PttCenterSvr.ShortVideoDownReq -func decodePttShortVideoDownResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) { - rsp := pttcenter.ShortVideoRspBody{} - if err := proto.Unmarshal(payload, &rsp); err != nil { - return nil, errors.Wrap(err, "failed to unmarshal protobuf message") - } - if rsp.PttShortVideoDownloadRsp == nil || rsp.PttShortVideoDownloadRsp.DownloadAddr == nil { - return nil, errors.New("resp error") - } - return rsp.PttShortVideoDownloadRsp.DownloadAddr.Host[0] + rsp.PttShortVideoDownloadRsp.DownloadAddr.UrlArgs, nil -} - // LightAppSvc.mini_app_info.GetAppInfoById func decodeAppInfoResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) { pkg := qweb.QWebRsp{} diff --git a/client/highway.go b/client/highway.go index 3be5d630..b733e754 100644 --- a/client/highway.go +++ b/client/highway.go @@ -97,11 +97,16 @@ func (c *QQClient) highwayUploadStream(ip uint32, port int, updKey []byte, strea return nil } -func (c *QQClient) highwayUploadByBDH(stream io.ReadSeeker, cmdId int32, ticket, ext []byte) ([]byte, error) { - // TODO: encrypted upload support. +func (c *QQClient) highwayUploadByBDH(stream io.ReadSeeker, cmdId int32, ticket, ext []byte, encrypt bool) ([]byte, error) { if len(c.srvSsoAddrs) == 0 { return nil, errors.New("srv addrs not found. maybe miss some packet?") } + if encrypt { + if c.highwaySession == nil || len(c.highwaySession.SessionKey) == 0 { + return nil, errors.New("session key not found. maybe miss some packet?") + } + ext = binary.NewTeaCipher(c.highwaySession.SessionKey).Encrypt(ext) + } h := md5.New() length, _ := io.Copy(h, stream) fh := h.Sum(nil) @@ -194,7 +199,7 @@ func (c *QQClient) highwayUploadFileMultiThreadingByBDH(path string, cmdId int32 return nil, errors.Wrap(err, "open file error") } if stat.Size() < 1024*1024*3 { - return c.highwayUploadByBDH(file, cmdId, ticket, ext) + return c.highwayUploadByBDH(file, cmdId, ticket, ext, false) } type BlockMetaData struct { Id int diff --git a/client/image.go b/client/image.go index c9593417..f5e9ebd7 100644 --- a/client/image.go +++ b/client/image.go @@ -44,7 +44,7 @@ func (c *QQClient) UploadGroupImage(groupCode int64, img io.ReadSeeker) (*messag c.srvSsoAddrs = append(c.srvSsoAddrs, fmt.Sprintf("%v:%v", binary.UInt32ToIPV4Address(uint32(addr)), rsp.UploadPort[i])) } } - if _, err = c.highwayUploadByBDH(img, 2, rsp.UploadKey, EmptyBytes); err == nil { + if _, err = c.highwayUploadByBDH(img, 2, rsp.UploadKey, EmptyBytes, true); err == nil { goto ok } return nil, errors.New("upload failed") diff --git a/client/pb/pttcenter/shortvideo.pb.go b/client/pb/pttcenter/shortvideo.pb.go index 911eb516..912bca96 100644 --- a/client/pb/pttcenter/shortvideo.pb.go +++ b/client/pb/pttcenter/shortvideo.pb.go @@ -30,9 +30,11 @@ type ShortVideoReqBody struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Cmd int32 `protobuf:"varint,1,opt,name=cmd,proto3" json:"cmd,omitempty"` - Seq int32 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` - PttShortVideoDownloadReq *ShortVideoDownloadReq `protobuf:"bytes,4,opt,name=pttShortVideoDownloadReq,proto3" json:"pttShortVideoDownloadReq,omitempty"` + Cmd int32 `protobuf:"varint,1,opt,name=cmd,proto3" json:"cmd,omitempty"` + Seq int32 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` + PttShortVideoUploadReq *ShortVideoUploadReq `protobuf:"bytes,3,opt,name=pttShortVideoUploadReq,proto3" json:"pttShortVideoUploadReq,omitempty"` + PttShortVideoDownloadReq *ShortVideoDownloadReq `protobuf:"bytes,4,opt,name=pttShortVideoDownloadReq,proto3" json:"pttShortVideoDownloadReq,omitempty"` + ExtensionReq []*ShortVideoExtensionReq `protobuf:"bytes,100,rep,name=extensionReq,proto3" json:"extensionReq,omitempty"` } func (x *ShortVideoReqBody) Reset() { @@ -81,6 +83,13 @@ func (x *ShortVideoReqBody) GetSeq() int32 { return 0 } +func (x *ShortVideoReqBody) GetPttShortVideoUploadReq() *ShortVideoUploadReq { + if x != nil { + return x.PttShortVideoUploadReq + } + return nil +} + func (x *ShortVideoReqBody) GetPttShortVideoDownloadReq() *ShortVideoDownloadReq { if x != nil { return x.PttShortVideoDownloadReq @@ -88,6 +97,13 @@ func (x *ShortVideoReqBody) GetPttShortVideoDownloadReq() *ShortVideoDownloadReq return nil } +func (x *ShortVideoReqBody) GetExtensionReq() []*ShortVideoExtensionReq { + if x != nil { + return x.ExtensionReq + } + return nil +} + type ShortVideoRspBody struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -95,6 +111,7 @@ type ShortVideoRspBody struct { Cmd int32 `protobuf:"varint,1,opt,name=cmd,proto3" json:"cmd,omitempty"` Seq int32 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` + PttShortVideoUploadRsp *ShortVideoUploadRsp `protobuf:"bytes,3,opt,name=pttShortVideoUploadRsp,proto3" json:"pttShortVideoUploadRsp,omitempty"` PttShortVideoDownloadRsp *ShortVideoDownloadRsp `protobuf:"bytes,4,opt,name=pttShortVideoDownloadRsp,proto3" json:"pttShortVideoDownloadRsp,omitempty"` } @@ -144,6 +161,13 @@ func (x *ShortVideoRspBody) GetSeq() int32 { return 0 } +func (x *ShortVideoRspBody) GetPttShortVideoUploadRsp() *ShortVideoUploadRsp { + if x != nil { + return x.PttShortVideoUploadRsp + } + return nil +} + func (x *ShortVideoRspBody) GetPttShortVideoDownloadRsp() *ShortVideoDownloadRsp { if x != nil { return x.PttShortVideoDownloadRsp @@ -151,6 +175,117 @@ func (x *ShortVideoRspBody) GetPttShortVideoDownloadRsp() *ShortVideoDownloadRsp return nil } +type ShortVideoUploadReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FromUin int64 `protobuf:"varint,1,opt,name=fromUin,proto3" json:"fromUin,omitempty"` + ToUin int64 `protobuf:"varint,2,opt,name=toUin,proto3" json:"toUin,omitempty"` + ChatType int32 `protobuf:"varint,3,opt,name=chatType,proto3" json:"chatType,omitempty"` + ClientType int32 `protobuf:"varint,4,opt,name=clientType,proto3" json:"clientType,omitempty"` + Info *ShortVideoFileInfo `protobuf:"bytes,5,opt,name=info,proto3" json:"info,omitempty"` + GroupCode int64 `protobuf:"varint,6,opt,name=groupCode,proto3" json:"groupCode,omitempty"` + AgentType int32 `protobuf:"varint,7,opt,name=agentType,proto3" json:"agentType,omitempty"` + BusinessType int32 `protobuf:"varint,8,opt,name=businessType,proto3" json:"businessType,omitempty"` + SupportLargeSize int32 `protobuf:"varint,20,opt,name=supportLargeSize,proto3" json:"supportLargeSize,omitempty"` +} + +func (x *ShortVideoUploadReq) Reset() { + *x = ShortVideoUploadReq{} + if protoimpl.UnsafeEnabled { + mi := &file_shortvideo_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ShortVideoUploadReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShortVideoUploadReq) ProtoMessage() {} + +func (x *ShortVideoUploadReq) ProtoReflect() protoreflect.Message { + mi := &file_shortvideo_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ShortVideoUploadReq.ProtoReflect.Descriptor instead. +func (*ShortVideoUploadReq) Descriptor() ([]byte, []int) { + return file_shortvideo_proto_rawDescGZIP(), []int{2} +} + +func (x *ShortVideoUploadReq) GetFromUin() int64 { + if x != nil { + return x.FromUin + } + return 0 +} + +func (x *ShortVideoUploadReq) GetToUin() int64 { + if x != nil { + return x.ToUin + } + return 0 +} + +func (x *ShortVideoUploadReq) GetChatType() int32 { + if x != nil { + return x.ChatType + } + return 0 +} + +func (x *ShortVideoUploadReq) GetClientType() int32 { + if x != nil { + return x.ClientType + } + return 0 +} + +func (x *ShortVideoUploadReq) GetInfo() *ShortVideoFileInfo { + if x != nil { + return x.Info + } + return nil +} + +func (x *ShortVideoUploadReq) GetGroupCode() int64 { + if x != nil { + return x.GroupCode + } + return 0 +} + +func (x *ShortVideoUploadReq) GetAgentType() int32 { + if x != nil { + return x.AgentType + } + return 0 +} + +func (x *ShortVideoUploadReq) GetBusinessType() int32 { + if x != nil { + return x.BusinessType + } + return 0 +} + +func (x *ShortVideoUploadReq) GetSupportLargeSize() int32 { + if x != nil { + return x.SupportLargeSize + } + return 0 +} + type ShortVideoDownloadReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -173,7 +308,7 @@ type ShortVideoDownloadReq struct { func (x *ShortVideoDownloadReq) Reset() { *x = ShortVideoDownloadReq{} if protoimpl.UnsafeEnabled { - mi := &file_shortvideo_proto_msgTypes[2] + mi := &file_shortvideo_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -186,7 +321,7 @@ func (x *ShortVideoDownloadReq) String() string { func (*ShortVideoDownloadReq) ProtoMessage() {} func (x *ShortVideoDownloadReq) ProtoReflect() protoreflect.Message { - mi := &file_shortvideo_proto_msgTypes[2] + mi := &file_shortvideo_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -199,7 +334,7 @@ func (x *ShortVideoDownloadReq) ProtoReflect() protoreflect.Message { // Deprecated: Use ShortVideoDownloadReq.ProtoReflect.Descriptor instead. func (*ShortVideoDownloadReq) Descriptor() ([]byte, []int) { - return file_shortvideo_proto_rawDescGZIP(), []int{2} + return file_shortvideo_proto_rawDescGZIP(), []int{3} } func (x *ShortVideoDownloadReq) GetFromUin() int64 { @@ -306,7 +441,7 @@ type ShortVideoDownloadRsp struct { func (x *ShortVideoDownloadRsp) Reset() { *x = ShortVideoDownloadRsp{} if protoimpl.UnsafeEnabled { - mi := &file_shortvideo_proto_msgTypes[3] + mi := &file_shortvideo_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -319,7 +454,7 @@ func (x *ShortVideoDownloadRsp) String() string { func (*ShortVideoDownloadRsp) ProtoMessage() {} func (x *ShortVideoDownloadRsp) ProtoReflect() protoreflect.Message { - mi := &file_shortvideo_proto_msgTypes[3] + mi := &file_shortvideo_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -332,7 +467,7 @@ func (x *ShortVideoDownloadRsp) ProtoReflect() protoreflect.Message { // Deprecated: Use ShortVideoDownloadRsp.ProtoReflect.Descriptor instead. func (*ShortVideoDownloadRsp) Descriptor() ([]byte, []int) { - return file_shortvideo_proto_rawDescGZIP(), []int{3} + return file_shortvideo_proto_rawDescGZIP(), []int{4} } func (x *ShortVideoDownloadRsp) GetRetCode() int32 { @@ -405,6 +540,291 @@ func (x *ShortVideoDownloadRsp) GetEncryptKey() []byte { return nil } +type ShortVideoUploadRsp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RetCode int32 `protobuf:"varint,1,opt,name=retCode,proto3" json:"retCode,omitempty"` + RetMsg string `protobuf:"bytes,2,opt,name=retMsg,proto3" json:"retMsg,omitempty"` + SameAreaOutAddr []*ShortVideoIpList `protobuf:"bytes,3,rep,name=sameAreaOutAddr,proto3" json:"sameAreaOutAddr,omitempty"` + DiffAreaOutAddr []*ShortVideoIpList `protobuf:"bytes,4,rep,name=diffAreaOutAddr,proto3" json:"diffAreaOutAddr,omitempty"` + FileId string `protobuf:"bytes,5,opt,name=fileId,proto3" json:"fileId,omitempty"` + UKey []byte `protobuf:"bytes,6,opt,name=uKey,proto3" json:"uKey,omitempty"` + FileExists int32 `protobuf:"varint,7,opt,name=fileExists,proto3" json:"fileExists,omitempty"` + SameAreaInnerAddr []*ShortVideoIpList `protobuf:"bytes,8,rep,name=sameAreaInnerAddr,proto3" json:"sameAreaInnerAddr,omitempty"` + DiffAreaInnerAddr []*ShortVideoIpList `protobuf:"bytes,9,rep,name=diffAreaInnerAddr,proto3" json:"diffAreaInnerAddr,omitempty"` + DataHole []*DataHole `protobuf:"bytes,10,rep,name=dataHole,proto3" json:"dataHole,omitempty"` +} + +func (x *ShortVideoUploadRsp) Reset() { + *x = ShortVideoUploadRsp{} + if protoimpl.UnsafeEnabled { + mi := &file_shortvideo_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ShortVideoUploadRsp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShortVideoUploadRsp) ProtoMessage() {} + +func (x *ShortVideoUploadRsp) ProtoReflect() protoreflect.Message { + mi := &file_shortvideo_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ShortVideoUploadRsp.ProtoReflect.Descriptor instead. +func (*ShortVideoUploadRsp) Descriptor() ([]byte, []int) { + return file_shortvideo_proto_rawDescGZIP(), []int{5} +} + +func (x *ShortVideoUploadRsp) GetRetCode() int32 { + if x != nil { + return x.RetCode + } + return 0 +} + +func (x *ShortVideoUploadRsp) GetRetMsg() string { + if x != nil { + return x.RetMsg + } + return "" +} + +func (x *ShortVideoUploadRsp) GetSameAreaOutAddr() []*ShortVideoIpList { + if x != nil { + return x.SameAreaOutAddr + } + return nil +} + +func (x *ShortVideoUploadRsp) GetDiffAreaOutAddr() []*ShortVideoIpList { + if x != nil { + return x.DiffAreaOutAddr + } + return nil +} + +func (x *ShortVideoUploadRsp) GetFileId() string { + if x != nil { + return x.FileId + } + return "" +} + +func (x *ShortVideoUploadRsp) GetUKey() []byte { + if x != nil { + return x.UKey + } + return nil +} + +func (x *ShortVideoUploadRsp) GetFileExists() int32 { + if x != nil { + return x.FileExists + } + return 0 +} + +func (x *ShortVideoUploadRsp) GetSameAreaInnerAddr() []*ShortVideoIpList { + if x != nil { + return x.SameAreaInnerAddr + } + return nil +} + +func (x *ShortVideoUploadRsp) GetDiffAreaInnerAddr() []*ShortVideoIpList { + if x != nil { + return x.DiffAreaInnerAddr + } + return nil +} + +func (x *ShortVideoUploadRsp) GetDataHole() []*DataHole { + if x != nil { + return x.DataHole + } + return nil +} + +type ShortVideoFileInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileName string `protobuf:"bytes,1,opt,name=fileName,proto3" json:"fileName,omitempty"` + FileMd5 []byte `protobuf:"bytes,2,opt,name=fileMd5,proto3" json:"fileMd5,omitempty"` + ThumbFileMd5 []byte `protobuf:"bytes,3,opt,name=thumbFileMd5,proto3" json:"thumbFileMd5,omitempty"` + FileSize int64 `protobuf:"varint,4,opt,name=fileSize,proto3" json:"fileSize,omitempty"` + FileResLength int32 `protobuf:"varint,5,opt,name=fileResLength,proto3" json:"fileResLength,omitempty"` + FileResWidth int32 `protobuf:"varint,6,opt,name=fileResWidth,proto3" json:"fileResWidth,omitempty"` + FileFormat int32 `protobuf:"varint,7,opt,name=fileFormat,proto3" json:"fileFormat,omitempty"` + FileTime int32 `protobuf:"varint,8,opt,name=fileTime,proto3" json:"fileTime,omitempty"` + ThumbFileSize int64 `protobuf:"varint,9,opt,name=thumbFileSize,proto3" json:"thumbFileSize,omitempty"` +} + +func (x *ShortVideoFileInfo) Reset() { + *x = ShortVideoFileInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_shortvideo_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ShortVideoFileInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShortVideoFileInfo) ProtoMessage() {} + +func (x *ShortVideoFileInfo) ProtoReflect() protoreflect.Message { + mi := &file_shortvideo_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ShortVideoFileInfo.ProtoReflect.Descriptor instead. +func (*ShortVideoFileInfo) Descriptor() ([]byte, []int) { + return file_shortvideo_proto_rawDescGZIP(), []int{6} +} + +func (x *ShortVideoFileInfo) GetFileName() string { + if x != nil { + return x.FileName + } + return "" +} + +func (x *ShortVideoFileInfo) GetFileMd5() []byte { + if x != nil { + return x.FileMd5 + } + return nil +} + +func (x *ShortVideoFileInfo) GetThumbFileMd5() []byte { + if x != nil { + return x.ThumbFileMd5 + } + return nil +} + +func (x *ShortVideoFileInfo) GetFileSize() int64 { + if x != nil { + return x.FileSize + } + return 0 +} + +func (x *ShortVideoFileInfo) GetFileResLength() int32 { + if x != nil { + return x.FileResLength + } + return 0 +} + +func (x *ShortVideoFileInfo) GetFileResWidth() int32 { + if x != nil { + return x.FileResWidth + } + return 0 +} + +func (x *ShortVideoFileInfo) GetFileFormat() int32 { + if x != nil { + return x.FileFormat + } + return 0 +} + +func (x *ShortVideoFileInfo) GetFileTime() int32 { + if x != nil { + return x.FileTime + } + return 0 +} + +func (x *ShortVideoFileInfo) GetThumbFileSize() int64 { + if x != nil { + return x.ThumbFileSize + } + return 0 +} + +type DataHole struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Begin int64 `protobuf:"varint,1,opt,name=begin,proto3" json:"begin,omitempty"` + End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` +} + +func (x *DataHole) Reset() { + *x = DataHole{} + if protoimpl.UnsafeEnabled { + mi := &file_shortvideo_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DataHole) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataHole) ProtoMessage() {} + +func (x *DataHole) ProtoReflect() protoreflect.Message { + mi := &file_shortvideo_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DataHole.ProtoReflect.Descriptor instead. +func (*DataHole) Descriptor() ([]byte, []int) { + return file_shortvideo_proto_rawDescGZIP(), []int{7} +} + +func (x *DataHole) GetBegin() int64 { + if x != nil { + return x.Begin + } + return 0 +} + +func (x *DataHole) GetEnd() int64 { + if x != nil { + return x.End + } + return 0 +} + type ShortVideoIpList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -417,7 +837,7 @@ type ShortVideoIpList struct { func (x *ShortVideoIpList) Reset() { *x = ShortVideoIpList{} if protoimpl.UnsafeEnabled { - mi := &file_shortvideo_proto_msgTypes[4] + mi := &file_shortvideo_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -430,7 +850,7 @@ func (x *ShortVideoIpList) String() string { func (*ShortVideoIpList) ProtoMessage() {} func (x *ShortVideoIpList) ProtoReflect() protoreflect.Message { - mi := &file_shortvideo_proto_msgTypes[4] + mi := &file_shortvideo_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -443,7 +863,7 @@ func (x *ShortVideoIpList) ProtoReflect() protoreflect.Message { // Deprecated: Use ShortVideoIpList.ProtoReflect.Descriptor instead. func (*ShortVideoIpList) Descriptor() ([]byte, []int) { - return file_shortvideo_proto_rawDescGZIP(), []int{4} + return file_shortvideo_proto_rawDescGZIP(), []int{8} } func (x *ShortVideoIpList) GetIp() int32 { @@ -472,7 +892,7 @@ type ShortVideoAddr struct { func (x *ShortVideoAddr) Reset() { *x = ShortVideoAddr{} if protoimpl.UnsafeEnabled { - mi := &file_shortvideo_proto_msgTypes[5] + mi := &file_shortvideo_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -485,7 +905,7 @@ func (x *ShortVideoAddr) String() string { func (*ShortVideoAddr) ProtoMessage() {} func (x *ShortVideoAddr) ProtoReflect() protoreflect.Message { - mi := &file_shortvideo_proto_msgTypes[5] + mi := &file_shortvideo_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -498,7 +918,7 @@ func (x *ShortVideoAddr) ProtoReflect() protoreflect.Message { // Deprecated: Use ShortVideoAddr.ProtoReflect.Descriptor instead. func (*ShortVideoAddr) Descriptor() ([]byte, []int) { - return file_shortvideo_proto_rawDescGZIP(), []int{5} + return file_shortvideo_proto_rawDescGZIP(), []int{9} } func (x *ShortVideoAddr) GetHost() []string { @@ -515,90 +935,234 @@ func (x *ShortVideoAddr) GetUrlArgs() string { return "" } +type ShortVideoExtensionReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SubBusiType int32 `protobuf:"varint,1,opt,name=subBusiType,proto3" json:"subBusiType,omitempty"` + UserCnt int32 `protobuf:"varint,2,opt,name=userCnt,proto3" json:"userCnt,omitempty"` +} + +func (x *ShortVideoExtensionReq) Reset() { + *x = ShortVideoExtensionReq{} + if protoimpl.UnsafeEnabled { + mi := &file_shortvideo_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ShortVideoExtensionReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShortVideoExtensionReq) ProtoMessage() {} + +func (x *ShortVideoExtensionReq) ProtoReflect() protoreflect.Message { + mi := &file_shortvideo_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ShortVideoExtensionReq.ProtoReflect.Descriptor instead. +func (*ShortVideoExtensionReq) Descriptor() ([]byte, []int) { + return file_shortvideo_proto_rawDescGZIP(), []int{10} +} + +func (x *ShortVideoExtensionReq) GetSubBusiType() int32 { + if x != nil { + return x.SubBusiType + } + return 0 +} + +func (x *ShortVideoExtensionReq) GetUserCnt() int32 { + if x != nil { + return x.UserCnt + } + return 0 +} + var File_shortvideo_proto protoreflect.FileDescriptor var file_shortvideo_proto_rawDesc = []byte{ 0x0a, 0x10, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x8b, 0x01, 0x0a, 0x11, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, + 0x74, 0x6f, 0x22, 0x96, 0x02, 0x0a, 0x11, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x52, 0x65, 0x71, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, - 0x71, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x65, 0x71, 0x12, 0x52, 0x0a, 0x18, - 0x70, 0x74, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x44, 0x6f, 0x77, - 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, - 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x44, 0x6f, 0x77, 0x6e, 0x6c, - 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x52, 0x18, 0x70, 0x74, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, - 0x22, 0x8b, 0x01, 0x0a, 0x11, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x52, - 0x73, 0x70, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x65, 0x71, 0x12, 0x52, 0x0a, 0x18, 0x70, 0x74, + 0x71, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x65, 0x71, 0x12, 0x4c, 0x0a, 0x16, + 0x70, 0x74, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x55, 0x70, 0x6c, + 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x53, + 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, + 0x65, 0x71, 0x52, 0x16, 0x70, 0x74, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, + 0x6f, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x12, 0x52, 0x0a, 0x18, 0x70, 0x74, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x44, 0x6f, 0x77, 0x6e, 0x6c, - 0x6f, 0x61, 0x64, 0x52, 0x73, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x53, + 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, - 0x64, 0x52, 0x73, 0x70, 0x52, 0x18, 0x70, 0x74, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, - 0x64, 0x65, 0x6f, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x73, 0x70, 0x22, 0xeb, - 0x02, 0x0a, 0x15, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x44, 0x6f, 0x77, - 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x72, 0x6f, 0x6d, - 0x55, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x66, 0x72, 0x6f, 0x6d, 0x55, - 0x69, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x55, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x05, 0x74, 0x6f, 0x55, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x68, 0x61, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x67, - 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x61, - 0x67, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x65, - 0x4d, 0x64, 0x35, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x4d, - 0x64, 0x35, 0x12, 0x22, 0x0a, 0x0c, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, - 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x09, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0xd6, 0x03, 0x0a, - 0x15, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x44, 0x6f, 0x77, 0x6e, 0x6c, - 0x6f, 0x61, 0x64, 0x52, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x43, 0x6f, 0x64, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, - 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x74, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x72, 0x65, 0x74, 0x4d, 0x73, 0x67, 0x12, 0x3b, 0x0a, 0x0f, 0x73, 0x61, 0x6d, 0x65, - 0x41, 0x72, 0x65, 0x61, 0x4f, 0x75, 0x74, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x11, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x49, 0x70, - 0x4c, 0x69, 0x73, 0x74, 0x52, 0x0f, 0x73, 0x61, 0x6d, 0x65, 0x41, 0x72, 0x65, 0x61, 0x4f, 0x75, - 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, 0x3b, 0x0a, 0x0f, 0x64, 0x69, 0x66, 0x66, 0x41, 0x72, 0x65, - 0x61, 0x4f, 0x75, 0x74, 0x41, 0x64, 0x64, 0x72, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, - 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x49, 0x70, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x0f, 0x64, 0x69, 0x66, 0x66, 0x41, 0x72, 0x65, 0x61, 0x4f, 0x75, 0x74, 0x41, 0x64, - 0x64, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x4b, 0x65, - 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, - 0x64, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x4d, 0x64, 0x35, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x4d, 0x64, 0x35, 0x12, 0x3f, - 0x0a, 0x11, 0x73, 0x61, 0x6d, 0x65, 0x41, 0x72, 0x65, 0x61, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x41, - 0x64, 0x64, 0x72, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x53, 0x68, 0x6f, 0x72, - 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x11, 0x73, 0x61, - 0x6d, 0x65, 0x41, 0x72, 0x65, 0x61, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, - 0x3f, 0x0a, 0x11, 0x64, 0x69, 0x66, 0x66, 0x41, 0x72, 0x65, 0x61, 0x49, 0x6e, 0x6e, 0x65, 0x72, - 0x41, 0x64, 0x64, 0x72, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x53, 0x68, 0x6f, - 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x11, 0x64, - 0x69, 0x66, 0x66, 0x41, 0x72, 0x65, 0x61, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, - 0x12, 0x33, 0x0a, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x64, 0x64, 0x72, - 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, - 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x52, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, - 0x64, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, - 0x4b, 0x65, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x65, 0x6e, 0x63, 0x72, 0x79, - 0x70, 0x74, 0x4b, 0x65, 0x79, 0x22, 0x36, 0x0a, 0x10, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, - 0x64, 0x65, 0x6f, 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x3e, 0x0a, - 0x0e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x12, - 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x68, - 0x6f, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x72, 0x6c, 0x41, 0x72, 0x67, 0x73, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x72, 0x6c, 0x41, 0x72, 0x67, 0x73, 0x42, 0x0d, 0x5a, - 0x0b, 0x2e, 0x3b, 0x70, 0x74, 0x74, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x52, 0x65, 0x71, 0x52, 0x18, 0x70, 0x74, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, + 0x64, 0x65, 0x6f, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x12, 0x3b, + 0x0a, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x18, 0x64, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, + 0x6f, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x52, 0x0c, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x22, 0xd9, 0x01, 0x0a, 0x11, + 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x52, 0x73, 0x70, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, + 0x63, 0x6d, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x03, 0x73, 0x65, 0x71, 0x12, 0x4c, 0x0a, 0x16, 0x70, 0x74, 0x74, 0x53, 0x68, 0x6f, 0x72, + 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x73, 0x70, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, + 0x65, 0x6f, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x73, 0x70, 0x52, 0x16, 0x70, 0x74, 0x74, + 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, + 0x52, 0x73, 0x70, 0x12, 0x52, 0x0a, 0x18, 0x70, 0x74, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, + 0x69, 0x64, 0x65, 0x6f, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x73, 0x70, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, + 0x65, 0x6f, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x73, 0x70, 0x52, 0x18, 0x70, + 0x74, 0x74, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x44, 0x6f, 0x77, 0x6e, + 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x73, 0x70, 0x22, 0xb6, 0x02, 0x0a, 0x13, 0x53, 0x68, 0x6f, 0x72, + 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x12, + 0x18, 0x0a, 0x07, 0x66, 0x72, 0x6f, 0x6d, 0x55, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x07, 0x66, 0x72, 0x6f, 0x6d, 0x55, 0x69, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x55, + 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x55, 0x69, 0x6e, 0x12, + 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x08, 0x63, 0x68, 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x27, 0x0a, 0x04, 0x69, + 0x6e, 0x66, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x53, 0x68, 0x6f, 0x72, + 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, + 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, 0x64, + 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, + 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x22, 0x0a, 0x0c, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x4c, + 0x61, 0x72, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, + 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, + 0x22, 0xeb, 0x02, 0x0a, 0x15, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x44, + 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x72, + 0x6f, 0x6d, 0x55, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x66, 0x72, 0x6f, + 0x6d, 0x55, 0x69, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x55, 0x69, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x55, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, + 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x68, + 0x61, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1c, + 0x0a, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, + 0x61, 0x67, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x09, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, + 0x6c, 0x65, 0x4d, 0x64, 0x35, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x66, 0x69, 0x6c, + 0x65, 0x4d, 0x64, 0x35, 0x12, 0x22, 0x0a, 0x0c, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, + 0x54, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x62, 0x75, 0x73, 0x69, + 0x6e, 0x65, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0c, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0xd6, + 0x03, 0x0a, 0x15, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x44, 0x6f, 0x77, + 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x43, + 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x74, 0x43, 0x6f, + 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x74, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x74, 0x4d, 0x73, 0x67, 0x12, 0x3b, 0x0a, 0x0f, 0x73, 0x61, + 0x6d, 0x65, 0x41, 0x72, 0x65, 0x61, 0x4f, 0x75, 0x74, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, + 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x0f, 0x73, 0x61, 0x6d, 0x65, 0x41, 0x72, 0x65, 0x61, + 0x4f, 0x75, 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, 0x3b, 0x0a, 0x0f, 0x64, 0x69, 0x66, 0x66, 0x41, + 0x72, 0x65, 0x61, 0x4f, 0x75, 0x74, 0x41, 0x64, 0x64, 0x72, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x49, 0x70, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x0f, 0x64, 0x69, 0x66, 0x66, 0x41, 0x72, 0x65, 0x61, 0x4f, 0x75, 0x74, + 0x41, 0x64, 0x64, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, + 0x4b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x64, 0x6f, 0x77, 0x6e, 0x6c, + 0x6f, 0x61, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x4d, 0x64, + 0x35, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x4d, 0x64, 0x35, + 0x12, 0x3f, 0x0a, 0x11, 0x73, 0x61, 0x6d, 0x65, 0x41, 0x72, 0x65, 0x61, 0x49, 0x6e, 0x6e, 0x65, + 0x72, 0x41, 0x64, 0x64, 0x72, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x53, 0x68, + 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x11, + 0x73, 0x61, 0x6d, 0x65, 0x41, 0x72, 0x65, 0x61, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, + 0x72, 0x12, 0x3f, 0x0a, 0x11, 0x64, 0x69, 0x66, 0x66, 0x41, 0x72, 0x65, 0x61, 0x49, 0x6e, 0x6e, + 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x53, + 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, + 0x11, 0x64, 0x69, 0x66, 0x66, 0x41, 0x72, 0x65, 0x61, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x41, 0x64, + 0x64, 0x72, 0x12, 0x33, 0x0a, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x64, + 0x64, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, + 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x52, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, + 0x6f, 0x61, 0x64, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x6e, 0x63, 0x72, 0x79, + 0x70, 0x74, 0x4b, 0x65, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x65, 0x6e, 0x63, + 0x72, 0x79, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x22, 0xb6, 0x03, 0x0a, 0x13, 0x53, 0x68, 0x6f, 0x72, + 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x73, 0x70, 0x12, + 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x07, 0x72, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x74, + 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x74, 0x4d, 0x73, + 0x67, 0x12, 0x3b, 0x0a, 0x0f, 0x73, 0x61, 0x6d, 0x65, 0x41, 0x72, 0x65, 0x61, 0x4f, 0x75, 0x74, + 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x53, 0x68, 0x6f, + 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x0f, 0x73, + 0x61, 0x6d, 0x65, 0x41, 0x72, 0x65, 0x61, 0x4f, 0x75, 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, 0x3b, + 0x0a, 0x0f, 0x64, 0x69, 0x66, 0x66, 0x41, 0x72, 0x65, 0x61, 0x4f, 0x75, 0x74, 0x41, 0x64, 0x64, + 0x72, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, + 0x69, 0x64, 0x65, 0x6f, 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x0f, 0x64, 0x69, 0x66, 0x66, + 0x41, 0x72, 0x65, 0x61, 0x4f, 0x75, 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x66, + 0x69, 0x6c, 0x65, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, + 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x4b, 0x65, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x04, 0x75, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x45, + 0x78, 0x69, 0x73, 0x74, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x66, 0x69, 0x6c, + 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x12, 0x3f, 0x0a, 0x11, 0x73, 0x61, 0x6d, 0x65, 0x41, + 0x72, 0x65, 0x61, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x18, 0x08, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x49, + 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x11, 0x73, 0x61, 0x6d, 0x65, 0x41, 0x72, 0x65, 0x61, 0x49, + 0x6e, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, 0x3f, 0x0a, 0x11, 0x64, 0x69, 0x66, 0x66, + 0x41, 0x72, 0x65, 0x61, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x18, 0x09, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, + 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x11, 0x64, 0x69, 0x66, 0x66, 0x41, 0x72, 0x65, 0x61, + 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, 0x25, 0x0a, 0x08, 0x64, 0x61, 0x74, + 0x61, 0x48, 0x6f, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x61, + 0x74, 0x61, 0x48, 0x6f, 0x6c, 0x65, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x48, 0x6f, 0x6c, 0x65, + 0x22, 0xb6, 0x02, 0x0a, 0x12, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x46, + 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x4d, 0x64, 0x35, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x4d, 0x64, 0x35, 0x12, 0x22, 0x0a, + 0x0c, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x64, 0x35, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x64, + 0x35, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x24, 0x0a, + 0x0d, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x4c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x12, 0x22, 0x0a, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x57, 0x69, + 0x64, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x52, + 0x65, 0x73, 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x46, + 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x66, 0x69, 0x6c, + 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x54, + 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x54, + 0x69, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x69, 0x7a, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x74, 0x68, 0x75, 0x6d, + 0x62, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x32, 0x0a, 0x08, 0x44, 0x61, 0x74, + 0x61, 0x48, 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x65, + 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x36, 0x0a, + 0x10, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x49, 0x70, 0x4c, 0x69, 0x73, + 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, + 0x70, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x04, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x3e, 0x0a, 0x0e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, + 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, + 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x75, + 0x72, 0x6c, 0x41, 0x72, 0x67, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x72, + 0x6c, 0x41, 0x72, 0x67, 0x73, 0x22, 0x54, 0x0a, 0x16, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x56, 0x69, + 0x64, 0x65, 0x6f, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, + 0x20, 0x0a, 0x0b, 0x73, 0x75, 0x62, 0x42, 0x75, 0x73, 0x69, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x42, 0x75, 0x73, 0x69, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x43, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x43, 0x6e, 0x74, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, + 0x3b, 0x70, 0x74, 0x74, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -613,28 +1177,42 @@ func file_shortvideo_proto_rawDescGZIP() []byte { return file_shortvideo_proto_rawDescData } -var file_shortvideo_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_shortvideo_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_shortvideo_proto_goTypes = []interface{}{ - (*ShortVideoReqBody)(nil), // 0: ShortVideoReqBody - (*ShortVideoRspBody)(nil), // 1: ShortVideoRspBody - (*ShortVideoDownloadReq)(nil), // 2: ShortVideoDownloadReq - (*ShortVideoDownloadRsp)(nil), // 3: ShortVideoDownloadRsp - (*ShortVideoIpList)(nil), // 4: ShortVideoIpList - (*ShortVideoAddr)(nil), // 5: ShortVideoAddr + (*ShortVideoReqBody)(nil), // 0: ShortVideoReqBody + (*ShortVideoRspBody)(nil), // 1: ShortVideoRspBody + (*ShortVideoUploadReq)(nil), // 2: ShortVideoUploadReq + (*ShortVideoDownloadReq)(nil), // 3: ShortVideoDownloadReq + (*ShortVideoDownloadRsp)(nil), // 4: ShortVideoDownloadRsp + (*ShortVideoUploadRsp)(nil), // 5: ShortVideoUploadRsp + (*ShortVideoFileInfo)(nil), // 6: ShortVideoFileInfo + (*DataHole)(nil), // 7: DataHole + (*ShortVideoIpList)(nil), // 8: ShortVideoIpList + (*ShortVideoAddr)(nil), // 9: ShortVideoAddr + (*ShortVideoExtensionReq)(nil), // 10: ShortVideoExtensionReq } var file_shortvideo_proto_depIdxs = []int32{ - 2, // 0: ShortVideoReqBody.pttShortVideoDownloadReq:type_name -> ShortVideoDownloadReq - 3, // 1: ShortVideoRspBody.pttShortVideoDownloadRsp:type_name -> ShortVideoDownloadRsp - 4, // 2: ShortVideoDownloadRsp.sameAreaOutAddr:type_name -> ShortVideoIpList - 4, // 3: ShortVideoDownloadRsp.diffAreaOutAddr:type_name -> ShortVideoIpList - 4, // 4: ShortVideoDownloadRsp.sameAreaInnerAddr:type_name -> ShortVideoIpList - 4, // 5: ShortVideoDownloadRsp.diffAreaInnerAddr:type_name -> ShortVideoIpList - 5, // 6: ShortVideoDownloadRsp.downloadAddr:type_name -> ShortVideoAddr - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 2, // 0: ShortVideoReqBody.pttShortVideoUploadReq:type_name -> ShortVideoUploadReq + 3, // 1: ShortVideoReqBody.pttShortVideoDownloadReq:type_name -> ShortVideoDownloadReq + 10, // 2: ShortVideoReqBody.extensionReq:type_name -> ShortVideoExtensionReq + 5, // 3: ShortVideoRspBody.pttShortVideoUploadRsp:type_name -> ShortVideoUploadRsp + 4, // 4: ShortVideoRspBody.pttShortVideoDownloadRsp:type_name -> ShortVideoDownloadRsp + 6, // 5: ShortVideoUploadReq.info:type_name -> ShortVideoFileInfo + 8, // 6: ShortVideoDownloadRsp.sameAreaOutAddr:type_name -> ShortVideoIpList + 8, // 7: ShortVideoDownloadRsp.diffAreaOutAddr:type_name -> ShortVideoIpList + 8, // 8: ShortVideoDownloadRsp.sameAreaInnerAddr:type_name -> ShortVideoIpList + 8, // 9: ShortVideoDownloadRsp.diffAreaInnerAddr:type_name -> ShortVideoIpList + 9, // 10: ShortVideoDownloadRsp.downloadAddr:type_name -> ShortVideoAddr + 8, // 11: ShortVideoUploadRsp.sameAreaOutAddr:type_name -> ShortVideoIpList + 8, // 12: ShortVideoUploadRsp.diffAreaOutAddr:type_name -> ShortVideoIpList + 8, // 13: ShortVideoUploadRsp.sameAreaInnerAddr:type_name -> ShortVideoIpList + 8, // 14: ShortVideoUploadRsp.diffAreaInnerAddr:type_name -> ShortVideoIpList + 7, // 15: ShortVideoUploadRsp.dataHole:type_name -> DataHole + 16, // [16:16] is the sub-list for method output_type + 16, // [16:16] is the sub-list for method input_type + 16, // [16:16] is the sub-list for extension type_name + 16, // [16:16] is the sub-list for extension extendee + 0, // [0:16] is the sub-list for field type_name } func init() { file_shortvideo_proto_init() } @@ -668,7 +1246,7 @@ func file_shortvideo_proto_init() { } } file_shortvideo_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ShortVideoDownloadReq); i { + switch v := v.(*ShortVideoUploadReq); i { case 0: return &v.state case 1: @@ -680,7 +1258,7 @@ func file_shortvideo_proto_init() { } } file_shortvideo_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ShortVideoDownloadRsp); i { + switch v := v.(*ShortVideoDownloadReq); i { case 0: return &v.state case 1: @@ -692,7 +1270,7 @@ func file_shortvideo_proto_init() { } } file_shortvideo_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ShortVideoIpList); i { + switch v := v.(*ShortVideoDownloadRsp); i { case 0: return &v.state case 1: @@ -704,6 +1282,54 @@ func file_shortvideo_proto_init() { } } file_shortvideo_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ShortVideoUploadRsp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shortvideo_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ShortVideoFileInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shortvideo_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DataHole); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shortvideo_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ShortVideoIpList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shortvideo_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ShortVideoAddr); i { case 0: return &v.state @@ -715,6 +1341,18 @@ func file_shortvideo_proto_init() { return nil } } + file_shortvideo_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ShortVideoExtensionReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -722,7 +1360,7 @@ func file_shortvideo_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_shortvideo_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 11, NumExtensions: 0, NumServices: 0, }, diff --git a/client/pb/pttcenter/shortvideo.proto b/client/pb/pttcenter/shortvideo.proto index 34794cb9..31387a02 100644 --- a/client/pb/pttcenter/shortvideo.proto +++ b/client/pb/pttcenter/shortvideo.proto @@ -5,15 +5,29 @@ option go_package = ".;pttcenter"; message ShortVideoReqBody { int32 cmd = 1; int32 seq = 2; + ShortVideoUploadReq pttShortVideoUploadReq = 3; ShortVideoDownloadReq pttShortVideoDownloadReq = 4; + repeated ShortVideoExtensionReq extensionReq = 100; } message ShortVideoRspBody { int32 cmd = 1; int32 seq = 2; + ShortVideoUploadRsp pttShortVideoUploadRsp = 3; ShortVideoDownloadRsp pttShortVideoDownloadRsp = 4; } +message ShortVideoUploadReq { + int64 fromUin = 1; + int64 toUin = 2; + int32 chatType = 3; + int32 clientType = 4; + ShortVideoFileInfo info = 5; + int64 groupCode = 6; + int32 agentType = 7; + int32 businessType = 8; + int32 supportLargeSize = 20; +} message ShortVideoDownloadReq { int64 fromUin = 1; int64 toUin = 2; @@ -42,6 +56,36 @@ message ShortVideoDownloadRsp { bytes encryptKey = 10; } +message ShortVideoUploadRsp { + int32 retCode = 1; + string retMsg = 2; + repeated ShortVideoIpList sameAreaOutAddr = 3; + repeated ShortVideoIpList diffAreaOutAddr = 4; + string fileId = 5; + bytes uKey = 6; + int32 fileExists = 7; + repeated ShortVideoIpList sameAreaInnerAddr = 8; + repeated ShortVideoIpList diffAreaInnerAddr = 9; + repeated DataHole dataHole = 10; +} + +message ShortVideoFileInfo { + string fileName = 1; + bytes fileMd5 = 2; + bytes thumbFileMd5 = 3; + int64 fileSize = 4; + int32 fileResLength = 5; + int32 fileResWidth = 6; + int32 fileFormat = 7; + int32 fileTime = 8; + int64 thumbFileSize = 9; +} + +message DataHole { + int64 begin = 1; + int64 end = 2; +} + message ShortVideoIpList { int32 ip = 1; int32 port = 2; @@ -51,4 +95,9 @@ message ShortVideoAddr { repeated string host = 10; string urlArgs = 11; //repeated string domain = 13; +} + +message ShortVideoExtensionReq { + int32 subBusiType = 1; + int32 userCnt = 2; } \ No newline at end of file diff --git a/client/ptt.go b/client/ptt.go index 49b60f3c..ac14e7a7 100644 --- a/client/ptt.go +++ b/client/ptt.go @@ -3,19 +3,23 @@ package client import ( "crypto/md5" "encoding/hex" - "io" - "github.com/Mrs4s/MiraiGo/binary" "github.com/Mrs4s/MiraiGo/client/pb" "github.com/Mrs4s/MiraiGo/client/pb/cmd0x346" "github.com/Mrs4s/MiraiGo/client/pb/msg" + "github.com/Mrs4s/MiraiGo/client/pb/pttcenter" "github.com/Mrs4s/MiraiGo/message" "github.com/Mrs4s/MiraiGo/protocol/packets" + "github.com/Mrs4s/MiraiGo/utils" "github.com/pkg/errors" "google.golang.org/protobuf/proto" + "io" ) -// 语音相关处理逻辑 +func init() { + decoders["PttCenterSvr.ShortVideoDownReq"] = decodePttShortVideoDownResponse + decoders["PttCenterSvr.GroupShortVideoUpReq"] = decodeGroupShortVideoUploadResponse +} // UploadGroupPtt 将语音数据使用群语音通道上传到服务器, 返回 message.GroupVoiceElement 可直接发送 func (c *QQClient) UploadGroupPtt(groupCode int64, voice io.ReadSeeker) (*message.GroupVoiceElement, error) { @@ -24,7 +28,7 @@ func (c *QQClient) UploadGroupPtt(groupCode int64, voice io.ReadSeeker) (*messag fh := h.Sum(nil) _, _ = voice.Seek(0, io.SeekStart) ext := c.buildGroupPttStoreBDHExt(groupCode, fh[:], int32(length), 0, int32(length)) - rsp, err := c.highwayUploadByBDH(voice, 29, c.highwaySession.SigSession, ext) + rsp, err := c.highwayUploadByBDH(voice, 29, c.highwaySession.SigSession, ext, false) if err != nil { return nil, err } @@ -38,29 +42,6 @@ func (c *QQClient) UploadGroupPtt(groupCode int64, voice io.ReadSeeker) (*messag if len(pkt.MsgTryUpPttRsp) == 0 { return nil, errors.New("miss try up rsp") } - /* - seq, pkt := c.buildGroupPttStorePacket(groupCode, h[:], int32(len(voice)), 0, int32(len(voice))) - r, err := c.sendAndWait(seq, pkt) - if err != nil { - return nil, err - } - rsp := r.(pttUploadResponse) - if rsp.ResultCode != 0 { - return nil, errors.New(rsp.Message) - } - if rsp.IsExists { - goto ok - } - for i, ip := range rsp.UploadIp { - err := c.uploadPtt(ip, rsp.UploadPort[i], rsp.UploadKey, rsp.FileKey, voice, h[:]) - if err != nil { - continue - } - goto ok - } - return nil, errors.New("upload failed") - ok: - */ return &message.GroupVoiceElement{ Ptt: &msg.Ptt{ FileType: proto.Int32(4), @@ -107,6 +88,52 @@ ok: }}, nil } +func (c *QQClient) UploadGroupShortVideo(groupCode int64, video, thumb io.ReadSeeker) (*message.ShortVideoElement, error) { + videoHash, videoLen := utils.GetMd5AndLength(video) + thumbHash, thumbLen := utils.GetMd5AndLength(thumb) + i, err := c.sendAndWait(c.buildPttGroupShortVideoUploadReqPacket(videoHash, thumbHash, groupCode, videoLen, thumbLen)) + if err != nil { + return nil, errors.Wrap(err, "upload req error") + } + rsp := i.(*pttcenter.ShortVideoUploadRsp) + if rsp.FileExists == 1 { + return &message.ShortVideoElement{ + Uuid: []byte(rsp.FileId), + Size: int32(videoLen), + ThumbSize: int32(thumbLen), + Md5: videoHash, + ThumbMd5: thumbHash, + }, nil + } + ext, _ := proto.Marshal(c.buildPttGroupShortVideoProto(videoHash, thumbHash, groupCode, videoLen, thumbLen).PttShortVideoUploadReq) + hwRsp, err := c.highwayUploadByBDH(utils.MultiReadSeeker(thumb, video), 25, c.highwaySession.SigSession, ext, true) + if err != nil { + return nil, errors.Wrap(err, "upload video file error") + } + if len(hwRsp) == 0 { + return nil, errors.New("resp is empty") + } + rsp = &pttcenter.ShortVideoUploadRsp{} + if err = proto.Unmarshal(hwRsp, rsp); err != nil { + return nil, errors.Wrap(err, "decode error") + } + return &message.ShortVideoElement{ + Uuid: []byte(rsp.FileId), + Size: int32(videoLen), + ThumbSize: int32(thumbLen), + Md5: videoHash, + ThumbMd5: thumbHash, + }, nil +} + +func (c *QQClient) GetShortVideoUrl(uuid, md5 []byte) string { + i, err := c.sendAndWait(c.buildPttShortVideoDownReqPacket(uuid, md5)) + if err != nil { + return "" + } + return i.(string) +} + // PttStore.GroupPttUp func (c *QQClient) buildGroupPttStorePacket(groupCode int64, md5 []byte, size, codec, voiceLength int32) (uint16, []byte) { seq := c.nextSeq() @@ -142,6 +169,72 @@ func (c *QQClient) buildGroupPttStoreBDHExt(groupCode int64, md5 []byte, size, c return payload } +// PttCenterSvr.ShortVideoDownReq +func (c *QQClient) buildPttShortVideoDownReqPacket(uuid, md5 []byte) (uint16, []byte) { + seq := c.nextSeq() + body := &pttcenter.ShortVideoReqBody{ + Cmd: 400, + Seq: int32(seq), + PttShortVideoDownloadReq: &pttcenter.ShortVideoDownloadReq{ + FromUin: c.Uin, + ToUin: c.Uin, + ChatType: 1, + ClientType: 7, + FileId: string(uuid), + GroupCode: 1, + FileMd5: md5, + BusinessType: 1, + FileType: 2, + DownType: 2, + SceneType: 2, + }, + } + payload, _ := proto.Marshal(body) + packet := packets.BuildUniPacket(c.Uin, seq, "PttCenterSvr.ShortVideoDownReq", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload) + return seq, packet +} + +func (c *QQClient) buildPttGroupShortVideoProto(videoHash, thumbHash []byte, toUin, videoSize, thumbSize int64) *pttcenter.ShortVideoReqBody { + seq := c.nextSeq() + return &pttcenter.ShortVideoReqBody{ + Cmd: 300, + Seq: int32(seq), + PttShortVideoUploadReq: &pttcenter.ShortVideoUploadReq{ + FromUin: c.Uin, + ToUin: toUin, + ChatType: 1, + ClientType: 2, + Info: &pttcenter.ShortVideoFileInfo{ + FileName: hex.EncodeToString(videoHash) + ".mp4", + FileMd5: videoHash, + ThumbFileMd5: thumbHash, + FileSize: videoSize, + FileResLength: 1280, + FileResWidth: 720, + FileFormat: 3, + FileTime: 120, + ThumbFileSize: thumbSize, + }, + GroupCode: toUin, + SupportLargeSize: 1, + }, + ExtensionReq: []*pttcenter.ShortVideoExtensionReq{ + { + SubBusiType: 0, + UserCnt: 1, + }, + }, + } +} + +// PttCenterSvr.GroupShortVideoUpReq +func (c *QQClient) buildPttGroupShortVideoUploadReqPacket(videoHash, thumbHash []byte, toUin, videoSize, thumbSize int64) (uint16, []byte) { + seq := c.nextSeq() + payload, _ := proto.Marshal(c.buildPttGroupShortVideoProto(videoHash, thumbHash, toUin, videoSize, thumbSize)) + packet := packets.BuildUniPacket(c.Uin, seq, "PttCenterSvr.GroupShortVideoUpReq", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload) + return seq, packet +} + // PttStore.GroupPttUp func decodeGroupPttStoreResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) { pkt := pb.D388RespBody{} @@ -230,3 +323,30 @@ func decodePrivatePttStoreResponse(c *QQClient, _ uint16, payload []byte) (inter FileKey: rsp.ApplyUploadRsp.Uuid, }, nil } + +// PttCenterSvr.ShortVideoDownReq +func decodePttShortVideoDownResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) { + rsp := pttcenter.ShortVideoRspBody{} + if err := proto.Unmarshal(payload, &rsp); err != nil { + return nil, errors.Wrap(err, "failed to unmarshal protobuf message") + } + if rsp.PttShortVideoDownloadRsp == nil || rsp.PttShortVideoDownloadRsp.DownloadAddr == nil { + return nil, errors.New("resp error") + } + return rsp.PttShortVideoDownloadRsp.DownloadAddr.Host[0] + rsp.PttShortVideoDownloadRsp.DownloadAddr.UrlArgs, nil +} + +// PttCenterSvr.GroupShortVideoUpReq +func decodeGroupShortVideoUploadResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) { + rsp := pttcenter.ShortVideoRspBody{} + if err := proto.Unmarshal(payload, &rsp); err != nil { + return nil, errors.Wrap(err, "failed to unmarshal protobuf message") + } + if rsp.PttShortVideoUploadRsp == nil { + return nil, errors.New("resp error") + } + if rsp.PttShortVideoUploadRsp.RetCode != 0 { + return nil, errors.Errorf("ret code error: %v", rsp.PttShortVideoUploadRsp.RetCode) + } + return rsp.PttShortVideoUploadRsp, nil +} diff --git a/message/elements.go b/message/elements.go index 3c23b803..891962c6 100644 --- a/message/elements.go +++ b/message/elements.go @@ -88,11 +88,13 @@ type ReplyElement struct { } type ShortVideoElement struct { - Name string - Uuid []byte - Size int32 - Md5 []byte - Url string + Name string + Uuid []byte + Size int32 + ThumbSize int32 + Md5 []byte + ThumbMd5 []byte + Url string } type ServiceElement struct { diff --git a/message/pack.go b/message/pack.go index 05233de1..e6eff6fe 100644 --- a/message/pack.go +++ b/message/pack.go @@ -1,6 +1,7 @@ package message import ( + "encoding/hex" "github.com/Mrs4s/MiraiGo/binary" "github.com/Mrs4s/MiraiGo/client/pb/msg" "github.com/golang/protobuf/proto" @@ -256,3 +257,32 @@ func (e *GroupShowPicElement) Pack() (r []*msg.Elem) { }) return } + +func (e *ShortVideoElement) Pack() (r []*msg.Elem) { + r = append(r, &msg.Elem{ + Text: &msg.Text{ + Str: proto.String("你的QQ暂不支持查看视频短片,请期待后续版本。"), + }, + }) + r = append(r, &msg.Elem{ + VideoFile: &msg.VideoFile{ + FileUuid: e.Uuid, + FileMd5: e.Md5, + FileName: []byte(hex.EncodeToString(e.Md5) + ".mp4"), + FileFormat: proto.Int32(3), + FileTime: proto.Int32(10), + FileSize: proto.Int32(e.Size), + ThumbWidth: proto.Int32(1280), + ThumbHeight: proto.Int32(720), + ThumbFileMd5: e.ThumbMd5, + ThumbFileSize: proto.Int32(e.ThumbSize), + BusiType: proto.Int32(0), + FromChatType: proto.Int32(-1), + ToChatType: proto.Int32(-1), + BoolSupportProgressive: proto.Bool(true), + FileWidth: proto.Int32(1280), + FileHeight: proto.Int32(720), + }, + }) + return +} diff --git a/utils/sys.go b/utils/sys.go index 08ea6773..9e5ae70d 100644 --- a/utils/sys.go +++ b/utils/sys.go @@ -1,10 +1,18 @@ package utils import ( + "crypto/md5" + "errors" + "io" "reflect" "unsafe" ) +type multiReadSeeker struct { + readers []io.ReadSeeker + multiReader io.Reader +} + func IsChanClosed(ch interface{}) bool { if reflect.TypeOf(ch).Kind() != reflect.Chan { panic("object is not a channel.") @@ -15,3 +23,36 @@ func IsChanClosed(ch interface{}) bool { ptr += unsafe.Sizeof(uint16(0)) return *(*uint32)(unsafe.Pointer(ptr)) > 0 } + +func GetMd5AndLength(r io.Reader) ([]byte, int64) { + h := md5.New() + length, _ := io.Copy(h, r) + fh := h.Sum(nil) + return fh[:], length +} + +func (r *multiReadSeeker) Read(p []byte) (int, error) { + if r.multiReader == nil { + var readers []io.Reader + for i := range r.readers { + _, _ = r.readers[i].Seek(0, io.SeekStart) + readers = append(readers, r.readers[i]) + } + r.multiReader = io.MultiReader(readers...) + } + return r.multiReader.Read(p) +} + +func (r *multiReadSeeker) Seek(offset int64, whence int) (int64, error) { + if whence != 0 || offset != 0 { + return -1, errors.New("unsupported offset") + } + r.multiReader = nil + return 0, nil +} + +func MultiReadSeeker(r ...io.ReadSeeker) io.ReadSeeker { + return &multiReadSeeker{ + readers: r, + } +}