Merge pull request #1929 from buxxi/develop

Adding support for ignoring update check for certain modules
This commit is contained in:
Michael Teeuw 2020-02-11 19:21:46 +01:00 committed by GitHub
commit 142d30b1c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 6 deletions

View File

@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- The `clock` module now optionally displays sun and moon data, including rise/set times, remaining daylight, and percent of moon illumination.
- Added Hebrew translation.
- Add HTTPS support and update config.js.sample
- Added the ability to configure a list of modules that shouldn't be update checked.
### Fixed

View File

@ -22,7 +22,7 @@ module.exports = NodeHelper.create({
simpleGits.push({"module": "default", "git": SimpleGit(path.normalize(__dirname + "/../../../"))});
for (moduleName in modules) {
if (defaultModules.indexOf(moduleName) < 0) {
if (!this.ignoreUpdateChecking(moduleName)) {
// Default modules are included in the main MagicMirror repo
var moduleFolder = path.normalize(__dirname + "/../../" + moduleName);
@ -56,15 +56,15 @@ module.exports = NodeHelper.create({
this.config = payload;
} else if(notification === "MODULES") {
// if this is the 1st time thru the update check process
if(this.updateProcessStarted==false ){
if (!this.updateProcessStarted) {
this.updateProcessStarted = true;
this.configureModules(payload);
this.preformFetch();
this.performFetch();
}
}
},
preformFetch() {
performFetch() {
var self = this;
simpleGits.forEach(function(sg) {
sg.git.fetch().status(function(err, data) {
@ -91,8 +91,23 @@ module.exports = NodeHelper.create({
var self = this;
clearTimeout(this.updateTimer);
this.updateTimer = setTimeout(function() {
self.preformFetch();
self.performFetch();
}, delay);
},
ignoreUpdateChecking: function(moduleName) {
// Should not check for updates for default modules
if (defaultModules.indexOf(moduleName) >= 0) {
return true;
}
// Should not check for updates for ignored modules
if (this.config.ignoreModules.indexOf(moduleName) >= 0) {
return true;
}
// The rest of the modules that passes should check for updates
return false;
}
});

View File

@ -3,6 +3,7 @@ Module.register("updatenotification", {
defaults: {
updateInterval: 10 * 60 * 1000, // every 10 minutes
refreshInterval: 24 * 60 * 60 * 1000, // one day
ignoreModules: []
},
suspended: false,