Screenshots and downloads are now only retrieved once from the team server when the user selects them in the client for preview, which leads to faster start-up times and less blocking UI.

This commit is contained in:
Jakob Friedl
2025-10-14 22:04:04 +02:00
parent df04eafc13
commit 1e95b67603
8 changed files with 79 additions and 55 deletions

View File

@@ -67,7 +67,7 @@ proc websocketHandler(ws: WebSocket, event: WebSocketEvent, message: Message) {.
for id, agent in cq.agents:
cq.client.sendAgent(agent)
# Downloads & Screenshots
# Downloads & Screenshots metadata
for lootItem in cq.dbGetLoot():
cq.client.sendLoot(lootItem)
@@ -106,9 +106,9 @@ proc websocketHandler(ws: WebSocket, event: WebSocketEvent, message: Message) {.
if not cq.dbDeleteLootById(event.data["lootId"].getStr()):
cq.client.sendEventlogItem(LOG_ERROR, "Failed to delete loot.")
of CLIENT_LOOT_SYNC:
let path = cq.dbGetLootById(event.data["lootId"].getStr()).path
cq.client.sendLootSync(path, readFile(path))
of CLIENT_LOOT_GET:
let loot = cq.dbGetLootById(event.data["lootId"].getStr())
cq.client.sendLootData(loot, readFile(loot.path))
else: discard