Skip to content

Commit

Permalink
feat: #702
Browse files Browse the repository at this point in the history
  • Loading branch information
pk5ls20 committed Jan 10, 2025
1 parent 15156ba commit 4b0a0f0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 7 deletions.
8 changes: 7 additions & 1 deletion src/core/packet/message/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ export class PacketMsgPicElement extends IPacketMsgElement<SendPicElement> {
width: number;
height: number;
picType: PicType;
picSubType: number;
summary: string;
sha1: string | null = null;
msgInfo: NapProtoEncodeStructType<typeof MsgInfo> | null = null;
groupPicExt: NapProtoEncodeStructType<typeof CustomFace> | null = null;
Expand All @@ -270,6 +272,10 @@ export class PacketMsgPicElement extends IPacketMsgElement<SendPicElement> {
this.width = element.picElement.picWidth;
this.height = element.picElement.picHeight;
this.picType = element.picElement.picType;
this.picSubType = element.picElement.picSubType ?? 0;
this.summary = element.picElement.summary === '' ? (
element.picElement.picSubType === 0 ? '[图片]' : '[动画表情]'
) : element.picElement.summary;
}

get valid(): boolean {
Expand All @@ -288,7 +294,7 @@ export class PacketMsgPicElement extends IPacketMsgElement<SendPicElement> {
}

toPreview(): string {
return "[图片]";
return this.summary;
}
}

Expand Down
7 changes: 5 additions & 2 deletions src/core/packet/transformer/highway/UploadGroupImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ class UploadGroupImage extends PacketTransformer<typeof proto.NTV2RichMediaResp>
compatQMsgSceneType: 2,
extBizInfo: {
pic: {
bytesPbReserveTroop: Buffer.from("0800180020004200500062009201009a0100a2010c080012001800200028003a00", 'hex'),
textSummary: "Nya~", // TODO:
bizType: img.picSubType,
bytesPbReserveTroop: {
subType: img.picSubType,
},
textSummary: img.summary,
},
video: {
bytesPbReserve: Buffer.alloc(0),
Expand Down
7 changes: 5 additions & 2 deletions src/core/packet/transformer/highway/UploadPrivateImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ class UploadPrivateImage extends PacketTransformer<typeof proto.NTV2RichMediaRes
compatQMsgSceneType: 1,
extBizInfo: {
pic: {
bytesPbReserveTroop: Buffer.from("0800180020004200500062009201009a0100a2010c080012001800200028003a00", 'hex'),
textSummary: "Nya~", // TODO:
bizType: img.picSubType,
bytesPbReserveC2C: {
subType: img.picSubType,
},
textSummary: img.summary,
},
video: {
bytesPbReserve: Buffer.alloc(0),
Expand Down
28 changes: 26 additions & 2 deletions src/core/packet/transformer/proto/oidb/common/Ntv2.RichMediaReq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ export const VideoExtBizInfo = {
export const PicExtBizInfo = {
BizType: ProtoField(1, ScalarType.UINT32),
TextSummary: ProtoField(2, ScalarType.STRING),
BytesPbReserveC2c: ProtoField(11, ScalarType.BYTES),
BytesPbReserveTroop: ProtoField(12, ScalarType.BYTES),
BytesPbReserveC2c: ProtoField(11, () => BytesPbReserveC2c),
BytesPbReserveTroop: ProtoField(12, () => BytesPbReserveTroop),
FromScene: ProtoField(1001, ScalarType.UINT32),
ToScene: ProtoField(1002, ScalarType.UINT32),
OldFileId: ProtoField(1003, ScalarType.UINT32),
Expand All @@ -211,3 +211,27 @@ export const UploadInfo = {
FileInfo: ProtoField(1, () => FileInfo),
SubFileType: ProtoField(2, ScalarType.UINT32),
};

export const BytesPbReserveC2c = {
subType: ProtoField(1, ScalarType.UINT32),
field3: ProtoField(3, ScalarType.UINT32),
field4: ProtoField(4, ScalarType.UINT32),
field8: ProtoField(8, ScalarType.STRING),
field10: ProtoField(10, ScalarType.UINT32),
field12: ProtoField(12, ScalarType.STRING),
field18: ProtoField(18, ScalarType.STRING),
field19: ProtoField(19, ScalarType.STRING),
field20: ProtoField(20, ScalarType.BYTES),
};

export const BytesPbReserveTroop = {
subType: ProtoField(1, ScalarType.UINT32),
field3: ProtoField(3, ScalarType.UINT32),
field4: ProtoField(4, ScalarType.UINT32),
field9: ProtoField(9, ScalarType.STRING),
field10: ProtoField(10, ScalarType.UINT32),
field12: ProtoField(12, ScalarType.STRING),
field18: ProtoField(18, ScalarType.STRING),
field19: ProtoField(19, ScalarType.STRING),
field21: ProtoField(21, ScalarType.BYTES),
};

0 comments on commit 4b0a0f0

Please sign in to comment.