mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Remote force check update (#3127)
updatenotification: allow force scanning with `SCAN_UPDATES` notification from other modules
This commit is contained in:
parent
e985e99036
commit
c1850f2577
@ -16,6 +16,7 @@ _This release is scheduled to be released on 2023-07-01._
|
||||
- Set Timezone `Europe/Berlin` in unit tests (needed for new formatTime tests)
|
||||
- Added no-param-reassign eslint rule and fix warnings
|
||||
- updatenotification: Added `sendUpdatesNotifications` feature. Broadcast update with `UPDATES` notification to other modules
|
||||
- updatenotification: allow force scanning with `SCAN_UPDATES` notification from other modules
|
||||
|
||||
### Removed
|
||||
|
||||
|
@ -25,15 +25,25 @@ module.exports = NodeHelper.create({
|
||||
},
|
||||
|
||||
async socketNotificationReceived(notification, payload) {
|
||||
if (notification === "CONFIG") {
|
||||
switch (notification) {
|
||||
case "CONFIG":
|
||||
this.config = payload;
|
||||
} else if (notification === "MODULES") {
|
||||
break;
|
||||
case "MODULES":
|
||||
// if this is the 1st time thru the update check process
|
||||
if (!this.updateProcessStarted) {
|
||||
this.updateProcessStarted = true;
|
||||
await this.configureModules(payload);
|
||||
await this.performFetch();
|
||||
}
|
||||
break;
|
||||
case "SCAN_UPDATES":
|
||||
// 1st time of check allows to force new scan
|
||||
if (this.updateProcessStarted) {
|
||||
clearTimeout(this.updateTimer);
|
||||
await this.performFetch();
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -34,9 +34,14 @@ Module.register("updatenotification", {
|
||||
},
|
||||
|
||||
notificationReceived(notification) {
|
||||
if (notification === "DOM_OBJECTS_CREATED") {
|
||||
switch (notification) {
|
||||
case "DOM_OBJECTS_CREATED":
|
||||
this.sendSocketNotification("CONFIG", this.config);
|
||||
this.sendSocketNotification("MODULES", Object.keys(Module.definitions));
|
||||
break;
|
||||
case "SCAN_UPDATES":
|
||||
this.sendSocketNotification("SCAN_UPDATES");
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user