From a2f17900daa59b4e27264b3eacf33623fe35a26f Mon Sep 17 00:00:00 2001 From: Erik Eng Date: Wed, 7 Mar 2018 09:13:33 +0100 Subject: [PATCH 01/11] Update README.md Correct manual installation step. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8fa876a6..4b33bea4 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/maste 1. Download and install the latest Node.js version. 2. Clone the repository and check out the master branch: `git clone https://github.com/MichMich/MagicMirror` -3. Enter the repository: `cd ~/MagicMirror` +3. Enter the repository: `cd MagicMirror/` 4. Install and run the app: `npm install && npm start` **Important:** `npm start` does **not** work via SSH, use `DISPLAY=:0 nohup npm start &` instead. This starts the mirror on the remote display. From fa45e66da641365cd330b86ec270c9d3d8db34c2 Mon Sep 17 00:00:00 2001 From: Thomas Mirlacher Date: Sat, 10 Mar 2018 00:30:45 +0100 Subject: [PATCH 02/11] Add dc:date to parsing in newsfeed module, which allows parsing of more rss feeds. --- CHANGELOG.md | 1 + modules/default/newsfeed/fetcher.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eec9207c..4702979d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - News article in fullscreen (iframe) is now shown in front of modules. +- Add dc:date to parsing in newsfeed module, which allows parsing of more rss feeds. *This release is scheduled to be released on 2018-04-01.* diff --git a/modules/default/newsfeed/fetcher.js b/modules/default/newsfeed/fetcher.js index 0cc73e36..4b7cbfd1 100644 --- a/modules/default/newsfeed/fetcher.js +++ b/modules/default/newsfeed/fetcher.js @@ -45,7 +45,7 @@ var Fetcher = function(url, reloadInterval, encoding) { var title = item.title; var description = item.description || item.summary || item.content || ""; - var pubdate = item.pubdate || item.published || item.updated; + var pubdate = item.pubdate || item.published || item.updated || item['dc:date']; var url = item.url || item.link || ""; if (title && pubdate) { From c29a83b2592905c7632caf6e025c9cf123146380 Mon Sep 17 00:00:00 2001 From: David Galloway Date: Sun, 11 Mar 2018 13:17:33 -0400 Subject: [PATCH 03/11] Assume yes when installing deps on Raspberry Pi via apt-get Signed-off-by: David Galloway --- installers/raspberry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/raspberry.sh b/installers/raspberry.sh index ecdcc842..7ef43426 100644 --- a/installers/raspberry.sh +++ b/installers/raspberry.sh @@ -42,7 +42,7 @@ sudo apt-get update || echo -e "\e[91mUpdate failed, carrying on installation .. # Installing helper tools echo -e "\e[96mInstalling helper tools ...\e[90m" -sudo apt-get install curl wget git build-essential unzip || exit +sudo apt-get --assume-yes install curl wget git build-essential unzip || exit # Check if we need to install or upgrade Node.js. echo -e "\e[96mCheck current Node installation ...\e[0m" From 9974e35656d419d010004b026547aaaad5fa883d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Luk=C3=A1=C5=A1?= Date: Mon, 12 Mar 2018 15:28:43 +0100 Subject: [PATCH 04/11] Added yarn support --- package.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 9830360e..9da28d23 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "main": "js/electron.js", "scripts": { "start": "sh run-start.sh", - "install": "cd vendor && npm install", - "install-fonts": "cd fonts && npm install", - "postinstall": "sh installers/postinstall/postinstall.sh && npm run install-fonts", + "install": "cd vendor && yon install", + "install-fonts": "cd fonts && yon install", + "postinstall": "sh installers/postinstall/postinstall.sh && yon run install-fonts", "test": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests --recursive", "test:unit": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests/unit --recursive", "test:e2e": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests/e2e --recursive", @@ -52,7 +52,8 @@ "spectron": "3.7.x", "stylelint": "^8.4.0", "stylelint-config-standard": "latest", - "time-grunt": "latest" + "time-grunt": "latest", + "yarn-or-npm": "^2.0.4" }, "dependencies": { "body-parser": "^1.18.2", From 8ef14f7a545addf1e1a353a5ed517cfed25c4d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Luk=C3=A1=C5=A1?= Date: Mon, 12 Mar 2018 15:33:30 +0100 Subject: [PATCH 05/11] Added changes from [9974e35] to CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eec9207c..2e791c99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Add link to GitHub repository which contains the respective Dockerfile. - Optimized automated unit tests cloneObject, cmpVersions - Update notifications use now translation templates instead of normal strings. +- Yarn can be used now as an installation tool ### Fixed - News article in fullscreen (iframe) is now shown in front of modules. From a5d56300679d7e5a96104292964df3988dde60cb Mon Sep 17 00:00:00 2001 From: "E:V:A" Date: Wed, 14 Mar 2018 11:24:41 +0200 Subject: [PATCH 06/11] update node stable to 9.x --- installers/raspberry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/raspberry.sh b/installers/raspberry.sh index 7ef43426..06fa45bf 100644 --- a/installers/raspberry.sh +++ b/installers/raspberry.sh @@ -82,7 +82,7 @@ if $NODE_INSTALL; then # The NODE_STABLE_BRANCH variable will need to be manually adjusted when a new branch is released. (e.g. 7.x) # Only tested (stable) versions are recommended as newer versions could break MagicMirror. - NODE_STABLE_BRANCH="6.x" + NODE_STABLE_BRANCH="9.x" curl -sL https://deb.nodesource.com/setup_$NODE_STABLE_BRANCH | sudo -E bash - sudo apt-get install -y nodejs echo -e "\e[92mNode.js installation Done!\e[0m" From be0f262e372fd445ae66bd673c1f9cb7e9e2f30f Mon Sep 17 00:00:00 2001 From: Kenn Breece Date: Sun, 18 Mar 2018 23:33:48 -0400 Subject: [PATCH 07/11] Add advanced filtering to excludedEvents --- CHANGELOG.md | 6 ++ modules/default/calendar/README.md | 2 +- modules/default/calendar/calendarfetcher.js | 66 +++++++++++++++++++-- 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad3cfd9e..4f348a54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [2.1.4] - 2018-03-18 + +### Added + +- Add advanced filtering to the excludedEvents configuration of the default calendar module + ## [2.2.2] - 2018-01-02 ### Added diff --git a/modules/default/calendar/README.md b/modules/default/calendar/README.md index 8ce9608b..2481b77b 100644 --- a/modules/default/calendar/README.md +++ b/modules/default/calendar/README.md @@ -46,7 +46,7 @@ The following properties can be configured: | `urgency` | When using a timeFormat of `absolute`, the `urgency` setting allows you to display events within a specific time frame as `relative`. This allows events within a certain time frame to be displayed as relative (in xx days) while others are displayed as absolute dates

**Possible values:** a positive integer representing the number of days for which you want a relative date, for example `7` (for 7 days)

**Default value:** `7` | `broadcastEvents` | If this property is set to true, the calendar will broadcast all the events to all other modules with the notification message: `CALENDAR_EVENTS`. The event objects are stored in an array and contain the following fields: `title`, `startDate`, `endDate`, `fullDayEvent`, `location` and `geo`.

**Possible values:** `true`, `false`

**Default value:** `true` | `hidePrivate` | Hides private calendar events.

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

**Example:** `['Birthday', 'Hide This Event']`
**Default value:** `[]` +| `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

**Example:** `['Birthday', 'Hide This Event', {filterBy: 'Payment', until: '6 days', caseSensitive: true}]`
**Default value:** `[]` ### Calendar configuration diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 12495f78..911eaba4 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -113,11 +113,38 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri title = event.description; } - var excluded = false; + var excluded = false, + dateFilter = null; + for (var f in excludedEvents) { - var filter = excludedEvents[f]; - if (title.toLowerCase().includes(filter.toLowerCase())) { - excluded = true; + var filter = excludedEvents[f], + testTitle = title.toLowerCase(), + until = null; + + if (filter instanceof Object) { + if (typeof filter.until !== "undefined") { + until = filter.until; + } + + // If additional advanced filtering is added in, this section + // must remain last as we overwrite the filter object with the + // filterBy string + if (filter.caseSensitive) { + filter = filter.filterBy; + testTitle = title; + } else { + filter = filter.filterBy.toLowerCase(); + } + } else { + filter = filter.toLowerCase(); + } + + if (testTitle.includes(filter)) { + if (until) { + dateFilter = until; + } else { + excluded = true; + } break; } } @@ -137,6 +164,11 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri for (var d in dates) { startDate = moment(new Date(dates[d])); endDate = moment(parseInt(startDate.format("x")) + duration, "x"); + + if (timeFilterApplies(now, endDate, dateFilter)) { + continue; + } + if (endDate.format("x") > now) { newEvents.push({ title: title, @@ -171,6 +203,10 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri continue; } + if (timeFilterApplies(now, endDate, dateFilter)) { + continue; + } + // Every thing is good. Add it to the list. newEvents.push({ @@ -236,6 +272,28 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri return false; }; + /* timeFilterApplies() + * Determines if the user defined time filter should apply + * + * argument now Date - Date object using previously created object for consistency + * argument endDate Moment - Moment object representing the event end date + * argument filter string - The time to subtract from the end date to determine if an event should be shown + * + * return bool - The event should be filtered out + */ + var timeFilterApplies = function(now, endDate, filter) { + if (filter) { + var until = filter.split(" "), + value = parseInt(until[0]), + increment = until[1].slice("-1") === "s" ? until[1] : until[1] + "s", // Massage the data for moment js + filterUntil = moment(endDate.format()).subtract(value, increment); + + return now < filterUntil.format("x"); + } + + return false; + }; + /* public methods */ /* startFetch() From 008e305a84ab8ffd7805ba3172197df5ec09c16b Mon Sep 17 00:00:00 2001 From: Thomas Mirlacher Date: Wed, 21 Mar 2018 11:58:09 +0100 Subject: [PATCH 08/11] use doublequotes. --- modules/default/newsfeed/fetcher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/newsfeed/fetcher.js b/modules/default/newsfeed/fetcher.js index 4b7cbfd1..a3bf1fa0 100644 --- a/modules/default/newsfeed/fetcher.js +++ b/modules/default/newsfeed/fetcher.js @@ -45,7 +45,7 @@ var Fetcher = function(url, reloadInterval, encoding) { var title = item.title; var description = item.description || item.summary || item.content || ""; - var pubdate = item.pubdate || item.published || item.updated || item['dc:date']; + var pubdate = item.pubdate || item.published || item.updated || item["dc:date"]; var url = item.url || item.link || ""; if (title && pubdate) { From d3095297c281830ef4f17c146cc032e052df3734 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 23 Mar 2018 16:29:05 -0700 Subject: [PATCH 09/11] capitalize "y/n" for clearer intent If you press enter, `choice` is an empty string and will default to "no". The convention is to capitalize the default answer so users know what happens when they auto-accept prompts. --- installers/raspberry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/raspberry.sh b/installers/raspberry.sh index ecdcc842..62837d4b 100644 --- a/installers/raspberry.sh +++ b/installers/raspberry.sh @@ -149,7 +149,7 @@ else fi # Use pm2 control like a service MagicMirror -read -p "Do you want use pm2 for auto starting of your MagicMirror (y/n)?" choice +read -p "Do you want use pm2 for auto starting of your MagicMirror (y/N)?" choice if [[ $choice =~ ^[Yy]$ ]]; then sudo npm install -g pm2 sudo su -c "env PATH=$PATH:/usr/bin pm2 startup linux -u pi --hp /home/pi" From 1abfbe1d345ea80619c31780edf4eaf32315d488 Mon Sep 17 00:00:00 2001 From: MOHAMMAD RASIM Date: Sat, 24 Mar 2018 16:11:57 +0300 Subject: [PATCH 10/11] use shallow clone not need to download the whole repo history --- installers/raspberry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/raspberry.sh b/installers/raspberry.sh index ecdcc842..aa943dcf 100644 --- a/installers/raspberry.sh +++ b/installers/raspberry.sh @@ -101,7 +101,7 @@ if [ -d "$HOME/MagicMirror" ] ; then fi echo -e "\e[96mCloning MagicMirror ...\e[90m" -if git clone https://github.com/MichMich/MagicMirror.git; then +if git clone --depth=1 https://github.com/MichMich/MagicMirror.git; then echo -e "\e[92mCloning MagicMirror Done!\e[0m" else echo -e "\e[91mUnable to clone MagicMirror." From ae6d15e8126b0e2dac741019490a01c1ebfa7acf Mon Sep 17 00:00:00 2001 From: "E:V:A" Date: Sun, 25 Mar 2018 12:07:29 +0300 Subject: [PATCH 11/11] removed known issues as they are closed --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 606cdae9..b795ab97 100644 --- a/README.md +++ b/README.md @@ -179,10 +179,6 @@ git pull && npm install If you changed nothing more than the config or the modules, this should work without any problems. Type `git status` to see your changes, if there are any, you can reset them with `git reset --hard`. After that, git pull should be possible. -## Known issues - -- Electron seems to have some issues on certain Raspberry Pi 2's. See [#145](https://github.com/MichMich/MagicMirror/issues/145). -- MagicMirror² (Electron) sometimes quits without an error after an extended period of use. See [#150](https://github.com/MichMich/MagicMirror/issues/150). ## Community