Added semantic versioning check
authorRemixDev <DeezloaderRemix@gmail.com>
Mon, 3 Sep 2018 22:10:38 +0000 (00:10 +0200)
committerRemixDev <DeezloaderRemix@gmail.com>
Mon, 3 Sep 2018 22:10:38 +0000 (00:10 +0200)
app/app.js
update.json

index aa3f879b4c914eb7a6af2253629117b93565d076..90a7f9eca780325d7e92873af823b8297c0c6dd5 100644 (file)
@@ -97,18 +97,19 @@ function aldecrypt(encoded) {
 
 // START sockets clusterfuck
 io.sockets.on('connection', function (socket) {
-       var curVersion = package.version.replace(/\./g, '');
+       var currentVersion = {}
+       [currentVersion.MAJOR, currentVersion.MINOR, currentVersion.PATCH] = package.version.split(".");
        request({
                url: "https://notabug.org/RemixDevs/DeezloaderRemix/raw/master/update.json",
                json: true
        }, function(error, response, body) {
                if (!error && response.statusCode === 200) {
                        logger.info("Checking for updates")
-                       body = JSON.parse(body)
-                       logger.debug(body.version + " " +curVersion)
-                       if (parseInt(body.version) > parseInt(curVersion)) {
-                               logger.info("\n\nUpdate Available\n\n");
-                               socket.emit("message", {title: `New Version Aviable`, msg: body.changelog});
+                       var lastVersion = {}
+                       [lastVersion.MAJOR, lastVersion.MINOR, lastVersion.PATCH] = body.version.split(".");
+                       if (parseInt(lastVersion.MAJOR) > parseInt(currentVersion.MAJOR) || parseInt(lastVersion.MINOR) > parseInt(currentVersion.MINOR) || parseInt(lastVersion.PATCH) > parseInt(currentVersion.PATCH)) {
+                               logger.info("Update Available");
+                               socket.emit("message", {title: `Version ${lastVersion.MAJOR}.${lastVersion.MINOR}.${lastVersion.PATCH} is aviable!`, msg: body.changelog});
                        }
                } else {
                        logger.error(error + " " + response.statusCode);
index 177fbc10e5cd27847c3086203f9bc42ffa0e938e..bd3a8c67601b16b16e2bd2660169d6695daa8947 100644 (file)
@@ -1,5 +1,4 @@
 {
-  "version":"414",
-  "title": "Version 4.1.4 is now here!",
+  "version":"4.1.4",
   "changelog":"- Fixed Day Month position in DATE tag\r\n- Fixed %explicit% in name templates\r\n- Added default ID3 DATE tag format\r\n- Fixed artist download\r\n- Fixed FLAC Problems (not all of them)\r\n- Cleaned up some files\r\n- Added Update Notification\r\n- Improved Privacy in Server Mode\r\n- Removed ReplayGain as default setting\r\n- Added minimize to system tray\r\n- Added multitag separator for FLACS\r\n- Added hyperlinks to artist & album\r\n- Added option to remove duplicates in the artist tag\r\n- Added option to save the track with the full list of artist in the filename\r\n- Added option to overwrite padding size"
 }