mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Merge pull request #1929 from buxxi/develop
Adding support for ignoring update check for certain modules
This commit is contained in:
commit
142d30b1c6
@ -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
|
||||
|
@ -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 ){
|
||||
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) {
|
||||
@ -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;
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user