mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Merge pull request #2884 from khassel/newsfeed-ttl
respect rss ttl provided by newsfeed
This commit is contained in:
commit
a4bb1cefb9
@ -16,6 +16,7 @@ _This release is scheduled to be released on 2022-10-01._
|
|||||||
## Fixed
|
## Fixed
|
||||||
|
|
||||||
- Broadcast all calendar events while still honoring global and per-calendar maximumEntries.
|
- Broadcast all calendar events while still honoring global and per-calendar maximumEntries.
|
||||||
|
- Respect rss ttl provided by newsfeed (#2883).
|
||||||
|
|
||||||
## [2.20.0] - 2022-07-02
|
## [2.20.0] - 2022-07-02
|
||||||
|
|
||||||
|
@ -78,6 +78,19 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings
|
|||||||
scheduleTimer();
|
scheduleTimer();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
parser.on("ttl", (minutes) => {
|
||||||
|
try {
|
||||||
|
// 86400000 = 24 hours is mentioned in the docs as maximum value:
|
||||||
|
const ttlms = Math.min(minutes * 60 * 1000, 86400000);
|
||||||
|
if (ttlms > reloadInterval) {
|
||||||
|
reloadInterval = ttlms;
|
||||||
|
Log.info("Newsfeed-Fetcher: reloadInterval set to ttl=" + reloadInterval + " for url " + url);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
Log.warn("Newsfeed-Fetcher: feed ttl is no valid integer=" + minutes + " for url " + url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
|
const nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
|
||||||
const headers = {
|
const headers = {
|
||||||
"User-Agent": "Mozilla/5.0 (Node.js " + nodeVersion + ") MagicMirror/" + global.version,
|
"User-Agent": "Mozilla/5.0 (Node.js " + nodeVersion + ") MagicMirror/" + global.version,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user