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

@@ -157,18 +157,20 @@ proc main(ip: string = "localhost", port: int = 37573) =
of DOWNLOAD:
lootDownloads.items.add(lootItem)
of SCREENSHOT:
lootScreenshots.addItem(lootItem)
lootScreenshots.items.add(lootItem)
else: discard
of CLIENT_LOOT_SYNC:
let path = event.data["path"].getStr()
let file = decode(event.data["loot"].getStr())
try:
# TODO: Using native file dialogs to have the client select the output file path (does not work in WSL)
# let outFilePath = callDialogFileSave("Save Payload")
writeFile(path & "_download", file)
except IOError:
discard
of CLIENT_LOOT_DATA:
let
lootItem = event.data["loot"].to(LootItem)
data = decode(event.data["data"].getStr())
case lootItem.itemType:
of DOWNLOAD:
lootDownloads.contents[lootItem.lootId] = data
of SCREENSHOT:
lootScreenshots.addTexture(lootItem.lootId, data)
else: discard
else: discard