diff --git a/modules/default/updatenotification/node_helper.js b/modules/default/updatenotification/node_helper.js index 862087d8..c6a38da1 100644 --- a/modules/default/updatenotification/node_helper.js +++ b/modules/default/updatenotification/node_helper.js @@ -1,4 +1,7 @@ -var simpleGit = require("simple-git")(__dirname + "/../.."); +var SimpleGit = require("simple-git"); +var simpleGits = []; +var fs = require("fs"); +var path = require("path"); var NodeHelper = require("node_helper"); module.exports = NodeHelper.create({ @@ -8,7 +11,19 @@ module.exports = NodeHelper.create({ updateTimer: null, start: function () { - + var srcdir = __dirname + "/../../"; + fs.readdir(srcdir, function(err, names) { + if (err) { + console.error("Error reading dir " + srcdir + ": " + err); + return; + } + + names.filter(function(name) { + return fs.statSync(path.join(srcdir, name)).isDirectory() && name != "node_modules"; + }).forEach(function(name) { + simpleGits.push({"module": name, "git": SimpleGit(path.join(srcdir, name))}); + }); + }); }, socketNotificationReceived: function (notification, payload) { @@ -20,10 +35,14 @@ module.exports = NodeHelper.create({ preformFetch() { var self = this; - simpleGit.fetch().status(function(err, data) { - if (!err) { - self.sendSocketNotification("STATUS", data); - } + + simpleGits.forEach(function(sg) { + sg.git.fetch().status(function(err, data) { + data.module = sg.module; + if (!err) { + self.sendSocketNotification("STATUS", data); + } + }); }); this.scheduleNextFetch(this.config.updateInterval); diff --git a/modules/default/updatenotification/updatenotification.js b/modules/default/updatenotification/updatenotification.js index cd2ba42c..2f0870ed 100644 --- a/modules/default/updatenotification/updatenotification.js +++ b/modules/default/updatenotification/updatenotification.js @@ -49,7 +49,11 @@ Module.register("updatenotification", { message.appendChild(icon); var text = document.createElement("span"); - text.innerHTML = this.translate("UPDATE_NOTIFICATION"); + if (this.status.module == "default") { + text.innerHTML = this.translate("UPDATE_NOTIFICATION"); + } else { + text.innerHTML = this.translate("UPDATE_NOTIFICATION_MODULE").replace("MODULE_NAME", this.status.module); + } message.appendChild(text); wrapper.appendChild(message); diff --git a/translations/en.json b/translations/en.json index 0ea83e56..916b81ca 100644 --- a/translations/en.json +++ b/translations/en.json @@ -29,5 +29,6 @@ /* UPDATE INFO */ "UPDATE_NOTIFICATION": "MagicMirror² update available.", + "UPDATE_NOTIFICATION_MODULE": "Update available for MODULE_NAME module.", "UPDATE_INFO": "The current installation is COMMIT_COUNT behind on the BRANCH_NAME branch." } diff --git a/translations/nl.json b/translations/nl.json index 582b62e6..e2d1c8c4 100644 --- a/translations/nl.json +++ b/translations/nl.json @@ -29,5 +29,6 @@ /* UPDATE INFO */ "UPDATE_NOTIFICATION": "MagicMirror² update beschikbaar.", + "UPDATE_NOTIFICATION_MODULE": "Update beschikbaar voor MODULE_NAME module.", "UPDATE_INFO": "De huidige installatie loopt COMMIT_COUNT achter op de BRANCH_NAME branch." }