Update message only nags once per client
authorRemixDev <deezloaderremix@gmail.com>
Thu, 4 Apr 2019 15:48:28 +0000 (17:48 +0200)
committerRemixDev <deezloaderremix@gmail.com>
Thu, 4 Apr 2019 15:48:28 +0000 (17:48 +0200)
app/app.js
app/public/js/frontend.js

index e527ca76bf16c7deaa6e62629f1fdc8cc695088d..1f68bb382223914b00850f645013958d0b4ad5c2 100644 (file)
@@ -109,7 +109,9 @@ io.sockets.on('connection', function (s) {
                        lastVersion_MAJOR==currentVersion_MAJOR && lastVersion_MINOR==currentVersion_MINOR && lastVersion_PATCH>currentVersion_PATCH
                ){
                        logger.info("Update Available")
-                       s.emit("message", {title: `Version ${lastVersion_MAJOR}.${lastVersion_MINOR}.${lastVersion_PATCH} is available!`, msg: body.changelog})
+                       s.emit("messageUpdate", {title: `Version ${lastVersion_MAJOR}.${lastVersion_MINOR}.${lastVersion_PATCH} is available!`, msg: body.changelog, lastVersion: body.version})
+               }else{
+                       logger.info("Running the latest version!")
                }
        })
        .catch(error=>{
index c72498bc7f66ce1b62a1ec48831b5bcf3a7dac3e..ab0a3828e53c49e9c66763c6d3263ea4dee56120 100644 (file)
@@ -19,6 +19,13 @@ socket.on("message", function(desc){
        message(desc.title, desc.msg)
 })
 
+socket.on("messageUpdate", function(desc){
+       if (localStorage.getItem('updateModal') != desc.lastVersion){
+               message(desc.title, desc.msg)
+               localStorage.setItem('updateModal', desc.lastVersion)
+       }
+})
+
 // Prints object obj into console
 // For Debug purposes
 socket.on("printObj", function(obj){