diff options
author | 0neGal <mail@0negal.com> | 2024-12-20 18:24:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-20 18:24:40 +0100 |
commit | 4db50da2c75968f8c5ca6804e332da8de401a3e0 (patch) | |
tree | def65ef730f3ef794de06f46a003aa2685997cb0 /src/app/js/update.js | |
parent | 558ef98614b8ad34ba4fb35a8f0b6fe94211f938 (diff) | |
parent | fab59ba8b8b1c567ee158b9681c5b373fb7303e4 (diff) | |
download | Viper-4db50da2c75968f8c5ca6804e332da8de401a3e0.tar.gz Viper-4db50da2c75968f8c5ca6804e332da8de401a3e0.zip |
Merge branch 'main' into PR/onLine-event
Diffstat (limited to 'src/app/js/update.js')
-rw-r--r-- | src/app/js/update.js | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/app/js/update.js b/src/app/js/update.js index 6aa1b6d..d03db02 100644 --- a/src/app/js/update.js +++ b/src/app/js/update.js @@ -41,14 +41,16 @@ ipcRenderer.on("ns-update-event", (event, options) => { .innerText = `(${lang(key)})`; } + let delay, now; + switch(key) { case "cli.update.uptodate_short": case "cli.update.no_internet": // initial value - let delay = 0; + delay = 0; // get current time - let now = new Date().getTime(); + now = new Date().getTime(); // check if `update.ns.last_checked` was less than 500ms // since now, this variable is set when `update.ns()` is @@ -73,6 +75,32 @@ ipcRenderer.on("ns-update-event", (event, options) => { }, delay) break; + case "cli.update.failed": + // initial value + delay = 0; + + // get current time + now = new Date().getTime(); + + // check if `update.ns.last_checked` was less than 500ms + // since now, this variable is set when `update.ns()` is + // called + if (now - update.ns.last_checked < 500) { + // if less than 500ms has passed, set `delay` to the + // amount of milliseconds missing until we've hit that + // 500ms threshold + delay = 500 - (now - update.ns.last_checked); + } + + // Request version number + // this will also handle the play button label for us + ipcRenderer.send("get-version"); + + setTimeout(() => { + update_btn(); + set_buttons(true); + update.ns.progress(false); + }, delay) default: update_btn(); |