Skip to content

Commit 4dfc596

Browse files
authored
Merge pull request #51 from dathbe/updateCron
Update cron dependency version to eliminate vulnerabilities
2 parents 8ec7fa5 + dc77093 commit 4dfc596

File tree

4 files changed

+1597
-908
lines changed

4 files changed

+1597
-908
lines changed

README.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,13 @@ A [MagicMirror²](https://magicmirror.builders) helper module to schedule when m
1111

1212
## Installation
1313

14-
In your terminal, go to your MagicMirror's Module folder:
14+
In your terminal, go to your MagicMirror's Module folder, clone this repository, go to the modules folder, install the dependencies:
1515

1616
```
1717
cd ~/MagicMirror/modules
18-
```
19-
20-
Clone this repository:
21-
22-
```
2318
git clone https://github.com/ianperrin/MMM-ModuleScheduler.git
24-
```
25-
26-
Go to the modules folder:
27-
28-
```
2919
cd MMM-ModuleScheduler
30-
```
31-
32-
Install the dependencies:
33-
34-
```
35-
npm install --production
20+
npm install --omit=dev
3621
```
3722

3823
Add the module to the modules array in the `config/config.js` file:

node_helper.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ module.exports = NodeHelper.create({
132132

133133
// Store next dates
134134
if (i === 0 || showJob.nextDate().toDate() < nextShowDate) {
135-
nextShowDate = showJob.nextDate().toDate();
135+
nextShowDate = new Date(showJob.nextDate()); //.toDate();
136136
}
137137
if (i === 0 || hideJob.nextDate().toDate() < nextShowDate) {
138-
nextHideDate = hideJob.nextDate().toDate();
138+
nextHideDate = new Date(hideJob.nextDate()); //.toDate();
139139
nextDimLevel = moduleSchedule.dimLevel;
140140
}
141141
}
@@ -229,18 +229,18 @@ module.exports = NodeHelper.create({
229229
notification += type === SCHEDULE_TYPE_GLOBAL ? "S" : "";
230230

231231
try {
232-
var job = new CronJob({
233-
cronTime: cronTime,
234-
onTick: function () {
232+
var job = new CronJob(
233+
cronTime,
234+
function () {
235235
self.log(self.name + " is sending " + notification + " to " + options.target);
236236
self.sendSocketNotification(notification, options);
237237
self.log(self.name + " will next send " + notification + " to " + options.target + " at " + this.nextDate().toDate() + ' based on "' + cronTime + '"');
238238
},
239-
onComplete: function () {
239+
function () {
240240
self.log(self.name + " has completed the " + action + " job for " + options.target + ' based on "' + cronTime + '"');
241241
},
242-
start: true
243-
});
242+
true
243+
);
244244
return job;
245245
} catch (ex) {
246246
this.log(this.name + " could not create " + type + " schedule - check " + action + ' expression: "' + cronTime + '"');

0 commit comments

Comments
 (0)