From ba8685a122d824d21b8d242d96b8aa5d9cc7c8cf Mon Sep 17 00:00:00 2001 From: fwitte Date: Sat, 5 Jan 2019 13:13:53 +0100 Subject: [PATCH 01/38] readded degreesign --- modules/default/currentweather/currentweather.js | 13 ++++++++----- modules/default/weatherforecast/weatherforecast.js | 9 ++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 7285bd2e..2a6d24b9 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -198,16 +198,19 @@ Module.register("currentweather",{ large.appendChild(weatherIcon); var degreeLabel = ""; - if (this.config.degreeLabel) { - switch (this.config.units ) { + if (this.config.units === "metric" || this.config.units === "imperial") { + degreeLabel += "°"; + } + if(this.config.degreeLabel) { + switch(this.config.units) { case "metric": - degreeLabel = " °C"; + degreeLabel += "C"; break; case "imperial": - degreeLabel = " °F"; + degreeLabel += "F"; break; case "default": - degreeLabel = " K"; + degreeLabel += "K"; break; } } diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 3afc7f74..67193696 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -143,16 +143,19 @@ Module.register("weatherforecast",{ iconCell.appendChild(icon); var degreeLabel = ""; + if (this.config.units === "metric" || this.config.units === "imperial") { + degreeLabel += "°"; + } if(this.config.scale) { switch(this.config.units) { case "metric": - degreeLabel = " °C"; + degreeLabel += "C"; break; case "imperial": - degreeLabel = " °F"; + degreeLabel += "F"; break; case "default": - degreeLabel = " K"; + degreeLabel = "K"; break; } } From c2ff949f2d6d11e852c813b8d5e784f3d9752406 Mon Sep 17 00:00:00 2001 From: fwitte Date: Sat, 5 Jan 2019 13:14:10 +0100 Subject: [PATCH 02/38] adjusted CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75a849a2..51c62ed8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Bumped the Electron dependency to v3.0.13 to support the most recent Raspbian. [#1500](https://github.com/MichMich/MagicMirror/issues/1500) ### Fixed -- Fixed temperature displays in currentweather and weatherforecast modules [#1503](https://github.com/MichMich/MagicMirror/issues/1503). +- Fixed temperature displays in currentweather and weatherforecast modules [#1503](https://github.com/MichMich/MagicMirror/issues/1503), [#1511](https://github.com/MichMich/MagicMirror/issues/1511). - Fixed unhandled error on bad git data in updatenotiifcation module [#1285](https://github.com/MichMich/MagicMirror/issues/1285). - Weather forecast now works with openweathermap in new weather module. Daily data are displayed, see issue [#1504](https://github.com/MichMich/MagicMirror/issues/1504). From 1bbf2d8ce6cf1fdba91bfdc9d5614bb6ba6ca346 Mon Sep 17 00:00:00 2001 From: andogit7 <44971673+andogit7@users.noreply.github.com> Date: Sat, 5 Jan 2019 17:04:33 +0000 Subject: [PATCH 03/38] Update clock.js --- modules/default/clock/clock.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/default/clock/clock.js b/modules/default/clock/clock.js index 705b4303..23b801d0 100644 --- a/modules/default/clock/clock.js +++ b/modules/default/clock/clock.js @@ -137,7 +137,8 @@ Module.register("clock",{ clockCircle.style.backgroundSize = "100%"; // The following line solves issue: https://github.com/MichMich/MagicMirror/issues/611 - clockCircle.style.border = "1px solid black"; + // clockCircle.style.border = "1px solid black"; + clockCircle.style.border = "rgba(0, 0, 0, 0.1)"; //Updated fix for Issue 611 where non-black backgrounds are used } else if (this.config.analogFace != "none") { clockCircle.style.border = "2px solid white"; From a477140a4bc7d64124927682f81f973ee1c8abe2 Mon Sep 17 00:00:00 2001 From: andogit7 <44971673+andogit7@users.noreply.github.com> Date: Sat, 5 Jan 2019 17:08:55 +0000 Subject: [PATCH 04/38] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75a849a2..2a24345b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Fixed temperature displays in currentweather and weatherforecast modules [#1503](https://github.com/MichMich/MagicMirror/issues/1503). - Fixed unhandled error on bad git data in updatenotiifcation module [#1285](https://github.com/MichMich/MagicMirror/issues/1285). - Weather forecast now works with openweathermap in new weather module. Daily data are displayed, see issue [#1504](https://github.com/MichMich/MagicMirror/issues/1504). +- Fixed analogue clock border display issuse where non-black backgrounds used (previous fix for issue 611) ### New weather module - Fixed weather forecast table display [#1499](https://github.com/MichMich/MagicMirror/issues/1499). From 1d21f39fbca3feeb5b7465acf6b658d4554ab014 Mon Sep 17 00:00:00 2001 From: andogit7 <44971673+andogit7@users.noreply.github.com> Date: Sat, 5 Jan 2019 17:09:15 +0000 Subject: [PATCH 05/38] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a24345b..6c6521d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Fixed temperature displays in currentweather and weatherforecast modules [#1503](https://github.com/MichMich/MagicMirror/issues/1503). - Fixed unhandled error on bad git data in updatenotiifcation module [#1285](https://github.com/MichMich/MagicMirror/issues/1285). - Weather forecast now works with openweathermap in new weather module. Daily data are displayed, see issue [#1504](https://github.com/MichMich/MagicMirror/issues/1504). -- Fixed analogue clock border display issuse where non-black backgrounds used (previous fix for issue 611) +- Fixed analogue clock border display issue where non-black backgrounds used (previous fix for issue 611) ### New weather module - Fixed weather forecast table display [#1499](https://github.com/MichMich/MagicMirror/issues/1499). From 8b2d544576a69804e05071543550301a622298eb Mon Sep 17 00:00:00 2001 From: fwitte Date: Sun, 6 Jan 2019 12:24:26 +0100 Subject: [PATCH 06/38] added fade and maxnumberofdays options for forecast --- modules/default/weather/forecast.njk | 6 +++++- modules/default/weather/weather.js | 26 +++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/modules/default/weather/forecast.njk b/modules/default/weather/forecast.njk index 556a98ff..d03d3018 100644 --- a/modules/default/weather/forecast.njk +++ b/modules/default/weather/forecast.njk @@ -1,7 +1,10 @@ {% if forecast %} + {% set numSteps = forecast | calcNumSteps %} + {% set currentStep = 0 %} + {% set forecast = forecast.slice(0, numSteps) %} {% for f in forecast %} - + {% endif %} + {% set currentStep = currentStep + 1 %} {% endfor %}
{{ f.date.format('ddd') }} @@ -16,6 +19,7 @@
{% else %} diff --git a/modules/default/weather/weather.js b/modules/default/weather/weather.js index 52e9cfee..818bc40a 100644 --- a/modules/default/weather/weather.js +++ b/modules/default/weather/weather.js @@ -33,6 +33,9 @@ Module.register("weather",{ decimalSymbol: ".", showIndoorTemperature: false, showIndoorHumidity: false, + maxNumberOfDays: 3, + fade: true, + fadePoint: 0.25, // Start on 1/4th of the list. initialLoadDelay: 0, // 0 seconds delay retryDelay: 2500, @@ -198,7 +201,7 @@ Module.register("weather",{ } } } else if (type === "rain") { - if (isNaN(value)) { + if (isNaN(value) || value === 0) { value = ""; } else { value = `${value.toFixed(2)} ${this.config.units === "imperial" ? "in" : "mm"}`; @@ -217,5 +220,26 @@ Module.register("weather",{ this.nunjucksEnvironment().addFilter("decimalSymbol", function(value) { return value.replace(/\./g, this.config.decimalSymbol); }.bind(this)); + + this.nunjucksEnvironment().addFilter("calcNumSteps", function(forecast) { + return Math.min(forecast.length, this.config.maxNumberOfDays); + }.bind(this)); + + this.nunjucksEnvironment().addFilter("opacity", function(currentStep, numSteps) { + if (this.config.fade && this.config.fadePoint < 1) { + if (this.config.fadePoint < 0) { + this.config.fadePoint = 0; + } + var startingPoint = numSteps * this.config.fadePoint; + var numFadesteps = numSteps - startingPoint; + if (currentStep >= startingPoint) { + return 1 - (currentStep - startingPoint) / numFadesteps; + } else { + return 1; + } + } else { + return 1; + } + }.bind(this)); } }); From 63aa840b55cb989fe419b0e633ae6b6da00be714 Mon Sep 17 00:00:00 2001 From: fwitte Date: Sun, 6 Jan 2019 12:30:26 +0100 Subject: [PATCH 07/38] replaced tabs with spaces --- modules/default/weather/forecast.njk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/default/weather/forecast.njk b/modules/default/weather/forecast.njk index d03d3018..315ebff8 100644 --- a/modules/default/weather/forecast.njk +++ b/modules/default/weather/forecast.njk @@ -1,8 +1,8 @@ {% if forecast %} - {% set numSteps = forecast | calcNumSteps %} - {% set currentStep = 0 %} + {% set numSteps = forecast | calcNumSteps %} + {% set currentStep = 0 %} - {% set forecast = forecast.slice(0, numSteps) %} + {% set forecast = forecast.slice(0, numSteps) %} {% for f in forecast %} @@ -19,7 +19,7 @@ {% endif %} - {% set currentStep = currentStep + 1 %} + {% set currentStep = currentStep + 1 %} {% endfor %}
{{ f.date.format('ddd') }}
{% else %} From 733dfa1467741f749f7aca63fa6b8aea4f088383 Mon Sep 17 00:00:00 2001 From: fwitte Date: Sun, 6 Jan 2019 12:34:27 +0100 Subject: [PATCH 08/38] adjusted README --- modules/default/weather/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/default/weather/README.md b/modules/default/weather/README.md index d10297d1..a035e85e 100644 --- a/modules/default/weather/README.md +++ b/modules/default/weather/README.md @@ -71,6 +71,9 @@ The following properties can be configured: | `tableClass` | The class for the forecast table.

**Default value:** `'small'` | `colored` | If set to `true`, the min and max temperature are color coded.

**Default value:** `false` | `showRainAmount` | Show the amount of rain in the forecast

**Possible values:** `true` or `false`
**Default value:** `true` +| `fade` | Fade the future events to black. (Gradient)

**Possible values:** `true` or `false`
**Default value:** `true` +| `fadePoint` | Where to start fade?

**Possible values:** `0` (top of the list) - `1` (bottom of list)
**Default value:** `0.25` +| `maxNumberOfDays` | How many days of forecast to return. Specified by config.js

**Possible values:** `1` - `16`
**Default value:** `5` (5 days)
This value is optional. By default the weatherforecast module will return 5 days. ### Openweathermap options From 766f21b5254bb045b94bb0e6687c1f72c05232c2 Mon Sep 17 00:00:00 2001 From: fwitte Date: Sun, 6 Jan 2019 12:34:44 +0100 Subject: [PATCH 09/38] adjusted default values --- modules/default/weather/weather.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/weather/weather.js b/modules/default/weather/weather.js index 818bc40a..0c230424 100644 --- a/modules/default/weather/weather.js +++ b/modules/default/weather/weather.js @@ -33,7 +33,7 @@ Module.register("weather",{ decimalSymbol: ".", showIndoorTemperature: false, showIndoorHumidity: false, - maxNumberOfDays: 3, + maxNumberOfDays: 5, fade: true, fadePoint: 0.25, // Start on 1/4th of the list. From a79e51c76f8dcfc2ac4dddfb1b18554ecb9af6d5 Mon Sep 17 00:00:00 2001 From: fwitte Date: Mon, 7 Jan 2019 08:51:17 +0100 Subject: [PATCH 10/38] updated +CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75a849a2..f4fd8af8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Aligned indoor values in current weather vertical [#1499](https://github.com/MichMich/MagicMirror/issues/1499). - Added humidity support to nunjuck unit filter. - Do not display degree symbol for temperature in Kelvin [#1503](https://github.com/MichMich/MagicMirror/issues/1503). +- Added fade, fadePoint and maxNumberOfDays properties to the forecast mode [#1516](https://github.com/MichMich/MagicMirror/issues/1516) ## [2.6.0] - 2019-01-01 From f680c83d2d6443d1a1500d4e07f6678d40599144 Mon Sep 17 00:00:00 2001 From: Bardo98 <46172278+Bardo98@users.noreply.github.com> Date: Mon, 7 Jan 2019 21:55:18 +0100 Subject: [PATCH 11/38] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75a849a2..4b1d85c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ℹ️ **Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install`. If you are having issues running Electron, make sure your [Raspbian is up to date](https://www.raspberrypi.org/documentation/raspbian/updating.md). ### Added +- Italian translation for "Feels" ### Updated - Bumped the Electron dependency to v3.0.13 to support the most recent Raspbian. [#1500](https://github.com/MichMich/MagicMirror/issues/1500) From 984608e23f816966cd9a1d87150b12eb34aca3ec Mon Sep 17 00:00:00 2001 From: Bardo98 <46172278+Bardo98@users.noreply.github.com> Date: Mon, 7 Jan 2019 22:05:26 +0100 Subject: [PATCH 12/38] Added Italian translation of "FEELS" --- translations/it.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/translations/it.json b/translations/it.json index a5eaf2f2..e1a5b806 100644 --- a/translations/it.json +++ b/translations/it.json @@ -29,5 +29,7 @@ "UPDATE_NOTIFICATION": "E' disponibile un aggiornamento di MagicMirror².", "UPDATE_NOTIFICATION_MODULE": "E' disponibile un aggiornamento del modulo {MODULE_NAME}.", "UPDATE_INFO_SINGLE": "L'installazione è {COMMIT_COUNT} commit indietro rispetto all'attuale branch {BRANCH_NAME}.", - "UPDATE_INFO_MULTIPLE": "L'installazione è {COMMIT_COUNT} commits indietro rispetto all'attuale branch {BRANCH_NAME}." + "UPDATE_INFO_MULTIPLE": "L'installazione è {COMMIT_COUNT} commits indietro rispetto all'attuale branch {BRANCH_NAME}.", + + "FEELS": "Percepiti" } From b01b9758e0503755e97d805d13021be6acf32831 Mon Sep 17 00:00:00 2001 From: Ian Date: Wed, 9 Jan 2019 21:24:14 +0000 Subject: [PATCH 13/38] remove Font Awesome 4 dependency --- vendor/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/vendor/package.json b/vendor/package.json index d14f8bcb..241374cb 100644 --- a/vendor/package.json +++ b/vendor/package.json @@ -11,7 +11,6 @@ }, "dependencies": { "@fortawesome/fontawesome-free": "^5.3.1", - "font-awesome": "^4.7.0", "moment": "^2.17.1", "moment-timezone": "^0.5.11", "nunjucks": "^3.0.1", From ef82039401b5122889fac0d8762a25440328b1e8 Mon Sep 17 00:00:00 2001 From: Ian Date: Wed, 9 Jan 2019 21:29:49 +0000 Subject: [PATCH 14/38] Allow multiple css to be included for one vendor --- vendor/css/font-awesome.css | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 vendor/css/font-awesome.css diff --git a/vendor/css/font-awesome.css b/vendor/css/font-awesome.css new file mode 100644 index 00000000..2ba4a708 --- /dev/null +++ b/vendor/css/font-awesome.css @@ -0,0 +1,2 @@ +@import url("../node_modules/@fortawesome/fontawesome-free/css/all.min.css"); +@import url("../node_modules/@fortawesome/fontawesome-free/css/v4-shims.min.css"); \ No newline at end of file From 7c3923ad00b1e47b1992987a131d940ae7330fa6 Mon Sep 17 00:00:00 2001 From: Ian Date: Wed, 9 Jan 2019 21:32:43 +0000 Subject: [PATCH 15/38] Use Font Awesome 5 (with backwards compatibility) for all modules --- vendor/vendor.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vendor/vendor.js b/vendor/vendor.js index abbf1423..6acf8427 100644 --- a/vendor/vendor.js +++ b/vendor/vendor.js @@ -12,9 +12,7 @@ var vendor = { "moment-timezone.js" : "node_modules/moment-timezone/builds/moment-timezone-with-data.js", "weather-icons.css": "node_modules/weathericons/css/weather-icons.css", "weather-icons-wind.css": "node_modules/weathericons/css/weather-icons-wind.css", - "font-awesome.css": "node_modules/font-awesome/css/font-awesome.min.css", - "font-awesome5.css": "node_modules/@fortawesome/fontawesome-free/css/all.min.css", - "font-awesome5.v4shims.css": "node_modules/@fortawesome/fontawesome-free/css/v4-shims.min.css", + "font-awesome.css": "css/font-awesome.css", "nunjucks.js": "node_modules/nunjucks/browser/nunjucks.min.js" }; From 00922891052041c2c9f02926d77ccd5114698bf0 Mon Sep 17 00:00:00 2001 From: Ian Date: Wed, 9 Jan 2019 21:38:07 +0000 Subject: [PATCH 16/38] revert font awesome reference --- 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 38b04269..7b813809 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -51,7 +51,7 @@ Module.register("calendar", { // Define required scripts. getStyles: function () { - return ["calendar.css", "font-awesome5.css", "font-awesome5.v4shims.css"]; + return ["calendar.css", "font-awesome.css"]; }, // Define required scripts. From 8546d6730c98471d167c858555458720bf4dae29 Mon Sep 17 00:00:00 2001 From: Ian Date: Thu, 10 Jan 2019 12:44:35 +0000 Subject: [PATCH 17/38] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12d84620..387dcdb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Fixed unhandled error on bad git data in updatenotiifcation module [#1285](https://github.com/MichMich/MagicMirror/issues/1285). - Weather forecast now works with openweathermap in new weather module. Daily data are displayed, see issue [#1504](https://github.com/MichMich/MagicMirror/issues/1504). - Fixed analogue clock border display issue where non-black backgrounds used (previous fix for issue 611) +- Fixed compatibility issues caused when modules request different versions of Font Awesome, see issue [#1522](https://github.com/MichMich/MagicMirror/issues/1522). MagicMirror now uses [Font Awesome 5 with v4 shims included for backwards compatibility](https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#shims). ### New weather module - Fixed weather forecast table display [#1499](https://github.com/MichMich/MagicMirror/issues/1499). From 8f24cc8d137b508d10f61d8df8d70c9ad6c9a1ac Mon Sep 17 00:00:00 2001 From: fdahms Date: Sat, 12 Jan 2019 18:06:52 +0100 Subject: [PATCH 18/38] editing CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 387dcdb1..ad4336c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added - Italian translation for "Feels" +- Disabled the screensaver on raspbian with installation script + ### Updated - Bumped the Electron dependency to v3.0.13 to support the most recent Raspbian. [#1500](https://github.com/MichMich/MagicMirror/issues/1500) @@ -23,6 +25,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Weather forecast now works with openweathermap in new weather module. Daily data are displayed, see issue [#1504](https://github.com/MichMich/MagicMirror/issues/1504). - Fixed analogue clock border display issue where non-black backgrounds used (previous fix for issue 611) - Fixed compatibility issues caused when modules request different versions of Font Awesome, see issue [#1522](https://github.com/MichMich/MagicMirror/issues/1522). MagicMirror now uses [Font Awesome 5 with v4 shims included for backwards compatibility](https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#shims). +- Installation script problems with raspbian ### New weather module - Fixed weather forecast table display [#1499](https://github.com/MichMich/MagicMirror/issues/1499). From f87adebe41df0ea9a7fa600daa28dcd313fbdf27 Mon Sep 17 00:00:00 2001 From: fdahms Date: Sat, 12 Jan 2019 18:11:48 +0100 Subject: [PATCH 19/38] Fixing raspbian installer * fixing issue #1377 * fixing problem with old node installation from fresh raspbian * add feature for disable screen saver --- installers/raspberry.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/installers/raspberry.sh b/installers/raspberry.sh index 4e9c20d8..6e618c99 100644 --- a/installers/raspberry.sh +++ b/installers/raspberry.sh @@ -47,7 +47,7 @@ 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" NODE_INSTALL=false -if command_exists node; then +if command_exists node && command_exists npm; then echo -e "\e[0mNode currently installed. Checking version number."; NODE_CURRENT=$(node -v) echo -e "\e[0mMinimum Node version: \e[1m$NODE_TESTED\e[0m" @@ -152,9 +152,19 @@ fi 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" - pm2 start ~/MagicMirror/installers/pm2_MagicMirror.json - pm2 save + if [[ "$(ps --no-headers -o comm 1)" =~ systemd ]]; then #Checking for systemd + sudo pm2 startup systemd -u pi --hp /home/pi + else + sudo su -c "env PATH=$PATH:/usr/bin pm2 startup linux -u pi --hp /home/pi" + fi + pm2 start ~/MagicMirror/installers/pm2_MagicMirror.json + pm2 save +fi +# Disable Screensaver +read -p "Do you want to disable the screen saver? (y/N)?" choice +if [[ $choice =~ ^[Yy]$ ]]; then + su -c "echo -e '@xset s noblank\n@xset s off\n@xset -dpms' >> /etc/xdg/lxsession/LXDE-pi/autostart" + export DISPLAY=:0; xset s noblank;xset s off;xset -dpms fi echo " " From 90c96f7479444c6f77c52a953ba1aefb8a059d67 Mon Sep 17 00:00:00 2001 From: Yvonne Date: Sun, 13 Jan 2019 09:26:37 +1100 Subject: [PATCH 20/38] Update README.md --- modules/default/weather/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/weather/README.md b/modules/default/weather/README.md index 89e65de1..1bfa3aff 100644 --- a/modules/default/weather/README.md +++ b/modules/default/weather/README.md @@ -2,7 +2,7 @@ This module is aimed to be the replacement for the current `currentweather` and `weatherforcast` modules. The module will be configurable to be used as a current weather view, or to show the forecast. This way the module can be used twice to fullfil both purposes. -The biggest cange is the use of weather providers. This way we are not bound to one API source. And users can choose which API they want to use as their source. +The biggest change is the use of weather providers. This way we are not bound to one API source. And users can choose which API they want to use as their source. The module is in a very early stage, and needs a lot of work. It's API isn't set in stone, so keep that in mind when you want to contribute. From 1c830594829c6544f81230879a8b8f6614c4153d Mon Sep 17 00:00:00 2001 From: Jan Syring-Lingenfelder Date: Sun, 13 Jan 2019 16:07:02 +0100 Subject: [PATCH 21/38] fix: only show repeating count if the event is actually repeating --- 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 7b813809..d9cc8291 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -220,7 +220,7 @@ Module.register("calendar", { var titleWrapper = document.createElement("td"), repeatingCountTitle = ""; - if (this.config.displayRepeatingCountTitle) { + if (this.config.displayRepeatingCountTitle && event.firstYear !== undefined) { repeatingCountTitle = this.countTitleForUrl(event.url); From 06e641015f7853d7cb1dc52c8819befc1f2cc0f1 Mon Sep 17 00:00:00 2001 From: Jan Syring-Lingenfelder Date: Sun, 13 Jan 2019 16:25:57 +0100 Subject: [PATCH 22/38] docs: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4336c8..0a1c4693 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Fixed analogue clock border display issue where non-black backgrounds used (previous fix for issue 611) - Fixed compatibility issues caused when modules request different versions of Font Awesome, see issue [#1522](https://github.com/MichMich/MagicMirror/issues/1522). MagicMirror now uses [Font Awesome 5 with v4 shims included for backwards compatibility](https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#shims). - Installation script problems with raspbian +- Calendar: only show repeating count if the event is actually repeating [#1534](https://github.com/MichMich/MagicMirror/pull/1534) ### New weather module - Fixed weather forecast table display [#1499](https://github.com/MichMich/MagicMirror/issues/1499). From 6d9675a299287a52430fc0bc1e59439f1ff12f09 Mon Sep 17 00:00:00 2001 From: fdahms Date: Sun, 13 Jan 2019 20:07:20 +0100 Subject: [PATCH 23/38] forgot one sudo --- installers/raspberry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/raspberry.sh b/installers/raspberry.sh index 6e618c99..1551b5fb 100644 --- a/installers/raspberry.sh +++ b/installers/raspberry.sh @@ -163,7 +163,7 @@ fi # Disable Screensaver read -p "Do you want to disable the screen saver? (y/N)?" choice if [[ $choice =~ ^[Yy]$ ]]; then - su -c "echo -e '@xset s noblank\n@xset s off\n@xset -dpms' >> /etc/xdg/lxsession/LXDE-pi/autostart" + sudo su -c "echo -e '@xset s noblank\n@xset s off\n@xset -dpms' >> /etc/xdg/lxsession/LXDE-pi/autostart" export DISPLAY=:0; xset s noblank;xset s off;xset -dpms fi From 399e1710836420617d6a00725d251f7bc800d2b2 Mon Sep 17 00:00:00 2001 From: Andrew McOlash Date: Wed, 16 Jan 2019 22:51:44 -0800 Subject: [PATCH 24/38] Add in cutting of long vertical titles --- CHANGELOG.md | 2 +- modules/default/calendar/README.md | 1 + modules/default/calendar/calendar.js | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a1c4693..2dbc2675 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added - Italian translation for "Feels" - Disabled the screensaver on raspbian with installation script - +- Added option to truncate the number of vertical lines a calendar item can span if `wrapEvents` is enabled. ### Updated - Bumped the Electron dependency to v3.0.13 to support the most recent Raspbian. [#1500](https://github.com/MichMich/MagicMirror/issues/1500) diff --git a/modules/default/calendar/README.md b/modules/default/calendar/README.md index b272a2d2..e0d727c8 100755 --- a/modules/default/calendar/README.md +++ b/modules/default/calendar/README.md @@ -32,6 +32,7 @@ The following properties can be configured: | `defaultSymbol` | The default symbol.

**Possible values:** See [Font Awsome](http://fontawesome.io/icons/) website.
**Default value:** `calendar` | `maxTitleLength` | The maximum title length.

**Possible values:** `10` - `50`
**Default value:** `25` | `wrapEvents` | Wrap event titles to multiple lines. Breaks lines at the length defined by `maxTitleLength`.

**Possible values:** `true` or `false`
**Default value:** `false` +| `maxTitleLines` | The maximum number of lines a title will wrap vertically before being cut (Only enabled if `wrapEvents` is also enabled).

**Possible values:** `0` - `10`
**Default value:** `3` | `fetchInterval` | How often does the content needs to be fetched? (Milliseconds)

**Possible values:** `1000` - `86400000`
**Default value:** `300000` (5 minutes) | `animationSpeed` | Speed of the update animation. (Milliseconds)

**Possible values:** `0` - `5000`
**Default value:** `2000` (2 seconds) | `fade` | Fade the future events to black. (Gradient)

**Possible values:** `true` or `false`
**Default value:** `true` diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index d9cc8291..f2017a6c 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -19,6 +19,7 @@ Module.register("calendar", { defaultRepeatingCountTitle: "", maxTitleLength: 25, wrapEvents: false, // wrap events to multiple lines breaking at maxTitleLength + maxTitleLines: 3, fetchInterval: 5 * 60 * 1000, // Update every 5 minutes. animationSpeed: 2000, fade: true, @@ -220,7 +221,7 @@ Module.register("calendar", { var titleWrapper = document.createElement("td"), repeatingCountTitle = ""; - if (this.config.displayRepeatingCountTitle && event.firstYear !== undefined) { + if (this.config.displayRepeatingCountTitle && event.firstYear !== undefined) { repeatingCountTitle = this.countTitleForUrl(event.url); @@ -584,9 +585,10 @@ Module.register("calendar", { * @param {string} string Text string to shorten * @param {number} maxLength The max length of the string * @param {boolean} wrapEvents Wrap the text after the line has reached maxLength + * @param {number} maxTitleLines The max number of vertical lines before cutting event title * @returns {string} The shortened string */ - shorten: function (string, maxLength, wrapEvents) { + shorten: function (string, maxLength, wrapEvents, maxTitleLines) { if (typeof string !== "string") { return ""; } @@ -595,12 +597,19 @@ Module.register("calendar", { var temp = ""; var currentLine = ""; var words = string.split(" "); + var line = 0; for (var i = 0; i < words.length; i++) { var word = words[i]; if (currentLine.length + word.length < (typeof maxLength === "number" ? maxLength : 25) - 1) { // max - 1 to account for a space currentLine += (word + " "); } else { + line++; + if (line > maxTitleLines - 1) { + if (i < words.length) currentLine += "…"; + break; + } + if (currentLine.length > 0) { temp += (currentLine + "
" + word + " "); } else { @@ -651,7 +660,7 @@ Module.register("calendar", { title = title.replace(needle, replacement); } - title = this.shorten(title, this.config.maxTitleLength, this.config.wrapEvents); + title = this.shorten(title, this.config.maxTitleLength, this.config.wrapEvents, this.config.maxTitleLines); return title; }, From 320743ab8d92c2d915b6f879f65003554eec1f27 Mon Sep 17 00:00:00 2001 From: Andrew McOlash Date: Wed, 16 Jan 2019 22:53:28 -0800 Subject: [PATCH 25/38] fix spacing --- 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 f2017a6c..4220ec8c 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -221,7 +221,7 @@ Module.register("calendar", { var titleWrapper = document.createElement("td"), repeatingCountTitle = ""; - if (this.config.displayRepeatingCountTitle && event.firstYear !== undefined) { + if (this.config.displayRepeatingCountTitle && event.firstYear !== undefined) { repeatingCountTitle = this.countTitleForUrl(event.url); From 2e03868021facdad8ca891a5a759cdb84c80ec9d Mon Sep 17 00:00:00 2001 From: vincep5 Date: Thu, 17 Jan 2019 08:54:16 -0600 Subject: [PATCH 26/38] current.njk JS error and Loading string --- CHANGELOG.md | 1 + modules/default/weather/current.njk | 4 ++-- modules/default/weather/forecast.njk | 4 ++-- modules/default/weather/weather.js | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a1c4693..5f2015f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added humidity support to nunjuck unit filter. - Do not display degree symbol for temperature in Kelvin [#1503](https://github.com/MichMich/MagicMirror/issues/1503). - Added fade, fadePoint and maxNumberOfDays properties to the forecast mode [#1516](https://github.com/MichMich/MagicMirror/issues/1516) +- Fixed Loading string and decimalSymbol string replace [#1538](https://github.com/MichMich/MagicMirror/issues/1538) ## [2.6.0] - 2019-01-01 diff --git a/modules/default/weather/current.njk b/modules/default/weather/current.njk index 55720e23..64d22e7b 100644 --- a/modules/default/weather/current.njk +++ b/modules/default/weather/current.njk @@ -65,9 +65,9 @@ {% endif %} {% else %}
- {{ "LOADING" | translate }} + {{ "LOADING" | translate | safe }}
{% endif %} - + diff --git a/modules/default/weather/forecast.njk b/modules/default/weather/forecast.njk index 315ebff8..56074047 100644 --- a/modules/default/weather/forecast.njk +++ b/modules/default/weather/forecast.njk @@ -24,9 +24,9 @@ {% else %}
- {{ "LOADING" | translate }} + {{ "LOADING" | translate | safe }}
{% endif %} - + diff --git a/modules/default/weather/weather.js b/modules/default/weather/weather.js index 0c230424..f554c1fe 100644 --- a/modules/default/weather/weather.js +++ b/modules/default/weather/weather.js @@ -62,7 +62,7 @@ Module.register("weather",{ return ["font-awesome.css", "weather-icons.css", "weather.css"]; }, - // Return the scripts that are nessecery for the weather module. + // Return the scripts that are necessary for the weather module. getScripts: function () { return [ "moment.js", @@ -218,7 +218,7 @@ Module.register("weather",{ }.bind(this)); this.nunjucksEnvironment().addFilter("decimalSymbol", function(value) { - return value.replace(/\./g, this.config.decimalSymbol); + return value.toString().replace(/\./g, this.config.decimalSymbol); }.bind(this)); this.nunjucksEnvironment().addFilter("calcNumSteps", function(forecast) { From a0dde39d97ad4bc3d546d14adfa16da486622e6a Mon Sep 17 00:00:00 2001 From: Andrew McOlash Date: Mon, 21 Jan 2019 00:47:53 -0800 Subject: [PATCH 27/38] Fix braces for if check --- modules/default/calendar/calendar.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 4220ec8c..2c2970ec 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -606,7 +606,9 @@ Module.register("calendar", { } else { line++; if (line > maxTitleLines - 1) { - if (i < words.length) currentLine += "…"; + if (i < words.length) { + currentLine += "…"; + } break; } From 053b01e0362dcf66c2f5a427401dea45848f7f12 Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 25 Jan 2019 07:50:24 +0000 Subject: [PATCH 28/38] Updated README Scanned through it and corrected some spelling mistakes, nothing that affects the core purpose of the document. --- modules/README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/README.md b/modules/README.md index 8bc8f86e..5fb86df2 100644 --- a/modules/README.md +++ b/modules/README.md @@ -33,8 +33,8 @@ Therefore **we highly recommend you to include the following information in your - A high quality screenshot of your working module - A short, one sentence, clear description what it does (duh!) -- What external API's it depend on, including web links to those -- Wheteher the API/request require a key and the user limitations of those. (Is it free?) +- What external API's it depends upon, including web links to those +- Whether the API/request require a key and the user limitations of those. (Is it free?) Surely this also help you get better recognition and feedback for your work. @@ -46,8 +46,8 @@ A module can be placed in one single folder. Or multiple modules can be grouped ### Files - **modulename/modulename.js** - This is your core module script. -- **modulename/node_helper.js** - This is an optional helper that will be loaded by the node script. The node helper and module script can communicate with each other using an intergrated socket system. -- **modulename/public** - Any files in this folder can be accesed via the browser on `/modulename/filename.ext`. +- **modulename/node_helper.js** - This is an optional helper that will be loaded by the node script. The node helper and module script can communicate with each other using an integrated socket system. +- **modulename/public** - Any files in this folder can be accessed via the browser on `/modulename/filename.ext`. - **modulename/anyfileorfolder** Any other file or folder in the module folder can be used by the core module script. For example: *modulename/css/modulename.css* would be a good path for your additional module styles. ## The Core module file: modulename.js @@ -89,7 +89,7 @@ After the module is initialized, the module instance has a few available module | `this.data` | Object | The data object contain additional metadata about the module instance. (See below) | -The `this.data` data object contain the follwoing metadata: +The `this.data` data object contain the following metadata: - `data.classes` - The classes which are added to the module dom wrapper. - `data.file` - The filename of the core module file. - `data.path` - The path of the module folder. @@ -98,7 +98,7 @@ The `this.data` data object contain the follwoing metadata: #### `defaults: {}` -Any properties defined in the defaults object, will be merged with the module config as defined in the user's config.js file. This is the best place to set your modules's configuration defaults. Any of the module configuration properties can be accessed using `this.config.propertyName`, but more about that later. +Any properties defined in the defaults object, will be merged with the module config as defined in the user's config.js file. This is the best place to set your modules' configuration defaults. Any of the module configuration properties can be accessed using `this.config.propertyName`, but more about that later. #### `requiresVersion:` @@ -134,7 +134,7 @@ loaded: function(callback) { ```` #### `start()` -This method is called when all modules are loaded an the system is ready to boot up. Keep in mind that the dom object for the module is not yet created. The start method is a perfect place to define any additional module properties: +This method is called when all modules are loaded and the system is ready to boot up. Keep in mind that the dom object for the module is not yet created. The start method is a perfect place to define any additional module properties: **Example:** ````javascript @@ -161,7 +161,7 @@ getScripts: function() { } ```` -**Note:** If a file can not be loaded, the boot up of the mirror will stall. Therefore it's advised not to use any external urls. +**Note:** If a file can not be loaded, the boot up of the mirror will stall. Therefore, it's advised not to use any external urls. #### `getStyles()` @@ -174,14 +174,14 @@ The getStyles method is called to request any additional stylesheets that need t getStyles: function() { return [ 'script.css', // will try to load it from the vendor folder, otherwise it will load is from the module folder. - 'font-awesome.css', // this file is available in the vendor folder, so it doesn't need to be avialable in the module folder. + 'font-awesome.css', // this file is available in the vendor folder, so it doesn't need to be available in the module folder. this.file('anotherfile.css'), // this file will be loaded straight from the module folder. 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css', // this file will be loaded from the bootstrapcdn servers. ] } ```` -**Note:** If a file can not be loaded, the boot up of the mirror will stall. Therefore it's advised not to use any external urls. +**Note:** If a file can not be loaded, the boot up of the mirror will stall. Therefore, it's advised not to use any external URLs. #### `getTranslations()` **Should return: Dictionary** @@ -239,7 +239,7 @@ That MagicMirror core has the ability to send notifications to modules. Or even - `notification` - String - The notification identifier. - `payload` - AnyType - The payload of a notification. -- `sender` - Module - The sender of the notification. If this argument is `undefined`, the sender of the notififiction is the core system. +- `sender` - Module - The sender of the notification. If this argument is `undefined`, the sender of the notification is the core system. **Example:** ````javascript @@ -346,7 +346,7 @@ Possible configurable options: - `lockString` - String - When setting lock string, the module can not be shown without passing the correct lockstring. This way (multiple) modules can prevent a module from showing. It's considered best practice to use your modules identifier as the locksString: `this.identifier`. See *visibility locking* below. -**Note 1:** If the hide animation is canceled, for instance because the show method is called before the hide animation was finished, the callback will not be called.
+**Note 1:** If the hide animation is cancelled, for instance because the show method is called before the hide animation was finished, the callback will not be called.
**Note 2:** If the hide animation is hijacked (an other method calls hide on the same module), the callback will not be called.
**Note 3:** If the dom is not yet created, the hide method won't work. Wait for the `DOM_OBJECTS_CREATED` [notification](#notificationreceivednotification-payload-sender). @@ -371,7 +371,7 @@ Possible configurable options: (*Introduced in version: 2.1.0.*) -Visiblity locking helps the module system to prevent unwanted hide/show actions. The following scenario explains the concept: +Visibility locking helps the module system to prevent unwanted hide/show actions. The following scenario explains the concept: **Module B asks module A to hide:** ````javascript @@ -436,7 +436,7 @@ If no translation is found, a fallback will be used. The fallback sequence is as - 4. Translation as defined in core translation file of the fallback language (the first defined core translation file). - 5. The key (identifier) of the translation. -When adding translations to your module, it's a good idea to see if an apropriate translation is already available in the [core translation files](https://github.com/MichMich/MagicMirror/tree/master/translations). This way, your module can benefit from the existing translations. +When adding translations to your module, it's a good idea to see if an appropriate translation is already available in the [core translation files](https://github.com/MichMich/MagicMirror/tree/master/translations). This way, your module can benefit from the existing translations. **Example:** ````javascript @@ -490,7 +490,7 @@ this.translate("RUNNING", { )}); // Will return a translated string for the identifier RUNNING, replacing `{timeUntilEnd}` with the contents of the variable `timeUntilEnd` in the order that translator intended. (has a fallback) ```` -**Example swedish .json file that does not have the variable in it:** +**Example Swedish .json file that does not have the variable in it:** ````javascript { "RUNNING": "Slutar", From 12efb87a23abf641e1836b19eb571aa60ca6f634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Sat, 26 Jan 2019 14:42:15 -0500 Subject: [PATCH 29/38] serveronly: Replace the console.log of none for a \n new line --- serveronly/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/serveronly/index.js b/serveronly/index.js index ccd4c294..3b8013ef 100644 --- a/serveronly/index.js +++ b/serveronly/index.js @@ -1,6 +1,5 @@ var app = require("../js/app.js"); app.start(function(config) { - console.log(""); var bindAddress = config.address ? config.address : "localhost"; - console.log("Ready to go! Please point your browser to: http://" + bindAddress + ":" + config.port); + console.log("\nReady to go! Please point your browser to: http://" + bindAddress + ":" + config.port); }); From 5ca3fbeaea6d5c6c11b2f2e8a5b2959db7f4fcc9 Mon Sep 17 00:00:00 2001 From: Jacob Ebey Date: Sat, 9 Feb 2019 12:42:42 -0800 Subject: [PATCH 30/38] Added autoLocation option for weather modules. --- CHANGELOG.md | 1 + .../default/currentweather/currentweather.js | 14 ++++++++- modules/default/currentweather/node_helper.js | 29 +++++++++++++++++++ .../default/weatherforecast/node_helper.js | 29 +++++++++++++++++++ .../weatherforecast/weatherforecast.js | 15 ++++++++-- 5 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 modules/default/currentweather/node_helper.js create mode 100644 modules/default/weatherforecast/node_helper.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d4787a3..3ff24c38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Italian translation for "Feels" - Disabled the screensaver on raspbian with installation script - Added option to truncate the number of vertical lines a calendar item can span if `wrapEvents` is enabled. +- Added autoLocation options for weather forcast and current weather modules. ### Updated - Bumped the Electron dependency to v3.0.13 to support the most recent Raspbian. [#1500](https://github.com/MichMich/MagicMirror/issues/1500) diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 2a6d24b9..0472b7a1 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -11,6 +11,7 @@ Module.register("currentweather",{ // Default module config. defaults: { + autoLocation: false, location: false, locationID: false, appid: "", @@ -109,8 +110,19 @@ Module.register("currentweather",{ this.weatherType = null; this.feelsLike = null; this.loaded = false; - this.scheduleUpdate(this.config.initialLoadDelay); + if (this.config.autoLocation) { + this.sendSocketNotification("AUTO_LOCATION"); + } else { + this.scheduleUpdate(this.config.initialLoadDelay); + } + }, + + socketNotificationReceived: function (notification, payload) { + if (notification === "UPDATE_LOCATION") { + this.config.location = payload.location; + this.scheduleUpdate(this.config.initialLoadDelay); + } }, // add extra information of current weather diff --git a/modules/default/currentweather/node_helper.js b/modules/default/currentweather/node_helper.js new file mode 100644 index 00000000..f650cdb8 --- /dev/null +++ b/modules/default/currentweather/node_helper.js @@ -0,0 +1,29 @@ +var http = require("http"); +var NodeHelper = require("node_helper"); + +module.exports = NodeHelper.create({ + start: function () { + }, + + socketNotificationReceived: function (notification, payload) { + var self = this; + + if (notification === "AUTO_LOCATION") { + console.log("Loading timezone..."); + http.get("http://ip-api.com/json", function (req) { + var data = ""; + req.on("data", function (d) { + data += d; + }); + req.on("end", function () { + var body = JSON.parse(data); + payload.location = body.city + ", " + body.regionName; + self.sendSocketNotification("UPDATE_LOCATION", payload); + }); + }).on("error", function () { + payload.error = "Could not figure out the timezone."; + self.sendSocketNotification("UPDATE_LOCATION", payload); + }); + } + } +}); diff --git a/modules/default/weatherforecast/node_helper.js b/modules/default/weatherforecast/node_helper.js new file mode 100644 index 00000000..f650cdb8 --- /dev/null +++ b/modules/default/weatherforecast/node_helper.js @@ -0,0 +1,29 @@ +var http = require("http"); +var NodeHelper = require("node_helper"); + +module.exports = NodeHelper.create({ + start: function () { + }, + + socketNotificationReceived: function (notification, payload) { + var self = this; + + if (notification === "AUTO_LOCATION") { + console.log("Loading timezone..."); + http.get("http://ip-api.com/json", function (req) { + var data = ""; + req.on("data", function (d) { + data += d; + }); + req.on("end", function () { + var body = JSON.parse(data); + payload.location = body.city + ", " + body.regionName; + self.sendSocketNotification("UPDATE_LOCATION", payload); + }); + }).on("error", function () { + payload.error = "Could not figure out the timezone."; + self.sendSocketNotification("UPDATE_LOCATION", payload); + }); + } + } +}); diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 67193696..1867da36 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -11,6 +11,7 @@ Module.register("weatherforecast",{ // Default module config. defaults: { + autoLocation: false, location: false, locationID: false, appid: "", @@ -95,10 +96,20 @@ Module.register("weatherforecast",{ this.forecast = []; this.loaded = false; - this.scheduleUpdate(this.config.initialLoadDelay); - this.updateTimer = null; + + if (this.config.autoLocation) { + this.sendSocketNotification("AUTO_LOCATION"); + } else { + this.scheduleUpdate(this.config.initialLoadDelay); + } + }, + socketNotificationReceived: function (notification, payload) { + if (notification === "UPDATE_LOCATION") { + this.config.location = payload.location; + this.scheduleUpdate(this.config.initialLoadDelay); + } }, // Override dom generator. From 1a97107b2d1ee5e0d3216ad290d976cf1ec9b568 Mon Sep 17 00:00:00 2001 From: Jacob Ebey Date: Sat, 9 Feb 2019 12:49:47 -0800 Subject: [PATCH 31/38] - Converted indentation to tabs. --- modules/default/currentweather/node_helper.js | 38 +++++++++---------- .../default/weatherforecast/node_helper.js | 38 +++++++++---------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/modules/default/currentweather/node_helper.js b/modules/default/currentweather/node_helper.js index f650cdb8..53956f62 100644 --- a/modules/default/currentweather/node_helper.js +++ b/modules/default/currentweather/node_helper.js @@ -2,28 +2,28 @@ var http = require("http"); var NodeHelper = require("node_helper"); module.exports = NodeHelper.create({ - start: function () { - }, + start: function () { + }, - socketNotificationReceived: function (notification, payload) { - var self = this; + socketNotificationReceived: function (notification, payload) { + var self = this; if (notification === "AUTO_LOCATION") { - console.log("Loading timezone..."); - http.get("http://ip-api.com/json", function (req) { - var data = ""; - req.on("data", function (d) { - data += d; - }); - req.on("end", function () { - var body = JSON.parse(data); - payload.location = body.city + ", " + body.regionName; - self.sendSocketNotification("UPDATE_LOCATION", payload); - }); - }).on("error", function () { - payload.error = "Could not figure out the timezone."; - self.sendSocketNotification("UPDATE_LOCATION", payload); - }); + console.log("Loading timezone..."); + http.get("http://ip-api.com/json", function (req) { + var data = ""; + req.on("data", function (d) { + data += d; + }); + req.on("end", function () { + var body = JSON.parse(data); + payload.location = body.city + ", " + body.regionName; + self.sendSocketNotification("UPDATE_LOCATION", payload); + }); + }).on("error", function () { + payload.error = "Could not figure out the timezone."; + self.sendSocketNotification("UPDATE_LOCATION", payload); + }); } } }); diff --git a/modules/default/weatherforecast/node_helper.js b/modules/default/weatherforecast/node_helper.js index f650cdb8..53956f62 100644 --- a/modules/default/weatherforecast/node_helper.js +++ b/modules/default/weatherforecast/node_helper.js @@ -2,28 +2,28 @@ var http = require("http"); var NodeHelper = require("node_helper"); module.exports = NodeHelper.create({ - start: function () { - }, + start: function () { + }, - socketNotificationReceived: function (notification, payload) { - var self = this; + socketNotificationReceived: function (notification, payload) { + var self = this; if (notification === "AUTO_LOCATION") { - console.log("Loading timezone..."); - http.get("http://ip-api.com/json", function (req) { - var data = ""; - req.on("data", function (d) { - data += d; - }); - req.on("end", function () { - var body = JSON.parse(data); - payload.location = body.city + ", " + body.regionName; - self.sendSocketNotification("UPDATE_LOCATION", payload); - }); - }).on("error", function () { - payload.error = "Could not figure out the timezone."; - self.sendSocketNotification("UPDATE_LOCATION", payload); - }); + console.log("Loading timezone..."); + http.get("http://ip-api.com/json", function (req) { + var data = ""; + req.on("data", function (d) { + data += d; + }); + req.on("end", function () { + var body = JSON.parse(data); + payload.location = body.city + ", " + body.regionName; + self.sendSocketNotification("UPDATE_LOCATION", payload); + }); + }).on("error", function () { + payload.error = "Could not figure out the timezone."; + self.sendSocketNotification("UPDATE_LOCATION", payload); + }); } } }); From c608636b7adbb6e40ea920199825277b99da03c0 Mon Sep 17 00:00:00 2001 From: Jacob Ebey Date: Sat, 9 Feb 2019 13:41:42 -0800 Subject: [PATCH 32/38] - Added autoTimezone property to the clock --- CHANGELOG.md | 1 + modules/default/clock/clock.js | 26 ++++++++++++++++++++----- modules/default/clock/node_helper.js | 29 ++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 modules/default/clock/node_helper.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ff24c38..7d90b047 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Disabled the screensaver on raspbian with installation script - Added option to truncate the number of vertical lines a calendar item can span if `wrapEvents` is enabled. - Added autoLocation options for weather forcast and current weather modules. +- Added autoTimezone option for the default clock module. ### Updated - Bumped the Electron dependency to v3.0.13 to support the most recent Raspbian. [#1500](https://github.com/MichMich/MagicMirror/issues/1500) diff --git a/modules/default/clock/clock.js b/modules/default/clock/clock.js index 23b801d0..03528bce 100644 --- a/modules/default/clock/clock.js +++ b/modules/default/clock/clock.js @@ -26,6 +26,7 @@ Module.register("clock",{ analogShowDate: "top", // options: false, 'top', or 'bottom' secondsColor: "#888888", timezone: null, + autoTimezone: false }, // Define required scripts. getScripts: function() { @@ -39,16 +40,31 @@ Module.register("clock",{ start: function() { Log.info("Starting module: " + this.name); - // Schedule update interval. - var self = this; - setInterval(function() { - self.updateDom(); - }, 1000); + if (this.config.autoTimezone) { + this.sendSocketNotification("AUTO_TIMEZONE"); + } else { + // Schedule update interval. + var self = this; + setInterval(function() { + self.updateDom(); + }, 1000); + } // Set locale. moment.locale(config.language); }, + + socketNotificationReceived: function (notification, payload) { + if (notification === "UPDATE_TIMEZONE") { + var self = this; + self.config.timezone = payload.timezone; + setInterval(function() { + self.updateDom(); + }, 1000); + } + }, + // Override dom generator. getDom: function() { diff --git a/modules/default/clock/node_helper.js b/modules/default/clock/node_helper.js new file mode 100644 index 00000000..68258b0a --- /dev/null +++ b/modules/default/clock/node_helper.js @@ -0,0 +1,29 @@ +var http = require("http"); +var NodeHelper = require("node_helper"); + +module.exports = NodeHelper.create({ + start: function () { + }, + + socketNotificationReceived: function (notification, payload) { + var self = this; + + if (notification === "AUTO_TIMEZONE") { + console.log("Loading timezone..."); + http.get("http://ip-api.com/json", function (req) { + var data = ""; + req.on("data", function (d) { + data += d; + }); + req.on("end", function () { + var body = JSON.parse(data); + payload.timezone = body.timezone; + self.sendSocketNotification("UPDATE_TIMEZONE", payload); + }); + }).on("error", function () { + payload.error = "Could not figure out the timezone."; + self.sendSocketNotification("UPDATE_TIMEZONE", payload); + }); + } + } +}); From 3d5ad29eacda9936e10d056a268a67b3c3ac40d3 Mon Sep 17 00:00:00 2001 From: Jacob Ebey Date: Sat, 9 Feb 2019 13:51:23 -0800 Subject: [PATCH 33/38] - Removed trailing space --- modules/default/weatherforecast/weatherforecast.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 1867da36..c32821db 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -97,7 +97,7 @@ Module.register("weatherforecast",{ this.forecast = []; this.loaded = false; this.updateTimer = null; - + if (this.config.autoLocation) { this.sendSocketNotification("AUTO_LOCATION"); } else { From c5888cec661fc40a1a4c22bce206979a5b03e51d Mon Sep 17 00:00:00 2001 From: Anthony Buisset Date: Sun, 10 Feb 2019 16:17:20 +0100 Subject: [PATCH 34/38] Fix exdate handling when multiple values are specified (comma separated) --- CHANGELOG.md | 1 + .../default/calendar/vendor/ical.js/ical.js | 78 ++++++++++++------- 2 files changed, 50 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d4787a3..2085491d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Fixed compatibility issues caused when modules request different versions of Font Awesome, see issue [#1522](https://github.com/MichMich/MagicMirror/issues/1522). MagicMirror now uses [Font Awesome 5 with v4 shims included for backwards compatibility](https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#shims). - 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) ### New weather module - Fixed weather forecast table display [#1499](https://github.com/MichMich/MagicMirror/issues/1499). diff --git a/modules/default/calendar/vendor/ical.js/ical.js b/modules/default/calendar/vendor/ical.js/ical.js index f60c5357..8f0c532b 100644 --- a/modules/default/calendar/vendor/ical.js/ical.js +++ b/modules/default/calendar/vendor/ical.js/ical.js @@ -80,16 +80,45 @@ } } - var addTZ = function(dt, name, params){ + var addTZ = function(dt, params){ var p = parseParams(params); - if (params && p){ - dt[name].tz = p.TZID + if (params && p && dt){ + dt.tz = p.TZID } return dt } + var parseTimestamp = function(val){ + //typical RFC date-time format + var comps = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(Z)?$/.exec(val); + if (comps !== null) { + if (comps[7] == 'Z'){ // GMT + return new Date(Date.UTC( + parseInt(comps[1], 10), + parseInt(comps[2], 10)-1, + parseInt(comps[3], 10), + parseInt(comps[4], 10), + parseInt(comps[5], 10), + parseInt(comps[6], 10 ) + )); + // TODO add tz + } else { + return new Date( + parseInt(comps[1], 10), + parseInt(comps[2], 10)-1, + parseInt(comps[3], 10), + parseInt(comps[4], 10), + parseInt(comps[5], 10), + parseInt(comps[6], 10) + ); + } + } + + return undefined; + } + var dateParam = function(name){ return function(val, params, curr){ @@ -108,37 +137,24 @@ comps[3] ); - return addTZ(curr, name, params); + curr[name] = addTZ(curr[name], params); + return curr; } } + curr[name] = [] + val.split(',').forEach(function(val){ + var newDate = parseTimestamp(val); + curr[name].push(addTZ(newDate, params)); + }); - //typical RFC date-time format - var comps = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(Z)?$/.exec(val); - if (comps !== null) { - if (comps[7] == 'Z'){ // GMT - curr[name] = new Date(Date.UTC( - parseInt(comps[1], 10), - parseInt(comps[2], 10)-1, - parseInt(comps[3], 10), - parseInt(comps[4], 10), - parseInt(comps[5], 10), - parseInt(comps[6], 10 ) - )); - // TODO add tz - } else { - curr[name] = new Date( - parseInt(comps[1], 10), - parseInt(comps[2], 10)-1, - parseInt(comps[3], 10), - parseInt(comps[4], 10), - parseInt(comps[5], 10), - parseInt(comps[6], 10) - ); - } + if (curr[name].length === 0){ + delete curr[name]; + } else if (curr[name].length === 1){ + curr[name] = curr[name][0]; } - return addTZ(curr, name, params) + return curr; } } @@ -148,7 +164,11 @@ if (date.exdates === undefined) { date.exdates = []; } - date.exdates.push(date.exdate); + if (Array.isArray(date.exdate)){ + date.exdates = date.exdates.concat(date.exdate); + } else { + date.exdates.push(date.exdate); + } return date; } } From 017a376616ff240c5f667ecfc9ad421ef403ca4a Mon Sep 17 00:00:00 2001 From: stefsims <17434315+stefsims@users.noreply.github.com> Date: Mon, 11 Feb 2019 08:59:16 +0100 Subject: [PATCH 35/38] Update da.json Added FEELS and WEEK --- translations/da.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/translations/da.json b/translations/da.json index 4f4f50e7..11722d64 100644 --- a/translations/da.json +++ b/translations/da.json @@ -6,6 +6,8 @@ "DAYAFTERTOMORROW": "I overmorgen", "RUNNING": "Slutter om", "EMPTY": "Ingen kommende begivenheder.", + "FEELS": "Føles som", + "WEEK": "Uge {weekNumber}", "N": "N", "NNE": "NNØ", From 56788f093306a8ff37cc26f8984f0f6df00b132d Mon Sep 17 00:00:00 2001 From: stefsims <17434315+stefsims@users.noreply.github.com> Date: Mon, 11 Feb 2019 09:02:42 +0100 Subject: [PATCH 36/38] Update CHANGELOG.md Added danish translation --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d4787a3..9061e7ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Italian translation for "Feels" - Disabled the screensaver on raspbian with installation script - Added option to truncate the number of vertical lines a calendar item can span if `wrapEvents` is enabled. +- Danish translation for "Feels" and "Weeks" ### Updated - Bumped the Electron dependency to v3.0.13 to support the most recent Raspbian. [#1500](https://github.com/MichMich/MagicMirror/issues/1500) From 77d14bc218bdd6e5dccc71dc0fd28d6210895776 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Wed, 13 Feb 2019 16:12:46 +0100 Subject: [PATCH 37/38] Add donation link. --- README.md | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3d39832c..2a284ed8 100644 --- a/README.md +++ b/README.md @@ -16,18 +16,22 @@ MagicMirror² focuses on a modular plugin system and uses [Electron](http://elec ## Table Of Contents +- [Table Of Contents](#table-of-contents) - [Installation](#installation) - - [Raspberry Pi](#raspberry-pi) - - [General](#general) - - [Server Only](#server-only) - - [Client Only](#client-only) - - [Docker](#docker) + - [Raspberry Pi](#raspberry-pi) + - [Automatic Installation (Raspberry Pi only!)](#automatic-installation-raspberry-pi-only) + - [Manual Installation](#manual-installation) + - [Server Only](#server-only) + - [Client Only](#client-only) + - [Docker](#docker) - [Configuration](#configuration) + - [Raspberry Specific](#raspberry-specific) + - [General](#general) - [Modules](#modules) - [Updating](#updating) -- [Known Issues](#known-issues) - [Community](#community) - [Contributing Guidelines](#contributing-guidelines) +- [Enjoying MagicMirror? Consider a donation!](#enjoying-magicmirror-consider-a-donation) - [Manifesto](#manifesto) ## Installation @@ -199,6 +203,16 @@ Please keep the following in mind: Thanks for your help in making MagicMirror² better! + +## Enjoying MagicMirror? Consider a donation! + +MagicMirror² is opensource and free. That doesn't mean we don't need any money. + +Please consider a donation to help us cover the ongoing costs like webservers and email services. +If we recieve enough donations we might even be able to free up some working hours and spend some extra time improving the MagicMirror² core. + +To donate, please follow [this](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=G5D8E9MR5DTD2&source=url) link. + ## Manifesto A real Manifesto is still to be written. Till then, Michael's response on [one of the repository issues](https://github.com/MichMich/MagicMirror/issues/1174) gives a great summary: From 4a97052708ccd7ee71dea3c8686d0449c16ad440 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Thu, 14 Feb 2019 13:50:16 +0100 Subject: [PATCH 38/38] Fix linting error. --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 2a284ed8..e4248411 100644 --- a/README.md +++ b/README.md @@ -18,15 +18,15 @@ MagicMirror² focuses on a modular plugin system and uses [Electron](http://elec - [Table Of Contents](#table-of-contents) - [Installation](#installation) - - [Raspberry Pi](#raspberry-pi) - - [Automatic Installation (Raspberry Pi only!)](#automatic-installation-raspberry-pi-only) - - [Manual Installation](#manual-installation) - - [Server Only](#server-only) - - [Client Only](#client-only) - - [Docker](#docker) + - [Raspberry Pi](#raspberry-pi) + - [Automatic Installation (Raspberry Pi only!)](#automatic-installation-raspberry-pi-only) + - [Manual Installation](#manual-installation) + - [Server Only](#server-only) + - [Client Only](#client-only) + - [Docker](#docker) - [Configuration](#configuration) - - [Raspberry Specific](#raspberry-specific) - - [General](#general) + - [Raspberry Specific](#raspberry-specific) + - [General](#general) - [Modules](#modules) - [Updating](#updating) - [Community](#community)