mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 20:22:53 +00:00
updatenotification: add param to get modules from modules-dir instead… (#3755)
… from config implements #3739
This commit is contained in:
parent
2e57d785ac
commit
e546fedeb1
@ -22,6 +22,7 @@ planned for 2025-04-01
|
|||||||
- [newsfeed] Add specific ignoreOlderThan value (override) per feed (#3360)
|
- [newsfeed] Add specific ignoreOlderThan value (override) per feed (#3360)
|
||||||
- [weather] Added option Humidity to hourly View
|
- [weather] Added option Humidity to hourly View
|
||||||
- [weather] Added option to hide hourly entries that are Zero, hiding the entire column if empty.
|
- [weather] Added option to hide hourly entries that are Zero, hiding the entire column if empty.
|
||||||
|
- [updatenotification] Added option to iterate over modules directory instead using modules defined in `config.js` (#3739)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
const fs = require("node:fs");
|
||||||
|
const path = require("node:path");
|
||||||
const NodeHelper = require("node_helper");
|
const NodeHelper = require("node_helper");
|
||||||
const defaultModules = require("../defaultmodules");
|
const defaultModules = require("../defaultmodules");
|
||||||
const GitHelper = require("./git_helper");
|
const GitHelper = require("./git_helper");
|
||||||
@ -14,8 +16,23 @@ module.exports = NodeHelper.create({
|
|||||||
gitHelper: new GitHelper(),
|
gitHelper: new GitHelper(),
|
||||||
updateHelper: null,
|
updateHelper: null,
|
||||||
|
|
||||||
|
getModules (modules) {
|
||||||
|
if (this.config.useModulesFromConfig) {
|
||||||
|
return modules;
|
||||||
|
} else {
|
||||||
|
// get modules from modules-directory
|
||||||
|
const moduleDir = path.normalize(`${__dirname}/../../`);
|
||||||
|
const getDirectories = (source) => {
|
||||||
|
return fs.readdirSync(source, { withFileTypes: true })
|
||||||
|
.filter((dirent) => dirent.isDirectory() && dirent.name !== "default")
|
||||||
|
.map((dirent) => dirent.name);
|
||||||
|
};
|
||||||
|
return getDirectories(moduleDir);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
async configureModules (modules) {
|
async configureModules (modules) {
|
||||||
for (const moduleName of modules) {
|
for (const moduleName of this.getModules(modules)) {
|
||||||
if (!this.ignoreUpdateChecking(moduleName)) {
|
if (!this.ignoreUpdateChecking(moduleName)) {
|
||||||
await this.gitHelper.add(moduleName);
|
await this.gitHelper.add(moduleName);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,8 @@ Module.register("updatenotification", {
|
|||||||
sendUpdatesNotifications: false,
|
sendUpdatesNotifications: false,
|
||||||
updates: [],
|
updates: [],
|
||||||
updateTimeout: 2 * 60 * 1000, // max update duration
|
updateTimeout: 2 * 60 * 1000, // max update duration
|
||||||
updateAutorestart: false // autoRestart MM when update done ?
|
updateAutorestart: false, // autoRestart MM when update done ?
|
||||||
|
useModulesFromConfig: true // if `false` iterate over modules directory
|
||||||
},
|
},
|
||||||
|
|
||||||
suspended: false,
|
suspended: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user