From a7d8b722057647732d503e9c2dea4d79efce0e3f Mon Sep 17 00:00:00 2001 From: andrei-mihnea-cerbu Date: Tue, 25 Feb 2025 21:08:16 +0200 Subject: [PATCH] done --- Desktop App/src/helpers/backup_retrieval.ts | 6 +++--- Desktop App/src/helpers/file_sharer.ts | 9 ++------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Desktop App/src/helpers/backup_retrieval.ts b/Desktop App/src/helpers/backup_retrieval.ts index 2db104d..41ad902 100644 --- a/Desktop App/src/helpers/backup_retrieval.ts +++ b/Desktop App/src/helpers/backup_retrieval.ts @@ -9,7 +9,7 @@ import { UserInfoScheme } from '../database/schemes/app_config_scheme' export class BackupRetrievalWorker { private db: Database - private readonly clientPort: number + private readonly port: number private readonly destinationPath: string private encryptionKey: Buffer | null = null private iv: Buffer | null = null @@ -19,7 +19,7 @@ export class BackupRetrievalWorker { constructor(pathToDatabaseFile: string, clientPort: number, destinationPath: string) { this.db = new Database(pathToDatabaseFile) - this.clientPort = clientPort + this.port = clientPort this.destinationPath = destinationPath } @@ -74,7 +74,7 @@ export class BackupRetrievalWorker { } private async processBackupForIp(ip: string, userInfo: UserInfoScheme): Promise { - this.tcpCommunicator = new TcpCommunicator(ip, this.clientPort) + this.tcpCommunicator = new TcpCommunicator(ip, this.port) if (!(await this.tcpCommunicator.connect())) { this.log(`Failed to connect to ${ip}`, 'error') return true diff --git a/Desktop App/src/helpers/file_sharer.ts b/Desktop App/src/helpers/file_sharer.ts index 1ce9530..7191ed6 100644 --- a/Desktop App/src/helpers/file_sharer.ts +++ b/Desktop App/src/helpers/file_sharer.ts @@ -4,12 +4,7 @@ import { TcpCommunicator } from './tcp_communicator' import { operationCodes } from '../network/operation_codes' import { ParsedMessage } from '../network/message_handler' import { Database } from '../database/database' - -interface FileSendTask { - ip: string - path: string - userName: string -} +import {FileItemTask} from "../database/schemes/local_resources_scheme"; export class FileSharer { private readonly db: Database @@ -65,7 +60,7 @@ export class FileSharer { } // Method to send the file to a specific IP using TcpCommunicator - private async sendFile(task: FileSendTask): Promise { + private async sendFile(task: FileItemTask): Promise { const { ip, path: filePath, userName } = task // Ensure the file exists before attempting to send