From c42e899dd670000df1ba5dbfca8e954cb10846ed Mon Sep 17 00:00:00 2001 From: Ralf Date: Sun, 8 Feb 2026 16:31:18 +0300 Subject: [PATCH] small fix --- AdaptixClient/Headers/main.h | 1 + .../Source/Client/ProcessSyncPacket.cpp | 32 +++++++++++++++++++ AdaptixServer/core/server/ts_sync.go | 9 +++--- AdaptixServer/core/server/ts_syncpacket.go | 18 +++++++++++ AdaptixServer/core/server/utils.go | 15 +++++++++ 5 files changed, 70 insertions(+), 5 deletions(-) diff --git a/AdaptixClient/Headers/main.h b/AdaptixClient/Headers/main.h index 9f95f204..e9ff8581 100644 --- a/AdaptixClient/Headers/main.h +++ b/AdaptixClient/Headers/main.h @@ -122,6 +122,7 @@ #define TYPE_DOWNLOAD_CREATE 0x51 #define TYPE_DOWNLOAD_UPDATE 0x52 #define TYPE_DOWNLOAD_DELETE 0x53 +#define TYPE_DOWNLOAD_ACTUAL 0x54 #define TYPE_TUNNEL_CREATE 0x57 #define TYPE_TUNNEL_EDIT 0x58 diff --git a/AdaptixClient/Source/Client/ProcessSyncPacket.cpp b/AdaptixClient/Source/Client/ProcessSyncPacket.cpp index e7899b71..9073ae6a 100644 --- a/AdaptixClient/Source/Client/ProcessSyncPacket.cpp +++ b/AdaptixClient/Source/Client/ProcessSyncPacket.cpp @@ -89,6 +89,22 @@ namespace { return data; } + DownloadData parseDownloadDataActual(const QJsonObject &json) { + DownloadData data = {}; + data.FileId = json["d_file_id"].toString(); + data.AgentId = json["d_agent_id"].toString(); + data.AgentName = json["d_agent_name"].toString(); + data.User = json["d_user"].toString(); + data.Computer = json["d_computer"].toString(); + data.Filename = json["d_file"].toString(); + data.TotalSize = json["d_size"].toDouble(); + data.DateTimestamp = static_cast(json["d_date"].toDouble()); + data.Date = UnixTimestampGlobalToStringLocal(data.DateTimestamp); + data.RecvSize = json["d_recv_size"].toDouble(); + data.State = json["d_state"].toDouble(); + return data; + } + ScreenData parseScreenData(const QJsonObject &json) { ScreenData data = {}; data.ScreenId = json["s_screen_id"].toString(); @@ -351,6 +367,18 @@ bool AdaptixWidget::isValidSyncPacket(QJsonObject jsonObj) case TYPE_DOWNLOAD_DELETE: return checkField("d_files_id", isArr); + case TYPE_DOWNLOAD_ACTUAL: + return checkField("d_file_id", isStr) && + checkField("d_agent_id", isStr) && + checkField("d_agent_name", isStr) && + checkField("d_user", isStr) && + checkField("d_computer", isStr) && + checkField("d_file", isStr) && + checkField("d_size", isNum) && + checkField("d_date", isNum) && + checkField("d_recv_size", isNum) && + checkField("d_state", isNum); + case TYPE_TUNNEL_CREATE: return checkField("p_tunnel_id", isStr) && checkField("p_agent_id", isStr) && @@ -790,6 +818,10 @@ void AdaptixWidget::processSyncPacket(QJsonObject jsonObj) break; } + case TYPE_DOWNLOAD_ACTUAL: + DownloadsDock->AddDownloadItem(parseDownloadDataActual(jsonObj)); + break; + case TYPE_SCREEN_CREATE: ScreenshotsDock->AddScreenshotItem(parseScreenData(jsonObj)); break; diff --git a/AdaptixServer/core/server/ts_sync.go b/AdaptixServer/core/server/ts_sync.go index 8cbb3879..0e5451a9 100644 --- a/AdaptixServer/core/server/ts_sync.go +++ b/AdaptixServer/core/server/ts_sync.go @@ -31,7 +31,7 @@ func getPacketCategory(packet interface{}) string { return "notifications" case SyncPackerChatMessage: return SyncCategoryChatHistory - case SyncPackerDownloadCreate, SyncPackerDownloadUpdate: + case SyncPackerDownloadCreate, SyncPackerDownloadUpdate, SyncPackerDownloadActual: return SyncCategoryDownloadsHistory case SyncPackerScreenshotCreate: return SyncCategoryScreenshotHistory @@ -492,11 +492,10 @@ func (ts *Teamserver) TsPresyncDownloads() []interface{} { return sortedDownloads[i].Date < sortedDownloads[j].Date }) - packets := make([]interface{}, 0, len(sortedDownloads)*2) + packets := make([]interface{}, 0, len(sortedDownloads)) for _, downloadData := range sortedDownloads { - d1 := CreateSpDownloadCreate(downloadData) - d2 := CreateSpDownloadUpdate(downloadData) - packets = append(packets, d1, d2) + d := CreateSpDownloadActual(downloadData) + packets = append(packets, d) } return packets diff --git a/AdaptixServer/core/server/ts_syncpacket.go b/AdaptixServer/core/server/ts_syncpacket.go index 2b258804..07f29b2d 100644 --- a/AdaptixServer/core/server/ts_syncpacket.go +++ b/AdaptixServer/core/server/ts_syncpacket.go @@ -52,6 +52,7 @@ const ( TYPE_DOWNLOAD_CREATE = 0x51 TYPE_DOWNLOAD_UPDATE = 0x52 TYPE_DOWNLOAD_DELETE = 0x53 + TYPE_DOWNLOAD_ACTUAL = 0x54 TYPE_TUNNEL_CREATE = 0x57 TYPE_TUNNEL_EDIT = 0x58 @@ -472,6 +473,23 @@ func CreateSpDownloadDelete(fileId []string) SyncPackerDownloadDelete { } } +func CreateSpDownloadActual(downloadData adaptix.DownloadData) SyncPackerDownloadActual { + return SyncPackerDownloadActual{ + SpType: TYPE_DOWNLOAD_ACTUAL, + + AgentId: downloadData.AgentId, + AgentName: downloadData.AgentName, + FileId: downloadData.FileId, + User: downloadData.User, + Computer: downloadData.Computer, + File: downloadData.RemotePath, + Size: downloadData.TotalSize, + Date: downloadData.Date, + RecvSize: downloadData.RecvSize, + State: downloadData.State, + } +} + /// SCREEN func CreateSpScreenshotCreate(screenData adaptix.ScreenData) SyncPackerScreenshotCreate { diff --git a/AdaptixServer/core/server/utils.go b/AdaptixServer/core/server/utils.go index 06ed9ddc..8bcce304 100644 --- a/AdaptixServer/core/server/utils.go +++ b/AdaptixServer/core/server/utils.go @@ -545,6 +545,21 @@ type SyncPackerDownloadDelete struct { FileId []string `json:"d_files_id"` } +type SyncPackerDownloadActual struct { + SpType int `json:"type"` + + FileId string `json:"d_file_id"` + AgentId string `json:"d_agent_id"` + AgentName string `json:"d_agent_name"` + User string `json:"d_user"` + Computer string `json:"d_computer"` + File string `json:"d_file"` + Size int `json:"d_size"` + Date int64 `json:"d_date"` + RecvSize int `json:"d_recv_size"` + State int `json:"d_state"` +} + /// SCREEN type SyncPackerScreenshotCreate struct {