Skip to content

Commit 6db61b4

Browse files
authored
Merge pull request #1418 from MichMich/develop
Develop
2 parents 6aa156d + f245cbf commit 6db61b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+234
-93
lines changed

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,39 @@ All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55

66
---
7+
## [2.5.0] - 2018-10-01
8+
9+
### Added
10+
- Support multi-line compliments
11+
- Simplified Chinese translation for "Feels"
12+
- Polish translate for "Feels"
13+
- French translate for "Feels"
14+
- Translations for newsfeed module
15+
- Support for toggling news article in fullscreen
16+
- Hungarian translation for "Feels" and "Week"
17+
- Spanish translation for "Feels"
18+
- Add classes instead of inline style to the message from the module Alert
19+
- Support for events having a duration instead of an end
20+
- Support for showing end of events through config parameters showEnd and dateEndFormat
21+
22+
### Fixed
23+
- Fixed gzip encoded calendar loading issue #1400.
24+
- Mixup between german and spanish translation for newsfeed.
25+
- Fixed close dates to be absolute, if no configured in the config.js - module Calendar
26+
- Fixed the UpdateNotification module message about new commits in the repository, so they can be correctly localized in singular and plural form.
27+
- Fix for weatherforecast rainfall rounding [#1374](https://github.com/MichMich/MagicMirror/issues/1374)
28+
- Fix calendar parsing issue for Midori on RasperryPi Zero w, related to issue #694.
29+
- Fix weather city ID link in sample config
30+
- Fixed issue with clientonly not updating with IP address and port provided on command line.
31+
32+
### Updated
33+
34+
- Updated Simplified Chinese translation
35+
- Swedish translations
36+
- Hungarian translations for the updatenotification module
37+
- Updated Norsk bokmål translation
38+
- Updated Norsk nynorsk translation
39+
- Consider multi days event as full day events
740

841
## [2.4.1] - 2018-07-04
942

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/maste
4848

4949
#### Manual Installation
5050

51-
1. Download and install the latest *Node.js* version.
51+
1. Download and install the latest *Node.js* version:
52+
- `curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -`
53+
- `sudo apt install -y nodejs`
5254
2. Clone the repository and check out the master branch: `git clone https://github.com/MichMich/MagicMirror`
5355
3. Enter the repository: `cd MagicMirror/`
5456
4. Install and run the app with: `npm install && npm start` \

clientonly/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@
6262
// Only start the client if a non-local server was provided
6363
if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].indexOf(config.address) === -1) {
6464
getServerConfig(`http://${config.address}:${config.port}/config/`)
65-
.then(function (config) {
65+
.then(function (configReturn) {
6666
// Pass along the server config via an environment variable
6767
var env = Object.create(process.env);
6868
var options = { env: env };
69-
config.address = config.address;
70-
config.port = config.port;
71-
env.config = JSON.stringify(config);
69+
configReturn.address = config.address;
70+
configReturn.port = config.port;
71+
env.config = JSON.stringify(configReturn);
7272

7373
// Spawn electron application
7474
const electron = require("electron");

config/config.js.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var config = {
5959
position: "top_right",
6060
config: {
6161
location: "New York",
62-
locationID: "", //ID from http://www.openweathermap.org/help/city_list.txt
62+
locationID: "", //ID from http://bulk.openweathermap.org/sample/; unzip the gz file and find your city
6363
appid: "YOUR_OPENWEATHER_API_KEY"
6464
}
6565
},

css/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ sup {
128128
text-overflow: ellipsis;
129129
}
130130

131+
.pre-line {
132+
white-space: pre-line;
133+
}
134+
131135
/**
132136
* Region Definitions.
133137
*/

modules/default/alert/alert.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ Module.register("alert",{
3838
if (this.config.effect == "slide") {this.config.effect = this.config.effect + "-" + this.config.position;}
3939
msg = "";
4040
if (message.title) {
41-
msg += "<span class='thin' style='line-height: 35px; font-size:24px' color='#4A4A4A'>" + message.title + "</span>";
41+
msg += "<span class='thin dimmed medium'>" + message.title + "</span>";
4242
}
4343
if (message.message){
4444
if (msg != ""){
4545
msg+= "<br />";
4646
}
47-
msg += "<span class='light' style='font-size:28px;line-height: 30px;'>" + message.message + "</span>";
47+
msg += "<span class='light bright small'>" + message.message + "</span>";
4848
}
4949

5050
new NotificationFx({
@@ -63,9 +63,9 @@ Module.register("alert",{
6363
params.imageUrl = null;
6464
image = "";
6565
} else if (typeof params.imageFA === "undefined"){
66-
image = "<img src='" + (params.imageUrl).toString() + "' height=" + (params.imageHeight).toString() + " style='margin-bottom: 10px;'/><br />";
66+
image = "<img src='" + (params.imageUrl).toString() + "' height='" + (params.imageHeight).toString() + "' style='margin-bottom: 10px;'/><br />";
6767
} else if (typeof params.imageUrl === "undefined"){
68-
image = "<span class='" + "fa fa-" + params.imageFA + "' style='margin-bottom: 10px;color: #fff;font-size:" + (params.imageHeight).toString() + ";'/></span><br />";
68+
image = "<span class='bright " + "fa fa-" + params.imageFA + "' style='margin-bottom: 10px;font-size:" + (params.imageHeight).toString() + ";'/></span><br />";
6969
}
7070
//Create overlay
7171
var overlay = document.createElement("div");
@@ -79,16 +79,16 @@ Module.register("alert",{
7979
}
8080

8181
//Display title and message only if they are provided in notification parameters
82-
message ="";
82+
var message = "";
8383
if (params.title) {
84-
message += "<span class='light' style='line-height: 35px; font-size:30px' color='#4A4A4A'>" + params.title + "</span>"
84+
message += "<span class='light dimmed medium'>" + params.title + "</span>";
8585
}
8686
if (params.message) {
87-
if (message != ""){
87+
if (message !== ""){
8888
message += "<br />";
8989
}
9090

91-
message += "<span class='thin' style='font-size:22px;line-height: 30px;'>" + params.message + "</span>";
91+
message += "<span class='thin bright small'>" + params.message + "</span>";
9292
}
9393

9494
//Store alert in this.alerts
@@ -121,16 +121,16 @@ Module.register("alert",{
121121
setPosition: function(pos) {
122122
//Add css to body depending on the set position for notifications
123123
var sheet = document.createElement("style");
124-
if (pos == "center") {sheet.innerHTML = ".ns-box {margin-left: auto; margin-right: auto;text-align: center;}";}
125-
if (pos == "right") {sheet.innerHTML = ".ns-box {margin-left: auto;text-align: right;}";}
126-
if (pos == "left") {sheet.innerHTML = ".ns-box {margin-right: auto;text-align: left;}";}
124+
if (pos === "center") {sheet.innerHTML = ".ns-box {margin-left: auto; margin-right: auto;text-align: center;}";}
125+
if (pos === "right") {sheet.innerHTML = ".ns-box {margin-left: auto;text-align: right;}";}
126+
if (pos === "left") {sheet.innerHTML = ".ns-box {margin-right: auto;text-align: left;}";}
127127
document.body.appendChild(sheet);
128128

129129
},
130130
notificationReceived: function(notification, payload, sender) {
131131
if (notification === "SHOW_ALERT") {
132132
if (typeof payload.type === "undefined") { payload.type = "alert"; }
133-
if (payload.type == "alert") {
133+
if (payload.type === "alert") {
134134
this.show_alert(payload, sender);
135135
} else if (payload.type = "notification") {
136136
this.show_notification(payload);
@@ -143,7 +143,7 @@ Module.register("alert",{
143143
this.alerts = {};
144144
this.setPosition(this.config.position);
145145
if (this.config.welcome_message) {
146-
if (this.config.welcome_message == true){
146+
if (this.config.welcome_message === true){
147147
this.show_notification({title: this.translate("sysTitle"), message: this.translate("welcome")});
148148
}
149149
else{
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"sysTitle": "MagicMirror Notification",
3+
"welcome": "Bienvenue, le démarrage a été un succès!"
4+
}

modules/default/calendar/calendar.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ Module.register("calendar", {
2525
urgency: 7,
2626
timeFormat: "relative",
2727
dateFormat: "MMM Do",
28+
dateEndFormat: "HH:mm",
2829
fullDayEventDateFormat: "MMM Do",
30+
showEnd: true,
2931
getRelative: 6,
3032
fadePoint: 0.25, // Start on 1/4th of the list.
3133
hidePrivate: false,
@@ -287,6 +289,10 @@ Module.register("calendar", {
287289
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
288290
}
289291
}
292+
if(this.config.showEnd){
293+
timeWrapper.innerHTML += "-" ;
294+
timeWrapper.innerHTML += this.capFirst(moment(event.endDate , "x").format(this.config.fullDayEventDateFormat));
295+
}
290296
} else {
291297
if (event.startDate >= new Date()) {
292298
if (event.startDate - now < 2 * oneDay) {
@@ -295,8 +301,12 @@ Module.register("calendar", {
295301
// If event is within 6 hour, display 'in xxx' time format or moment.fromNow()
296302
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
297303
} else {
298-
// Otherwise just say 'Today/Tomorrow at such-n-such time'
299-
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").calendar());
304+
if(this.config.timeFormat === "absolute") {
305+
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").format(this.config.dateFormat));
306+
} else {
307+
// Otherwise just say 'Today/Tomorrow at such-n-such time'
308+
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").calendar());
309+
}
300310
}
301311
} else {
302312
/* Check to see if the user displays absolute or relative dates with their events
@@ -325,6 +335,11 @@ Module.register("calendar", {
325335
})
326336
);
327337
}
338+
if (this.config.showEnd) {
339+
timeWrapper.innerHTML += "-";
340+
timeWrapper.innerHTML += this.capFirst(moment(event.endDate, "x").format(this.config.dateEndFormat));
341+
342+
}
328343
}
329344
//timeWrapper.innerHTML += ' - '+ moment(event.startDate,'x').format('lll');
330345
//console.log(event);
@@ -436,7 +451,7 @@ Module.register("calendar", {
436451

437452

438453
listContainsEvent: function(eventList, event){
439-
for(let evt of eventList){
454+
for(var evt of eventList){
440455
if(evt.title === event.title && parseInt(evt.startDate) === parseInt(event.startDate)){
441456
return true;
442457
}

modules/default/calendar/calendarfetcher.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
2929
var opts = {
3030
headers: {
3131
"User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)"
32-
}
32+
},
33+
gzip: true
3334
};
3435

3536
if (auth) {
@@ -90,6 +91,9 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
9091
var endDate;
9192
if (typeof event.end !== "undefined") {
9293
endDate = eventDate(event, "end");
94+
} else if(typeof event.duration !== "undefined") {
95+
dur=moment.duration(event.duration);
96+
endDate = startDate.clone().add(dur);
9397
} else {
9498
if (!isFacebookBirthday) {
9599
endDate = startDate;
@@ -273,8 +277,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
273277
var start = event.start || 0;
274278
var startDate = new Date(start);
275279
var end = event.end || 0;
276-
277-
if (end - start === 24 * 60 * 60 * 1000 && startDate.getHours() === 0 && startDate.getMinutes() === 0) {
280+
if (((end - start) % (24 * 60 * 60 * 1000)) === 0 && startDate.getHours() === 0 && startDate.getMinutes() === 0) {
278281
// Is 24 hours, and starts on the middle of the night.
279282
return true;
280283
}

modules/default/compliments/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ config: {
107107
}
108108
````
109109

110+
#### Multi-line compliments:
111+
Use `\n` to split compliment text into multiple lines, e.g. `First line.\nSecond line.` will be shown as:
112+
```
113+
First line.
114+
Second line.
115+
```
116+
110117
### External Compliment File
111118
You may specify an external file that contains the three compliment arrays. This is particularly useful if you have a
112119
large number of compliments and do not wish to crowd your `config.js` file with a large array of compliments.

modules/default/compliments/compliments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Module.register("compliments", {
159159

160160
var compliment = document.createTextNode(complimentText);
161161
var wrapper = document.createElement("div");
162-
wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright";
162+
wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright pre-line";
163163
wrapper.appendChild(compliment);
164164

165165
return wrapper;

modules/default/newsfeed/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ MagicMirror's [notification mechanism](https://github.com/MichMich/MagicMirror/t
4141
| `ARTICLE_PREVIOUS` | Shows the previous news title (hiding the summary or previously fully displayed article)
4242
| `ARTICLE_MORE_DETAILS` | When received the _first time_, shows the corresponding description of the currently displayed news title. <br> The module expects that the module's configuration option `showDescription` is set to `false` (default value). <br><br> When received a _second consecutive time_, shows the full news article in an IFRAME. <br> This requires that the news page can be embedded in an IFRAME, e.g. doesn't have the HTTP response header [X-Frame-Options](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options) set to e.g. `DENY`.<br><br>When received the _next consecutive times_, reloads the page and scrolls down by `scrollLength` pixels to paginate through the article.
4343
| `ARTICLE_LESS_DETAILS` | Hides the summary or full news article and only displays the news title of the currently viewed news item.
44+
| `ARTICLE_TOGGLE_FULL` | Toogles article in fullscreen.
4445

4546
Note the payload of the sent notification event is ignored.
4647

0 commit comments

Comments
 (0)