From 3a4902ad4ada92fe560c8e54b86f28b39701ecff Mon Sep 17 00:00:00 2001 From: Jon Kolb Date: Wed, 13 Feb 2019 23:44:10 +0000 Subject: [PATCH 01/17] Fix null dereference in moduleNeedsUpdate when the module isn't visible --- CHANGELOG.md | 1 + js/main.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb8526de..a543e80c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Installation script problems with raspbian - Calendar: only show repeating count if the event is actually repeating [#1534](https://github.com/MichMich/MagicMirror/pull/1534) - Calendar: Fix exdate handling when multiple values are specified (comma separated) +- Fix null dereference in moduleNeedsUpdate when the module isn't visible ### New weather module - Fixed weather forecast table display [#1499](https://github.com/MichMich/MagicMirror/issues/1499). diff --git a/js/main.js b/js/main.js index 7ec9b5f3..21a882f8 100644 --- a/js/main.js +++ b/js/main.js @@ -173,6 +173,10 @@ var MM = (function() { */ var moduleNeedsUpdate = function(module, newHeader, newContent) { var moduleWrapper = document.getElementById(module.identifier); + if (moduleWrapper === null) { + return false; + } + var contentWrapper = moduleWrapper.getElementsByClassName("module-content"); var headerWrapper = moduleWrapper.getElementsByClassName("module-header"); From 954253c7e2059386ad3d60fa33457881ec0e6262 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Fri, 15 Feb 2019 11:15:06 +0100 Subject: [PATCH 02/17] Remove Slack. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index e4248411..1cadc57a 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ License Travis Known Vulnerabilities - Slack Status

