small fix

This commit is contained in:
Ralf
2026-02-08 16:31:18 +03:00
parent 8ae551d406
commit c42e899dd6
5 changed files with 70 additions and 5 deletions
+1
View File
@@ -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
@@ -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<qint64>(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;
+4 -5
View File
@@ -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
@@ -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 {
+15
View File
@@ -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 {