Новая система вложений

This commit is contained in:
RoyceDa
2026-03-26 22:29:03 +02:00
parent fd3fac54f6
commit 8d6090e632
12 changed files with 192 additions and 145 deletions

View File

@@ -46,6 +46,9 @@ export interface AttachmentMeta {
id: string;
type: AttachmentType;
preview: string;
transport_tag: string;
encoded_for: string;
transport_server: string;
}
export interface Message {
@@ -469,9 +472,7 @@ export function DialogProvider(props: DialogProviderProps) {
for(let i = 0; i < packet.getAttachments().length; i++) {
const attachment = packet.getAttachments()[i];
attachments.push({
id: attachment.id,
preview: attachment.preview,
type: attachment.type,
...attachment,
blob: attachment.type == AttachmentType.MESSAGES ? await decodeWithPassword(chachaDecryptedKey.toString('utf-8'), attachment.blob) : ""
});
}
@@ -549,9 +550,7 @@ export function DialogProvider(props: DialogProviderProps) {
for(let i = 0; i < packet.getAttachments().length; i++) {
const attachment = packet.getAttachments()[i];
attachments.push({
id: attachment.id,
preview: attachment.preview,
type: attachment.type,
...attachment,
blob: attachment.type == AttachmentType.MESSAGES ? await decodeWithPassword(groupKey, attachment.blob) : ""
});
}
@@ -627,9 +626,7 @@ export function DialogProvider(props: DialogProviderProps) {
for(let i = 0; i < packet.getAttachments().length; i++) {
const attachment = packet.getAttachments()[i];
attachments.push({
id: attachment.id,
preview: attachment.preview,
type: attachment.type,
...attachment,
blob: attachment.type == AttachmentType.MESSAGES ? await decodeWithPassword(chachaDecryptedKey.toString('utf-8'), attachment.blob) : ""
});
}
@@ -707,9 +704,7 @@ export function DialogProvider(props: DialogProviderProps) {
for(let i = 0; i < packet.getAttachments().length; i++) {
const attachment = packet.getAttachments()[i];
attachments.push({
id: attachment.id,
preview: attachment.preview,
type: attachment.type,
...attachment,
blob: attachment.type == AttachmentType.MESSAGES ? await decodeWithPassword(groupKey, attachment.blob) : ""
});
}
@@ -964,7 +959,10 @@ export function DialogProvider(props: DialogProviderProps) {
id: meta.id,
blob: blob,
type: meta.type,
preview: meta.preview
preview: meta.preview,
transport_server: meta.transport_server,
transport_tag: meta.transport_tag,
encoded_for: meta.encoded_for
});
}
return attachments;