mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +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)
|
- Set Timezone `Europe/Berlin` in unit tests (needed for new formatTime tests)
|
||||||
- Added no-param-reassign eslint rule and fix warnings
|
- Added no-param-reassign eslint rule and fix warnings
|
||||||
- updatenotification: Added `sendUpdatesNotifications` feature. Broadcast update with `UPDATES` notification to other modules
|
- updatenotification: Added `sendUpdatesNotifications` feature. Broadcast update with `UPDATES` notification to other modules
|
||||||
|
- updatenotification: allow force scanning with `SCAN_UPDATES` notification from other modules
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -25,15 +25,25 @@ module.exports = NodeHelper.create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
async socketNotificationReceived(notification, payload) {
|
async socketNotificationReceived(notification, payload) {
|
||||||
if (notification === "CONFIG") {
|
switch (notification) {
|
||||||
|
case "CONFIG":
|
||||||
this.config = payload;
|
this.config = payload;
|
||||||
} else if (notification === "MODULES") {
|
break;
|
||||||
|
case "MODULES":
|
||||||
// if this is the 1st time thru the update check process
|
// if this is the 1st time thru the update check process
|
||||||
if (!this.updateProcessStarted) {
|
if (!this.updateProcessStarted) {
|
||||||
this.updateProcessStarted = true;
|
this.updateProcessStarted = true;
|
||||||
await this.configureModules(payload);
|
await this.configureModules(payload);
|
||||||
await this.performFetch();
|
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) {
|
notificationReceived(notification) {
|
||||||
if (notification === "DOM_OBJECTS_CREATED") {
|
switch (notification) {
|
||||||
|
case "DOM_OBJECTS_CREATED":
|
||||||
this.sendSocketNotification("CONFIG", this.config);
|
this.sendSocketNotification("CONFIG", this.config);
|
||||||
this.sendSocketNotification("MODULES", Object.keys(Module.definitions));
|
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