**MagicMirror²** is an open source modular smart mirror platform. With a growing list of installable modules, the **MagicMirror²** allows you to convert your hallway or bathroom mirror into your personal assistant. **MagicMirror²** is built by the creator of [the original MagicMirror](http://michaelteeuw.nl/tagged/magicmirror) with the incredible help of a [growing community of contributors](https://github.com/MichMich/MagicMirror/graphs/contributors). From 9686a9ba775aab94b53fdf91242d16426acb0686 Mon Sep 17 00:00:00 2001 From: Sam Detweiler Date: Mon, 18 Feb 2019 07:18:07 -0600 Subject: [PATCH 03/17] fix relative date fulldate events to use start of dat to start of day difference --- CHANGELOG.md | 1 + modules/default/calendar/calendar.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d97166d..5e591e59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Installation script problems with raspbian - Calendar: only show repeating count if the event is actually repeating [#1534](https://github.com/MichMich/MagicMirror/pull/1534) - Calendar: Fix exdate handling when multiple values are specified (comma separated) +- Calendar: Fix relative date handling for fulldate events, calculate difference always from start of day [#1572] (https://github.com/MichMich/MagicMirror/issues/1572) - Fix null dereference in moduleNeedsUpdate when the module isn't visible ### New weather module diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 2c2970ec..96ab322c 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -302,7 +302,7 @@ Module.register("calendar", { timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").format(this.config.fullDayEventDateFormat)); } } else { - timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow()); + timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").from(moment().format("YYYYMMDD"))); } } if(this.config.showEnd){ From a06ca55107fbe6399ede038afe268138eaf3571f Mon Sep 17 00:00:00 2001 From: Sam Detweiler Date: Mon, 18 Feb 2019 07:30:46 -0600 Subject: [PATCH 04/17] fix relative date fulldate events to use start of dat to start of day difference, fix extra space in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e591e59..153031cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Installation script problems with raspbian - Calendar: only show repeating count if the event is actually repeating [#1534](https://github.com/MichMich/MagicMirror/pull/1534) - Calendar: Fix exdate handling when multiple values are specified (comma separated) -- Calendar: Fix relative date handling for fulldate events, calculate difference always from start of day [#1572] (https://github.com/MichMich/MagicMirror/issues/1572) +- Calendar: Fix relative date handling for fulldate events, calculate difference always from start of day [#1572](https://github.com/MichMich/MagicMirror/issues/1572) - Fix null dereference in moduleNeedsUpdate when the module isn't visible ### New weather module From 2d8acec6f006b038c005364f1f9f667ebd8411a6 Mon Sep 17 00:00:00 2001 From: Dirk Date: Mon, 18 Feb 2019 21:04:56 +0100 Subject: [PATCH 05/17] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d97166d..0ef559ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added autoLocation options for weather forcast and current weather modules. - Added autoTimezone option for the default clock module. - Danish translation for "Feels" and "Weeks" +- Added option to split multiple day events in calendar to separate numbered events ### Updated - Bumped the Electron dependency to v3.0.13 to support the most recent Raspbian. [#1500](https://github.com/MichMich/MagicMirror/issues/1500) From d9fcc46994bda99bb6705b329d7960f8d4a6e01b Mon Sep 17 00:00:00 2001 From: Dirk Date: Mon, 18 Feb 2019 21:11:24 +0100 Subject: [PATCH 06/17] included split function to split multiday events --- modules/default/calendar/README.md | 2 ++ modules/default/calendar/calendar.js | 29 ++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/modules/default/calendar/README.md b/modules/default/calendar/README.md index b272a2d2..e3938bda 100755 --- a/modules/default/calendar/README.md +++ b/modules/default/calendar/README.md @@ -52,6 +52,8 @@ The following properties can be configured: | `hidePrivate` | Hides private calendar events.

**Possible values:** `true` or `false`
**Default value:** `false` | `hideOngoing` | Hides calendar events that have already started.

**Possible values:** `true` or `false`
**Default value:** `false` | `excludedEvents` | An array of words / phrases from event titles that will be excluded from being shown.

Additionally advanced filter objects can be passed in. Below is the configuration for the advance filtering object.
**Required**
`filterBy` - string used to determine if filter is applied.
**Optional**
`until` - Time before an event to display it Ex: [`'3 days'`, `'2 months'`, `'1 week'`]
`caseSensitive` - By default, excludedEvents are case insensitive, set this to true to enforce case sensitivity
`regex` - set to `true` if filterBy is a regex. For those not familiar with regex it is used for pattern matching, please see [here](https://regexr.com/) for more info.

**Example:** `['Birthday', 'Hide This Event', {filterBy: 'Payment', until: '6 days', caseSensitive: true}, {filterBy: '^[0-9]{1,}.*', regex: true}]`
**Default value:** `[]` +| `sliceMultiDayEvents` | If this is set to true, events exceeding at least one midnight will be sliced into separate events including a counter like (1/2). This is especially helpful in "dateheaders" mode. Events will be sliced at midnight, end time for all events but the last will be 23:59 **Default value:** `true` + ### Calendar configuration diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 38b04269..2023b79a 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -46,7 +46,8 @@ Module.register("calendar", { "'s birthday": "" }, broadcastEvents: true, - excludedEvents: [] + excludedEvents: [], + sliceMultiDayEvents: false }, // Define required scripts. @@ -447,7 +448,31 @@ Module.register("calendar", { } event.url = c; event.today = event.startDate >= today && event.startDate < (today + 24 * 60 * 60 * 1000); - events.push(event); + + /* if sliceMultiDayEvents is set to true, multiday events (events exceeding at least one midnight) are sliced into days, + * otherwise, esp. in dateheaders mode it is not clear how long these events are. + */ + if (this.config.sliceMultiDayEvents) { + var midnight = moment(event.startDate, "x").clone().startOf("day").add(1, "day").format("x"); //next midnight + var count = 1; + var maxCount = Math.ceil(((event.endDate - 1) - moment(event.startDate, "x").endOf('day').format("x"))/(1000*60*60*24)) + 1 + if (event.endDate > midnight) { + while (event.endDate > midnight) { + var nextEvent = JSON.parse(JSON.stringify(event)); //make a copy without reference to the original event + nextEvent.startDate = midnight; + event.endDate = midnight; + event.title += " ("+count+"/"+maxCount+")"; + events.push(event); + event = nextEvent; + count += 1; + midnight = moment(midnight, "x").add(1, "day").format("x"); //move further one day for next split + } + event.title += " ("+count+"/"+maxCount+")"; + } + events.push(event); + } else { + events.push(event); + } } } From 2b2e8508d9aebf450c7a81cd7db4b185521b4bc3 Mon Sep 17 00:00:00 2001 From: Dirk Date: Mon, 18 Feb 2019 22:38:28 +0100 Subject: [PATCH 07/17] Update calendar.js Small updates for travis cr check --- modules/default/calendar/calendar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 3fef3846..3a8d05bc 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -456,13 +456,13 @@ Module.register("calendar", { if (this.config.sliceMultiDayEvents) { var midnight = moment(event.startDate, "x").clone().startOf("day").add(1, "day").format("x"); //next midnight var count = 1; - var maxCount = Math.ceil(((event.endDate - 1) - moment(event.startDate, "x").endOf('day').format("x"))/(1000*60*60*24)) + 1 + var maxCount = Math.ceil(((event.endDate - 1) - moment(event.startDate, "x").endOf("day").format("x"))/(1000*60*60*24)) + 1 if (event.endDate > midnight) { while (event.endDate > midnight) { var nextEvent = JSON.parse(JSON.stringify(event)); //make a copy without reference to the original event nextEvent.startDate = midnight; event.endDate = midnight; - event.title += " ("+count+"/"+maxCount+")"; + event.title += " (" + count + "/" + maxCount + ")"; events.push(event); event = nextEvent; count += 1; From 24238094e551dc512698ae306e9e12234fc990ac Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Tue, 19 Feb 2019 13:43:23 +0100 Subject: [PATCH 08/17] Fix url. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e591e59..153031cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Installation script problems with raspbian - Calendar: only show repeating count if the event is actually repeating [#1534](https://github.com/MichMich/MagicMirror/pull/1534) - Calendar: Fix exdate handling when multiple values are specified (comma separated) -- Calendar: Fix relative date handling for fulldate events, calculate difference always from start of day [#1572] (https://github.com/MichMich/MagicMirror/issues/1572) +- Calendar: Fix relative date handling for fulldate events, calculate difference always from start of day [#1572](https://github.com/MichMich/MagicMirror/issues/1572) - Fix null dereference in moduleNeedsUpdate when the module isn't visible ### New weather module From 7630c25ef3448a4327b4fa40d24d51916b2d1d40 Mon Sep 17 00:00:00 2001 From: Sam Detweiler Date: Tue, 19 Feb 2019 07:06:22 -0600 Subject: [PATCH 09/17] add future date offset correction for emergency date values in absolute mode --- modules/default/calendar/calendar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 96ab322c..3f4f3f52 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -297,7 +297,7 @@ Module.register("calendar", { if (this.config.timeFormat === "absolute") { if ((this.config.urgency > 1) && (event.startDate - now < (this.config.urgency * oneDay))) { // This event falls within the config.urgency period that the user has set - timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow()); + timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").from(moment().format("YYYYMMDD"))); } else { timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").format(this.config.fullDayEventDateFormat)); } From feb5351ec3036e016aec56b31dac8cf80fd5d194 Mon Sep 17 00:00:00 2001 From: Dirk Date: Tue, 19 Feb 2019 14:07:01 +0100 Subject: [PATCH 10/17] changed default calendarEndDate to "LT" changed default calendarEndDate to "LT" to show local times for event end times. Can still be set to a different value by the user --- modules/default/calendar/calendar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 3a8d05bc..15ebd1bf 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -26,7 +26,7 @@ Module.register("calendar", { urgency: 7, timeFormat: "relative", dateFormat: "MMM Do", - dateEndFormat: "HH:mm", + dateEndFormat: "LT", fullDayEventDateFormat: "MMM Do", showEnd: false, getRelative: 6, From 4443f57f8ac694bb20e17fb0c2d80f69e1b9ad6e Mon Sep 17 00:00:00 2001 From: Dirk Date: Tue, 19 Feb 2019 14:10:17 +0100 Subject: [PATCH 11/17] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ef559ec..fcafa800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Calendar: only show repeating count if the event is actually repeating [#1534](https://github.com/MichMich/MagicMirror/pull/1534) - Calendar: Fix exdate handling when multiple values are specified (comma separated) - Fix null dereference in moduleNeedsUpdate when the module isn't visible +- Calendar: Fixed event end times by setting default calendarEndTime to "LT" (Local time format). [#1479] ### New weather module - Fixed weather forecast table display [#1499](https://github.com/MichMich/MagicMirror/issues/1499). From f8c4afc228fdb4d753c1612354914f4b1df7c310 Mon Sep 17 00:00:00 2001 From: Michal Dobsovic Date: Wed, 20 Feb 2019 22:02:42 +0100 Subject: [PATCH 12/17] Slovak translation added --- translations/sk.json | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 translations/sk.json diff --git a/translations/sk.json b/translations/sk.json new file mode 100644 index 00000000..8eaeba6d --- /dev/null +++ b/translations/sk.json @@ -0,0 +1,33 @@ +{ + "LOADING": "Načítanie …", + + "TODAY": "Dnes", + "TOMORROW": "Zajtra", + "DAYAFTERTOMORROW": "Pozajtra", + "RUNNING": "Končí o", + "EMPTY": "Žiadne nadchádzajúce udalosti.", + + "WEEK": "{weekNumber}. týždeň", + + "N": "S", + "NNE": "SSV", + "NE": "SV", + "ENE": "VSV", + "E": "V", + "ESE": "VJV", + "SE": "JV", + "SSE": "JJV", + "S": "J", + "SSW": "JJZ", + "SW": "JZ", + "WSW": "ZJZ", + "W": "Z", + "WNW": "ZSZ", + "NW": "SZ", + "NNW": "SSZ", + + "UPDATE_NOTIFICATION": "Dostupná aktualizácia pre MagicMirror².", + "UPDATE_NOTIFICATION_MODULE": "Dostupná aktualizácia pre modul {MODULE_NAME}.", + "UPDATE_INFO_SINGLE": "Súčasná inštalácia je na vetve {BRANCH_NAME} pozadu o {COMMIT_COUNT} commit.", + "UPDATE_INFO_MULTIPLE": "Súčasná inštalácia je na vetve {BRANCH_NAME} pozadu o {COMMIT_COUNT} commitov." +} From 78fbc7f3921385a80466976dbb4ae1ad8fde3822 Mon Sep 17 00:00:00 2001 From: Michal Dobsovic Date: Wed, 20 Feb 2019 22:15:24 +0100 Subject: [PATCH 13/17] Modified CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 304b368e..3ee49dcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added autoTimezone option for the default clock module. - Danish translation for "Feels" and "Weeks" - Added option to split multiple day events in calendar to separate numbered events +- Slovakian translation ### Updated - Bumped the Electron dependency to v3.0.13 to support the most recent Raspbian. [#1500](https://github.com/MichMich/MagicMirror/issues/1500) From 758ffb75a9f234771dc1eb72fd7088946aaa4aa4 Mon Sep 17 00:00:00 2001 From: Michal Dobsovic Date: Sat, 23 Feb 2019 10:37:24 +0100 Subject: [PATCH 14/17] Added sk to translations.js --- translations/translations.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/translations/translations.js b/translations/translations.js index 6625acde..39bf8d5b 100644 --- a/translations/translations.js +++ b/translations/translations.js @@ -38,7 +38,8 @@ var translations = { "cy" : "translations/cy.json", // Welsh (Cymraeg) "bg" : "translations/bg.json", // Bulgarian "cs" : "translations/cs.json", // Czech - "hr" : "translations/hr.json" // Croatian + "hr" : "translations/hr.json", // Croatian + "sk" : "translations/sk.json" // Slovak }; if (typeof module !== "undefined") {module.exports = translations;} From 02ae0df2cc0633541d74da574c517d5f4c9986fe Mon Sep 17 00:00:00 2001 From: Tom Hirschberger Date: Sun, 24 Feb 2019 11:48:14 +0100 Subject: [PATCH 15/17] add font-awesome.css to styles of alert.js --- modules/default/alert/alert.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/alert/alert.js b/modules/default/alert/alert.js index cc0ae302..9c0d91a7 100644 --- a/modules/default/alert/alert.js +++ b/modules/default/alert/alert.js @@ -24,7 +24,7 @@ Module.register("alert",{ return ["classie.js", "modernizr.custom.js", "notificationFx.js"]; }, getStyles: function() { - return ["ns-default.css"]; + return ["ns-default.css", "font-awesome.css"]; }, // Define required translations. getTranslations: function() { From 7b8de354053e7b7bd265f6b6206e746d62333653 Mon Sep 17 00:00:00 2001 From: Thomas Hirschberger <47733292+Tom-Hirschberger@users.noreply.github.com> Date: Sun, 24 Feb 2019 11:55:46 +0100 Subject: [PATCH 16/17] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ee49dcf..38aa9f25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Danish translation for "Feels" and "Weeks" - Added option to split multiple day events in calendar to separate numbered events - Slovakian translation +- Alerts now can contain Font Awesome icons ### Updated - Bumped the Electron dependency to v3.0.13 to support the most recent Raspbian. [#1500](https://github.com/MichMich/MagicMirror/issues/1500) From d3b8dbeea079942905cde1bd71124c94c9d598aa Mon Sep 17 00:00:00 2001 From: hudashot <17239583+hudashot@users.noreply.github.com> Date: Mon, 25 Feb 2019 22:47:30 +0000 Subject: [PATCH 17/17] Regularly trigger ADD_CALENDAR to ensure calendar fetcher is running --- CHANGELOG.md | 1 + modules/default/calendar/calendar.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38aa9f25..6e7ae65d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Calendar: Fix relative date handling for fulldate events, calculate difference always from start of day [#1572](https://github.com/MichMich/MagicMirror/issues/1572) - Fix null dereference in moduleNeedsUpdate when the module isn't visible - Calendar: Fixed event end times by setting default calendarEndTime to "LT" (Local time format). [#1479] +- Calendar: Fixed missing calendar fetchers after server process restarts [#1589](https://github.com/MichMich/MagicMirror/issues/1589) ### New weather module - Fixed weather forecast table display [#1499](https://github.com/MichMich/MagicMirror/issues/1499). diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index ad83c939..a6eeb226 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -105,6 +105,13 @@ Module.register("calendar", { } this.addCalendar(calendar.url, calendar.auth, calendarConfig); + + // Trigger ADD_CALENDAR every fetchInterval to make sure there is always a calendar + // fetcher running on the server side. + var self = this; + setInterval(function() { + self.addCalendar(calendar.url, calendar.auth, calendarConfig); + }, self.config.fetchInterval); } this.calendarData = {};