diff --git a/CHANGELOG.md b/CHANGELOG.md index 3158a93016..8b4e635ace 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Thanks to: @bugsounet, @dkallen78, @jargordon, @khassel, @KristjanESPERANTO, @Ma ### Added +- [compliments] Added config for refreshing the remote file on an interval (default - no refresh) - [compliments] Added support for cron type date/time format entries mm hh DD MM dow (minutes/hours/days/months and day of week) see https://crontab.cronhub.io for construction (#3481) - [core] Check config at every start of MagicMirror² (#3450) - [core] Add spelling check (cspell): `npm run test:spelling` and handle spelling issues (#3544) diff --git a/modules/default/compliments/compliments.js b/modules/default/compliments/compliments.js index 4c4bef471f..90c17d37a7 100644 --- a/modules/default/compliments/compliments.js +++ b/modules/default/compliments/compliments.js @@ -12,6 +12,7 @@ Module.register("compliments", { }, updateInterval: 30000, remoteFile: null, + remoteFileRefreshInterval: null, fadeSpeed: 4000, morningStartTime: 3, morningEndTime: 12, @@ -41,6 +42,13 @@ Module.register("compliments", { const response = await this.loadComplimentFile(); this.config.compliments = JSON.parse(response); this.updateDom(); + if (this.config.remoteFileRefreshInterval != null) { + this.remoteFileRefreshFunc = setInterval(() => { + const response = await this.loadComplimentFile(); + this.config.compliments = JSON.parse(response); + this.lastIndexUsed = -1; + }, this.config.remoteFileRefreshInterval) + } } let minute_sync_delay = 1; // loop thru all the configured when events