From c40f64fdb90f4e0ef07ab8f8acc041b5760def81 Mon Sep 17 00:00:00 2001 From: Ipmake <60793254+Ipmake@users.noreply.github.com> Date: Tue, 11 Apr 2023 15:55:14 +0200 Subject: [PATCH] Hotfix, was just an issue with adding strings --- package.json | 2 +- public/electron.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 2e13bb5..fe5cba9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "knockoutcitylauncher", "description": "Unofficial Knockout City Launcher", - "version": "0.1.3", + "version": "0.1.4", "private": true, "homepage": "./", "main": "public/electron.js", diff --git a/public/electron.js b/public/electron.js index ee58a43..2089299 100644 --- a/public/electron.js +++ b/public/electron.js @@ -121,8 +121,9 @@ function createWindow () { }); res.on('data', (chunk) => { - win.webContents.executeJavaScript(`window.postMessage({type: "download-progress", data: ${roundToDecimalPlace(((fileSize + writeStream.bytesWritten) / (res.headers['content-length'] + fileSize)) * 100, 2)}})`) - win.setProgressBar((fileSize + writeStream.bytesWritten) / (res.headers['content-length'] + fileSize)) + console.log((fileSize + writeStream.bytesWritten) / (parseFloat(res.headers['content-length']) + fileSize)) + win.webContents.executeJavaScript(`window.postMessage({type: "download-progress", data: ${roundToDecimalPlace(((fileSize + writeStream.bytesWritten) / (parseFloat(res.headers['content-length']) + fileSize)) * 100, 2)}})`) + win.setProgressBar((fileSize + writeStream.bytesWritten) / (parseFloat(res.headers['content-length']) + fileSize)) }); ipcMain.once('cancel-download', async (event, arg) => {