diff --git a/TODO.md b/TODO.md index 6f6b86d..a4b0a07 100644 --- a/TODO.md +++ b/TODO.md @@ -1,11 +1,9 @@ # Todo +## Fixes ## New features - -- Cancel button for downloading -- map and mod filtering +- different languages ## QOL - -- mbps counter -- fixed sorting and filtering tools in the server list +- Cancel button for downloading +- mbps counter \ No newline at end of file diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 2c361d9..ae14f79 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -7,7 +7,7 @@ }, "package": { "productName": "Pavlov Map Manager", - "version": "1.3.0" + "version": "1.3.1" }, "tauri": { "allowlist": { diff --git a/src/lib/modio-utils.ts b/src/lib/modio-utils.ts index 4a9669a..270ce33 100644 --- a/src/lib/modio-utils.ts +++ b/src/lib/modio-utils.ts @@ -45,7 +45,7 @@ export async function loadMods() { app.status = "Assigning data"; appStore.set(app); - const allMods = new Set([ ...subscriptions.map(sub => sub.id), ...localMods]); + const allMods = new Set([...subscriptions.map(sub => sub.id), ...localMods]); const max = allMods.size; let current = 1; @@ -181,15 +181,24 @@ async function downloadMap(mod: string) { headers.set("Accept", "application/json"); headers.set("X-Modio-Platform", "windows"); + let recSize = 0; + let updateCounter = 0; + let lastUpdate = 0; + await download( fileInfo.download.binary_url, `${mod}.zip`, (progress, total) => { - app.receivedSize += progress; - appStore.set(app); + recSize += progress; + updateCounter++; + if (updateCounter - lastUpdate > 200) { + appStore.update((store) => ({ ...store, receivedSize: recSize })); + lastUpdate = updateCounter; + } }, headers ); + //console.log("Took ", updateCounter, " updates to download the file"); } catch (error) { toast.error("Error while downloading file"); console.log("Error while downloading file: ", error); @@ -201,7 +210,7 @@ async function downloadMap(mod: string) { // Check MD5 hash of the file const hash = await invoke("md5", { filePath: `${mod}.zip` }); - + if (hash != fileInfo.filehash.md5) { console.log("MD5 hash does not match for map: ", mods[mod].title); toast.error(mods[mod].title + " didn't download correctly");