mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Merge branch 'develop' into master
This commit is contained in:
commit
bcd97120a4
12
CHANGELOG.md
12
CHANGELOG.md
@ -7,10 +7,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror² core.
|
❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror² core.
|
||||||
|
|
||||||
## [2.9.0] - 2019-10-01
|
## [2.9.0] - Unreleased (Develop Branch)
|
||||||
|
|
||||||
|
*This release is scheduled to be released on 2019-10-01.*
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
### Updated
|
||||||
|
- Updatenotification module: Display update notification for a limited (configurable) time.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Send `NEWS_FEED` Notification also for the first newsmessage which are shown
|
- Updatenotification module: Properly handle race conditions, prevent crash.
|
||||||
|
- Send `NEWS_FEED` notification also for the first news messages which are shown
|
||||||
|
|
||||||
## [2.8.0] - 2019-07-01
|
## [2.8.0] - 2019-07-01
|
||||||
|
|
||||||
|
@ -10,11 +10,17 @@ module.exports = NodeHelper.create({
|
|||||||
config: {},
|
config: {},
|
||||||
|
|
||||||
updateTimer: null,
|
updateTimer: null,
|
||||||
|
updateProcessStarted: false,
|
||||||
|
|
||||||
start: function () {
|
start: function () {
|
||||||
},
|
},
|
||||||
|
|
||||||
configureModules: function(modules) {
|
configureModules: function(modules) {
|
||||||
|
|
||||||
|
// Push MagicMirror itself , biggest chance it'll show up last in UI and isn't overwritten
|
||||||
|
// others will be added in front, asynchronously
|
||||||
|
simpleGits.push({"module": "default", "git": SimpleGit(path.normalize(__dirname + "/../../../"))});
|
||||||
|
|
||||||
for (moduleName in modules) {
|
for (moduleName in modules) {
|
||||||
if (defaultModules.indexOf(moduleName) < 0) {
|
if (defaultModules.indexOf(moduleName) < 0) {
|
||||||
// Default modules are included in the main MagicMirror repo
|
// Default modules are included in the main MagicMirror repo
|
||||||
@ -22,6 +28,7 @@ module.exports = NodeHelper.create({
|
|||||||
|
|
||||||
var stat;
|
var stat;
|
||||||
try {
|
try {
|
||||||
|
//console.log("checking git for module="+moduleName)
|
||||||
stat = fs.statSync(path.join(moduleFolder, ".git"));
|
stat = fs.statSync(path.join(moduleFolder, ".git"));
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
// Error when directory .git doesn't exist
|
// Error when directory .git doesn't exist
|
||||||
@ -36,30 +43,29 @@ module.exports = NodeHelper.create({
|
|||||||
// No valid remote for folder, skip
|
// No valid remote for folder, skip
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Folder has .git and has at least one git remote, watch this folder
|
// Folder has .git and has at least one git remote, watch this folder
|
||||||
simpleGits.push({"module": mn, "git": git});
|
simpleGits.unshift({"module": mn, "git": git});
|
||||||
});
|
});
|
||||||
}(moduleName, moduleFolder);
|
}(moduleName, moduleFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push MagicMirror itself last, biggest chance it'll show up last in UI and isn't overwritten
|
|
||||||
simpleGits.push({"module": "default", "git": SimpleGit(path.normalize(__dirname + "/../../../"))});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
socketNotificationReceived: function (notification, payload) {
|
socketNotificationReceived: function (notification, payload) {
|
||||||
if (notification === "CONFIG") {
|
if (notification === "CONFIG") {
|
||||||
this.config = payload;
|
this.config = payload;
|
||||||
} else if(notification === "MODULES") {
|
} else if(notification === "MODULES") {
|
||||||
this.configureModules(payload);
|
// if this is the 1st time thru the update check process
|
||||||
this.preformFetch();
|
if(this.updateProcessStarted==false ){
|
||||||
|
this.updateProcessStarted=true;
|
||||||
|
this.configureModules(payload);
|
||||||
|
this.preformFetch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
preformFetch() {
|
preformFetch() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
simpleGits.forEach(function(sg) {
|
simpleGits.forEach(function(sg) {
|
||||||
sg.git.fetch().status(function(err, data) {
|
sg.git.fetch().status(function(err, data) {
|
||||||
data.module = sg.module;
|
data.module = sg.module;
|
||||||
|
@ -2,40 +2,56 @@ Module.register("updatenotification", {
|
|||||||
|
|
||||||
defaults: {
|
defaults: {
|
||||||
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
||||||
|
refreshInterval: 24 * 60 * 60 * 1000, // one day
|
||||||
},
|
},
|
||||||
|
|
||||||
status: false,
|
suspended: false,
|
||||||
|
moduleList: {},
|
||||||
|
|
||||||
start: function () {
|
start: function () {
|
||||||
|
var self = this;
|
||||||
Log.log("Start updatenotification");
|
Log.log("Start updatenotification");
|
||||||
|
setInterval( () => { self.moduleList = {};self.updateDom(2) } , self.config.refreshInterval)
|
||||||
},
|
},
|
||||||
|
|
||||||
notificationReceived: function (notification, payload, sender) {
|
notificationReceived: function (notification, payload, sender) {
|
||||||
if (notification === "DOM_OBJECTS_CREATED") {
|
if (notification === "DOM_OBJECTS_CREATED") {
|
||||||
this.sendSocketNotification("CONFIG", this.config);
|
this.sendSocketNotification("CONFIG", this.config);
|
||||||
this.sendSocketNotification("MODULES", Module.definitions);
|
this.sendSocketNotification("MODULES", Module.definitions);
|
||||||
this.hide(0, { lockString: self.identifier });
|
//this.hide(0, { lockString: self.identifier });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
socketNotificationReceived: function (notification, payload) {
|
socketNotificationReceived: function (notification, payload) {
|
||||||
if (notification === "STATUS") {
|
if (notification === "STATUS") {
|
||||||
this.status = payload;
|
this.updateUI(payload);
|
||||||
this.updateUI();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateUI: function () {
|
updateUI: function (payload) {
|
||||||
var self = this;
|
var self = this;
|
||||||
if (this.status && this.status.behind > 0) {
|
if (payload && payload.behind > 0) {
|
||||||
self.updateDom(0);
|
// if we haven't seen info for this module
|
||||||
self.show(1000, { lockString: self.identifier });
|
if(this.moduleList[payload.module] == undefined){
|
||||||
}
|
// save it
|
||||||
|
this.moduleList[payload.module]=payload;
|
||||||
|
self.updateDom(2);
|
||||||
|
}
|
||||||
|
//self.show(1000, { lockString: self.identifier });
|
||||||
|
|
||||||
|
} else if (payload && payload.behind == 0){
|
||||||
|
// if the module WAS in the list, but shouldn't be
|
||||||
|
if(this.moduleList[payload.module] != undefined){
|
||||||
|
// remove it
|
||||||
|
delete this.moduleList[payload.module]
|
||||||
|
self.updateDom(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
diffLink: function(text) {
|
diffLink: function(module, text) {
|
||||||
var localRef = this.status.hash;
|
var localRef = module.hash;
|
||||||
var remoteRef = this.status.tracking.replace(/.*\//, "");
|
var remoteRef = module.tracking.replace(/.*\//, "");
|
||||||
return "<a href=\"https://github.com/MichMich/MagicMirror/compare/"+localRef+"..."+remoteRef+"\" "+
|
return "<a href=\"https://github.com/MichMich/MagicMirror/compare/"+localRef+"..."+remoteRef+"\" "+
|
||||||
"class=\"xsmall dimmed\" "+
|
"class=\"xsmall dimmed\" "+
|
||||||
"style=\"text-decoration: none;\" "+
|
"style=\"text-decoration: none;\" "+
|
||||||
@ -47,41 +63,53 @@ Module.register("updatenotification", {
|
|||||||
// Override dom generator.
|
// Override dom generator.
|
||||||
getDom: function () {
|
getDom: function () {
|
||||||
var wrapper = document.createElement("div");
|
var wrapper = document.createElement("div");
|
||||||
|
if(this.suspended==false){
|
||||||
|
// process the hash of module info found
|
||||||
|
for(key of Object.keys(this.moduleList)){
|
||||||
|
let m= this.moduleList[key]
|
||||||
|
|
||||||
if (this.status && this.status.behind > 0) {
|
var message = document.createElement("div");
|
||||||
var message = document.createElement("div");
|
message.className = "small bright";
|
||||||
message.className = "small bright";
|
|
||||||
|
|
||||||
var icon = document.createElement("i");
|
var icon = document.createElement("i");
|
||||||
icon.className = "fa fa-exclamation-circle";
|
icon.className = "fa fa-exclamation-circle";
|
||||||
icon.innerHTML = " ";
|
icon.innerHTML = " ";
|
||||||
message.appendChild(icon);
|
message.appendChild(icon);
|
||||||
|
|
||||||
var updateInfoKeyName = this.status.behind === 1 ? "UPDATE_INFO_SINGLE" : "UPDATE_INFO_MULTIPLE";
|
var updateInfoKeyName = m.behind == 1 ? "UPDATE_INFO_SINGLE" : "UPDATE_INFO_MULTIPLE";
|
||||||
var subtextHtml = this.translate(updateInfoKeyName, {
|
|
||||||
COMMIT_COUNT: this.status.behind,
|
|
||||||
BRANCH_NAME: this.status.current
|
|
||||||
});
|
|
||||||
|
|
||||||
var text = document.createElement("span");
|
var subtextHtml = this.translate(updateInfoKeyName, {
|
||||||
if (this.status.module === "default") {
|
COMMIT_COUNT: m.behind,
|
||||||
text.innerHTML = this.translate("UPDATE_NOTIFICATION");
|
BRANCH_NAME: m.current
|
||||||
subtextHtml = this.diffLink(subtextHtml);
|
|
||||||
} else {
|
|
||||||
text.innerHTML = this.translate("UPDATE_NOTIFICATION_MODULE", {
|
|
||||||
MODULE_NAME: this.status.module
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var text = document.createElement("span");
|
||||||
|
if (m.module == "default") {
|
||||||
|
text.innerHTML = this.translate("UPDATE_NOTIFICATION");
|
||||||
|
subtextHtml = this.diffLink(m,subtextHtml);
|
||||||
|
} else {
|
||||||
|
text.innerHTML = this.translate("UPDATE_NOTIFICATION_MODULE", {
|
||||||
|
MODULE_NAME: m.module
|
||||||
|
});
|
||||||
|
}
|
||||||
|
message.appendChild(text);
|
||||||
|
|
||||||
|
wrapper.appendChild(message);
|
||||||
|
|
||||||
|
var subtext = document.createElement("div");
|
||||||
|
subtext.innerHTML = subtextHtml;
|
||||||
|
subtext.className = "xsmall dimmed";
|
||||||
|
wrapper.appendChild(subtext);
|
||||||
}
|
}
|
||||||
message.appendChild(text);
|
|
||||||
|
|
||||||
wrapper.appendChild(message);
|
|
||||||
|
|
||||||
var subtext = document.createElement("div");
|
|
||||||
subtext.innerHTML = subtextHtml;
|
|
||||||
subtext.className = "xsmall dimmed";
|
|
||||||
wrapper.appendChild(subtext);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return wrapper;
|
return wrapper;
|
||||||
|
},
|
||||||
|
|
||||||
|
suspend: function() {
|
||||||
|
this.suspended=true;
|
||||||
|
},
|
||||||
|
resume: function() {
|
||||||
|
this.suspended=false;
|
||||||
|
this.updateDom(2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "magicmirror",
|
"name": "magicmirror",
|
||||||
"version": "2.8.0",
|
"version": "2.9.0-develop",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "magicmirror",
|
"name": "magicmirror",
|
||||||
"version": "2.8.0",
|
"version": "2.9.0-develop",
|
||||||
"description": "The open source modular smart mirror platform.",
|
"description": "The open source modular smart mirror platform.",
|
||||||
"main": "js/electron.js",
|
"main": "js/electron.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user