增加群消息跨会话加密转发

This commit is contained in:
xhgit committed 2026-11-14 09:39:51 +08:00
1 parent 2e51827a07
commit c36e94fd1c
9 files changed
+212 -13

No files matched your search

+2 -5
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, voiceFile } from './attachments'
import { decodeMessage, encodeAttachment, encodeMutation, encodeRead, encodeReply, readForwardedFile, sealAttachment, uploadAttachment } from './attachments'
import type { Attachment, Mutation } from './attachments'
import type { GroupChatState } from './group-chat'
@@ -278,10 +278,7 @@ 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 bytes = attachment ? await readAttachment(attachment, call) : undefined
const content = attachment && bytes ? attachment.voice ? voiceFile([bytes]) :
new File([bytes], attachment.name, { type: attachment.media }) : line.text
const content = line.attachment ? await readForwardedFile(line.attachment, call) : line.text
await send(identity, recipient, device, content, call)
}