Новый протокол кодирования и декодирования вложений

This commit is contained in:
RoyceDa
2026-03-27 15:32:10 +02:00
parent 8d6090e632
commit 7e0e97f472
7 changed files with 57 additions and 22 deletions

View File

@@ -1,7 +1,7 @@
import { chacha20Decrypt, decodeWithPassword, decrypt, generateMd5 } from '@/app/workers/crypto/crypto';
import { useDatabase } from '@/app/providers/DatabaseProvider/useDatabase';
import { createContext, useEffect, useRef, useState } from 'react';
import { Attachment, AttachmentType, PacketMessage } from '@/app/providers/ProtocolProvider/protocol/packets/packet.message';
import { Attachment, AttachmentEncoding, AttachmentType, PacketMessage } from '@/app/providers/ProtocolProvider/protocol/packets/packet.message';
import { usePrivatePlain } from '../AccountProvider/usePrivatePlain';
import { usePublicKey } from '../AccountProvider/usePublicKey';
import { PacketRead } from '@/app/providers/ProtocolProvider/protocol/packets/packet.read';
@@ -47,7 +47,7 @@ export interface AttachmentMeta {
type: AttachmentType;
preview: string;
transport_tag: string;
encoded_for: string;
encoding: AttachmentEncoding;
transport_server: string;
}
@@ -962,7 +962,7 @@ export function DialogProvider(props: DialogProviderProps) {
preview: meta.preview,
transport_server: meta.transport_server,
transport_tag: meta.transport_tag,
encoded_for: meta.encoded_for
encoding: meta.encoding
});
}
return attachments;

View File

@@ -121,7 +121,7 @@ export function useDialog() : {
preview: attachment.preview,
transport_server: attachment.transport_server,
transport_tag: attachment.transport_tag,
encoded_for: dialog
encoding: attachment.encoding
});
if(attachment.type == AttachmentType.FILE){
/**

View File

@@ -191,7 +191,7 @@ export function useSynchronize() {
id: attachment.id,
type: attachment.type,
preview: attachment.preview,
encoded_for: attachment.encoded_for,
encoding: attachment.encoding,
transport_server: attachment.transport_server,
transport_tag: attachment.transport_tag
});
@@ -376,7 +376,7 @@ export function useSynchronize() {
id: attachment.id,
type: attachment.type,
preview: attachment.preview,
encoded_for: attachment.encoded_for,
encoding: attachment.encoding,
transport_server: attachment.transport_server,
transport_tag: attachment.transport_tag
});