aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2024-12-20 13:08:59 +0100
committerGitHub <noreply@github.com>2024-12-20 13:08:59 +0100
commit8fddf38701f50015ee8f61ce7bc8978f1dcebfd3 (patch)
treea94eb7a0a5b1e469839a6a14400e15be2b61c5b2 /src/app
parent14c12f9bf74f7ae7e9b4b873e67b8e9769cdad1e (diff)
parent4ae37f2f520c8082a00cc52f33ea0c1877709d6f (diff)
downloadViper-8fddf38701f50015ee8f61ce7bc8978f1dcebfd3.tar.gz
Viper-8fddf38701f50015ee8f61ce7bc8978f1dcebfd3.zip
Merge pull request #249 from Jan200101/PR/handle-permission-error
feat: handle unzip errors
Diffstat (limited to 'src/app')
-rw-r--r--src/app/js/toasts.js2
-rw-r--r--src/app/js/update.js32
2 files changed, 31 insertions, 3 deletions
diff --git a/src/app/js/toasts.js b/src/app/js/toasts.js
index 83ddf6a..bd9d03a 100644
--- a/src/app/js/toasts.js
+++ b/src/app/js/toasts.js
@@ -75,7 +75,7 @@ toasts.dismiss = (id) => {
}
ipcRenderer.on("toast", (_, properties) => {
- Toast(properties);
+ toasts.show(properties);
})
module.exports = toasts;
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();