Skip to content

Commit

Permalink
Adding support for ignoring update check for certain modules
Browse files Browse the repository at this point in the history
  • Loading branch information
buxxi committed Feb 11, 2020
1 parent d729594 commit c925e88
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 21 additions & 6 deletions modules/default/updatenotification/node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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 ){
this.updateProcessStarted=true;
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) {
Expand All @@ -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;
}

});
1 change: 1 addition & 0 deletions modules/default/updatenotification/updatenotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c925e88

Please sign in to comment.