fix(protocol): don't send bytesGeneralFlags on private voice (#495)

Private-chat voice bubbles arrived without a waveform: the NapCat-derived
    14-byte c2c bytesGeneralFlags blob suppresses it. A/B testing that single
    field (everything else byte-identical) shows the receiver drops the shipped
    waveform while it is present and draws the bars as soon as it is gone, so c2c
    now sends no flags at all. Group voice keeps its 10-byte blob unchanged.
This commit is contained in:
H3CoF6 authored and GitHub committed 2026-09-30 13:55:47 +08:00
1 parent 93b5c1b4bf
commit 368becd078
2 files changed
+23 -11

No files matched your search

+13 -5
View File
@@ -219,11 +219,19 @@ export async function uploadPttMsgInfo(
ptt: {
bytesReserve: new Uint8Array([0x08, 0x00, 0x38, 0x00]),
bytesPbReserve: new Uint8Array(0),
// `bytesGeneralFlags` differs between group / c2c voice. Lifted
// verbatim from NapCat (UploadGroupPtt.ts / UploadPrivatePtt.ts).
bytesGeneralFlags: isGroup
? new Uint8Array([0x9a, 0x01, 0x07, 0xaa, 0x03, 0x04, 0x08, 0x08, 0x12, 0x00])
: new Uint8Array([0x9a, 0x01, 0x0b, 0xaa, 0x03, 0x08, 0x08, 0x04, 0x12, 0x04, 0x00, 0x00, 0x00, 0x00]),
// `bytesGeneralFlags` is the group blob lifted verbatim from NapCat
// (UploadGroupPtt.ts). Private chat must send **none**: with the
// NapCat c2c blob (UploadPrivatePtt.ts) present the receiving client
// draws the voice bubble without its progress bar, and the waveform
// we ship is silently dropped. Confirmed by A/B-ing this single field
// against an otherwise identical send (present → flat, absent → drawn).
...(isGroup
? {
bytesGeneralFlags: new Uint8Array([
0x9a, 0x01, 0x07, 0xaa, 0x03, 0x04, 0x08, 0x08, 0x12, 0x00,
]),
}
: {}),
...(ptt.waveform ? { waveform: ptt.waveform } : {}),
},
},