diff options
author | Alystrasz <contact@remyraes.com> | 2021-12-28 22:49:11 +0100 |
---|---|---|
committer | Alystrasz <contact@remyraes.com> | 2021-12-28 22:49:11 +0100 |
commit | 30fc024406227c89dc3c6d5a067f21a991d1e20c (patch) | |
tree | 367a3c7e3752f2c4c9c0bf047e4e300c355ee536 | |
parent | 810176c592c5cc071dd8ca14ed9519b38e1c96d9 (diff) | |
download | Viper-30fc024406227c89dc3c6d5a067f21a991d1e20c.tar.gz Viper-30fc024406227c89dc3c6d5a067f21a991d1e20c.zip |
[feat] latest update is not downloaded if it's already installed
-rw-r--r-- | src/utils.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/utils.js b/src/utils.js index a6be21d..c5bf05e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -65,9 +65,8 @@ function update() { } } - console.log("Downloading..."); + console.log("Checking for updates..."); const version = getNorthstarInstalledVersion(); - console.log(version); request({ json: true, @@ -75,7 +74,14 @@ function update() { url: "https://api.github.com/repos/R2Northstar/Northstar/releases/latest", }, (error, response, body) => { const tag = body['tag_name']; - console.log(tag); + + console.log('current version:', version); + console.log('remote version:', tag); + + if (version === tag) { + console.log('Latest version is already installed, skipping update.'); + return; + } https.get(body.assets[0].browser_download_url, (res) => { let stream = fs.createWriteStream(settings.zip); |