接通双端加密语音录制与播放

This commit is contained in:
xhgit committed 2026-11-13 23:39:13 +08:00
1 parent 149028267e
commit 87676ae983
13 files changed
+217 -10

No files matched your search

+3 -2
View File
@@ -3,7 +3,7 @@ import { mlsBinding, signMls } from '../identity'
import { base64, decode, fingerprint, loadEngine } from './engine'
import type { DeviceMls } from './engine'
import { withVault } from './vault'
import { decodeMessage, encodeAttachment, encodeMutation, encodeRead, encodeReply, readAttachment, sealAttachment, uploadAttachment } from './attachments'
import { decodeMessage, encodeAttachment, encodeMutation, encodeRead, encodeReply, readAttachment, sealAttachment, uploadAttachment, voiceFile } from './attachments'
import type { Attachment, Mutation } from './attachments'
export interface Peer {
@@ -265,7 +265,8 @@ export function localMessageAction(identity: ChatIdentity, line: ChatLine, actio
export async function forwardMessage(identity: ChatIdentity, line: ChatLine, recipient: string, device: Peer, call: Call) {
if (line.recalled) throw new Error('撤回的消息无法转发')
const attachment = line.attachment
const content = attachment ? new File([await readAttachment(attachment, call)], attachment.name) : line.text
const bytes = attachment ? await readAttachment(attachment, call) : undefined
const content = attachment && bytes ? attachment.voice ? voiceFile([bytes]) : new File([bytes], attachment.name) : line.text
await send(identity, recipient, device, content, call)
}