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

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

@@ -20,7 +20,7 @@ import { useGroupInviteStatus } from "./useGroupInviteStatus";
import { Attachment, AttachmentType, PacketMessage } from "../ProtocolProvider/protocol/packets/packet.message";
import { useUpdateSyncTime } from "./useUpdateSyncTime";
import { useFileStorage } from "@/app/hooks/useFileStorage";
import { DeliveredMessageState, Message } from "./DialogProvider";
import { AttachmentMeta, DeliveredMessageState, Message } from "./DialogProvider";
import { MESSAGE_MAX_LOADED, TIME_TO_INACTIVE_FOR_MESSAGES_UNREAD } from "@/app/constants";
import { useMemory } from "../MemoryProvider/useMemory";
import { useDialogsCache } from "./useDialogsCache";
@@ -165,7 +165,7 @@ export function useSynchronize() {
const nonce = chachaDecryptedKey.slice(32);
const decryptedContent = await chacha20Decrypt(content, nonce.toString('hex'), key.toString('hex'));
await updateSyncTime(timestamp);
let attachmentsMeta: any[] = [];
let attachmentsMeta: AttachmentMeta[] = [];
let messageAttachments: Attachment[] = [];
for (let i = 0; i < packet.getAttachments().length; i++) {
const attachment = packet.getAttachments()[i];
@@ -190,7 +190,10 @@ export function useSynchronize() {
attachmentsMeta.push({
id: attachment.id,
type: attachment.type,
preview: attachment.preview
preview: attachment.preview,
encoded_for: attachment.encoded_for,
transport_server: attachment.transport_server,
transport_tag: attachment.transport_tag
});
}
@@ -347,7 +350,7 @@ export function useSynchronize() {
decryptedContent = '';
}
let attachmentsMeta: any[] = [];
let attachmentsMeta: AttachmentMeta[] = [];
let messageAttachments: Attachment[] = [];
for (let i = 0; i < packet.getAttachments().length; i++) {
const attachment = packet.getAttachments()[i];
@@ -372,7 +375,10 @@ export function useSynchronize() {
attachmentsMeta.push({
id: attachment.id,
type: attachment.type,
preview: attachment.preview
preview: attachment.preview,
encoded_for: attachment.encoded_for,
transport_server: attachment.transport_server,
transport_tag: attachment.transport_tag
});
}