From 519aa8802f177aa7785b569915075dcd6d152c23 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Sun, 29 Mar 2026 15:45:08 +0200 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D1=80=D0=BE=D1=82=D0=BE=D0=BA=D0=BE=D0=BB?= =?UTF-8?q?=D0=B0,=20=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B0=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/DialogInput/DialogInput.tsx | 20 ----------------- .../usePrepareAttachment.ts | 20 ++--------------- app/providers/CallProvider/CallProvider.tsx | 4 ---- .../DialogProvider/DialogProvider.tsx | 6 ++--- .../DialogProvider/useDeattachedSender.ts | 1 - app/providers/DialogProvider/useDialog.ts | 3 +-- .../DialogProvider/useDialogFiber.ts | 2 -- .../DialogProvider/useSynchronize.ts | 2 -- .../protocol/packets/packet.message.ts | 22 +------------------ 9 files changed, 6 insertions(+), 74 deletions(-) diff --git a/app/components/DialogInput/DialogInput.tsx b/app/components/DialogInput/DialogInput.tsx index 2850c4c..3999432 100644 --- a/app/components/DialogInput/DialogInput.tsx +++ b/app/components/DialogInput/DialogInput.tsx @@ -93,10 +93,6 @@ export function DialogInput() { transport: { transport_server: "", transport_tag: "" - }, - encoding: { - encoded_for: dialog, - encoder: publicKey } }]); } @@ -128,10 +124,6 @@ export function DialogInput() { transport: { transport_server: "", transport_tag: "" - }, - encoding: { - encoded_for: dialog, - encoder: publicKey } }]); if(editableDivRef.current){ @@ -250,10 +242,6 @@ export function DialogInput() { transport: { transport_server: "", transport_tag: "" - }, - encoding: { - encoded_for: dialog, - encoder: publicKey } }]); if(editableDivRef.current){ @@ -298,10 +286,6 @@ export function DialogInput() { transport: { transport_server: "", transport_tag: "" - }, - encoding: { - encoded_for: dialog, - encoder: publicKey } }]); } @@ -340,10 +324,6 @@ export function DialogInput() { transport: { transport_server: "", transport_tag: "" - }, - encoding: { - encoded_for: dialog, - encoder: publicKey } }]); } diff --git a/app/providers/AttachmentProvider/usePrepareAttachment.ts b/app/providers/AttachmentProvider/usePrepareAttachment.ts index f9a9b8e..afdc9c9 100644 --- a/app/providers/AttachmentProvider/usePrepareAttachment.ts +++ b/app/providers/AttachmentProvider/usePrepareAttachment.ts @@ -11,7 +11,6 @@ import { useConsoleLogger } from "@/app/hooks/useConsoleLogger"; import { useDialogsCache } from "../DialogProvider/useDialogsCache"; import { AttachmentMeta, DialogContext } from "../DialogProvider/DialogProvider"; import { useTransportServer } from "../TransportProvider/useTransportServer"; -import { usePublicKey } from "../AccountProvider/usePublicKey"; export function usePrepareAttachment() { const intervalsRef = useRef(null); @@ -22,7 +21,6 @@ export function usePrepareAttachment() { const {getDialogCache} = useDialogsCache(); const context = useContext(DialogContext); const transportServer = useTransportServer(); - const publicKey = usePublicKey(); const updateTimestampInDialogCache = (dialog : string, message_id: string) => { const dialogCache = getDialogCache(dialog); @@ -158,7 +156,7 @@ export function usePrepareAttachment() { * а так же из-за надежности доставки файлов через HTTP * @param attachments Attachments to prepare for sending */ - const prepareAttachmentsToSend = async (message_id: string, dialog: string, password: string, attachments : Attachment[], rePrepared : boolean = false) : Promise => { + const prepareAttachmentsToSend = async (message_id: string, dialog: string, password: string, attachments : Attachment[]) : Promise => { if(attachments.length <= 0){ return []; } @@ -174,7 +172,7 @@ export function usePrepareAttachment() { continue; } if(attachment.type == AttachmentType.MESSAGES){ - let reply : MessageReply[] = JSON.parse(attachment.blob) + let reply : MessageReply[] = JSON.parse(attachment.blob); for(let j = 0; j < reply.length; j++){ for(let k = 0; k < reply[j].attachments.length; k++){ reply[j].attachments[k].blob = ""; @@ -194,16 +192,6 @@ export function usePrepareAttachment() { const blurhash = await base64ImageToBlurhash(attachment.blob); attachment.preview = blurhash; } - // if(rePrepared && (attachment.encoding.encoded_for == dialog || attachment.encoding.encoder == dialog)){ - // /** - // * Это пересланное сообщение и оно уже закодировано для этого диалога, или закодировано отправителем, значит не нужно его кодировать и загружать заново - // */ - // prepared.push({ - // ...attachment, - // blob: "" - // }); - // continue; - // } doTimestampUpdateImMessageWhileAttachmentsSend(message_id, dialog); const content = await encodeWithPassword(password, attachment.blob); const upid = attachment.id; @@ -220,10 +208,6 @@ export function usePrepareAttachment() { transport_server: transportServer || "", transport_tag: tag }, - encoding: { - encoded_for: dialog, - encoder: publicKey - }, preview: attachment.preview, blob: "" }; diff --git a/app/providers/CallProvider/CallProvider.tsx b/app/providers/CallProvider/CallProvider.tsx index 2d1bbd0..8098a71 100644 --- a/app/providers/CallProvider/CallProvider.tsx +++ b/app/providers/CallProvider/CallProvider.tsx @@ -476,10 +476,6 @@ export function CallProvider(props : CallProviderProps) { transport_server: "", transport_tag: "" }, - encoding: { - encoded_for: "", - encoder: "" - }, blob: "" }], true); } diff --git a/app/providers/DialogProvider/DialogProvider.tsx b/app/providers/DialogProvider/DialogProvider.tsx index 0724a29..8fcd73d 100644 --- a/app/providers/DialogProvider/DialogProvider.tsx +++ b/app/providers/DialogProvider/DialogProvider.tsx @@ -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, AttachmentEncoding, AttachmentTransport, AttachmentType, PacketMessage } from '@/app/providers/ProtocolProvider/protocol/packets/packet.message'; +import { Attachment, AttachmentTransport, 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,6 @@ export interface AttachmentMeta { type: AttachmentType; preview: string; transport: AttachmentTransport; - encoding: AttachmentEncoding; } export interface Message { @@ -969,8 +968,7 @@ export function DialogProvider(props: DialogProviderProps) { blob: blob, type: meta.type, preview: meta.preview, - transport: meta.transport, - encoding: meta.encoding + transport: meta.transport }); } return attachments; diff --git a/app/providers/DialogProvider/useDeattachedSender.ts b/app/providers/DialogProvider/useDeattachedSender.ts index 8470413..b57ce35 100644 --- a/app/providers/DialogProvider/useDeattachedSender.ts +++ b/app/providers/DialogProvider/useDeattachedSender.ts @@ -107,7 +107,6 @@ export function useDeattachedSender() { id: attachment.id, type: attachment.type, preview: attachment.preview, - encoding: attachment.encoding, transport: attachment.transport }); if(attachment.type == AttachmentType.FILE){ diff --git a/app/providers/DialogProvider/useDialog.ts b/app/providers/DialogProvider/useDialog.ts index 30588c2..1a318aa 100644 --- a/app/providers/DialogProvider/useDialog.ts +++ b/app/providers/DialogProvider/useDialog.ts @@ -118,8 +118,7 @@ export function useDialog() : { id: attachment.id, type: attachment.type, preview: attachment.preview, - transport: attachment.transport, - encoding: attachment.encoding + transport: attachment.transport }); if(attachment.type == AttachmentType.FILE){ /** diff --git a/app/providers/DialogProvider/useDialogFiber.ts b/app/providers/DialogProvider/useDialogFiber.ts index ea3c8b2..18fe86c 100644 --- a/app/providers/DialogProvider/useDialogFiber.ts +++ b/app/providers/DialogProvider/useDialogFiber.ts @@ -130,7 +130,6 @@ export function useDialogFiber() { id: attachment.id, type: attachment.type, preview: attachment.preview, - encoding: attachment.encoding, transport: attachment.transport }); } @@ -289,7 +288,6 @@ export function useDialogFiber() { id: attachment.id, type: attachment.type, preview: attachment.preview, - encoding: attachment.encoding, transport: attachment.transport }); } diff --git a/app/providers/DialogProvider/useSynchronize.ts b/app/providers/DialogProvider/useSynchronize.ts index 6f77735..33a18a2 100644 --- a/app/providers/DialogProvider/useSynchronize.ts +++ b/app/providers/DialogProvider/useSynchronize.ts @@ -191,7 +191,6 @@ export function useSynchronize() { id: attachment.id, type: attachment.type, preview: attachment.preview, - encoding: attachment.encoding, transport: attachment.transport }); } @@ -375,7 +374,6 @@ export function useSynchronize() { id: attachment.id, type: attachment.type, preview: attachment.preview, - encoding: attachment.encoding, transport: attachment.transport }); } diff --git a/app/providers/ProtocolProvider/protocol/packets/packet.message.ts b/app/providers/ProtocolProvider/protocol/packets/packet.message.ts index e42f995..01bc15b 100644 --- a/app/providers/ProtocolProvider/protocol/packets/packet.message.ts +++ b/app/providers/ProtocolProvider/protocol/packets/packet.message.ts @@ -17,19 +17,6 @@ export interface AttachmentTransport { transport_server: string; } -/** - * Информация о кодировке вложения - */ -export interface AttachmentEncoding { - /** - * Для кого вложение закодировано (для какого диалога) - */ - encoded_for: string; - /** - * Кто кодировал вложение - */ - encoder: string; -} export interface Attachment { id: string; @@ -37,7 +24,6 @@ export interface Attachment { type: AttachmentType; preview: string; transport: AttachmentTransport; - encoding: AttachmentEncoding; } export class PacketMessage extends Packet { @@ -79,11 +65,7 @@ export class PacketMessage extends Packet { transport_tag: stream.readString(), transport_server: stream.readString() } - const encoding : AttachmentEncoding = { - encoded_for: stream.readString(), - encoder: stream.readString() - } - this.attachments.push({id, preview, type, blob, transport, encoding}); + this.attachments.push({id, preview, type, blob, transport}); } this.aesChachaKey = stream.readString(); } @@ -106,8 +88,6 @@ export class PacketMessage extends Packet { stream.writeInt8(this.attachments[i].type); stream.writeString(this.attachments[i].transport.transport_tag); stream.writeString(this.attachments[i].transport.transport_server); - stream.writeString(this.attachments[i].encoding.encoded_for); - stream.writeString(this.attachments[i].encoding.encoder); } stream.writeString(this.aesChachaKey); return stream;