Merge pull request #1113 from MichMich/develop

Release v2.2.0.
This commit is contained in:
Michael Teeuw 2018-01-01 12:44:24 +01:00 committed by GitHub
commit b2bc43da4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 8251 additions and 121 deletions

View File

@ -5,7 +5,7 @@
"max-len": ["error", 250],
"curly": "error",
"camelcase": ["error", {"properties": "never"}],
"no-trailing-spaces": ["error"],
"no-trailing-spaces": ["error", {"ignoreComments": false }],
"no-irregular-whitespace": ["error"]
},
"env": {

View File

@ -2,6 +2,35 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [2.2.0] - 2018-01-01
**Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install`
### Changed
- Calender week is now handled with a variable translation in order to move number language specific.
- Reverted the Electron dependency back to 1.4.15 since newer version don't seem to work on the Raspberry Pi very well.
### Added
- Add option to use [Nunjucks](https://mozilla.github.io/nunjucks/) templates in modules. (See `helloworld` module as an example.)
- Add Bulgarian translations for MagicMirror² and Alert module.
- Add graceful shutdown of modules by calling `stop` function of each `node_helper` on SIGINT before exiting.
- Link update subtext to Github diff of current version versus tracking branch.
- Add Catalan translation.
- Add ability to filter out newsfeed items based on prohibited words found in title (resolves #1071)
- Add options to truncate description support of a feed in newsfeed module
- Add reloadInterval option for particular feed in newsfeed module
- Add no-cache entries of HTTP headers in newsfeed module (fetcher)
- Add Czech translation.
- Add option for decimal symbols other than the decimal point for temperature values in both default weather modules: WeatherForecast and CurrentWeather.
### Updated
### Fixed
- Fixed issue with calendar module showing more than `maximumEntries` allows
- WeatherForecast and CurrentWeather are now using HTTPS instead of HTTP
- Correcting translation for Indonesian language
- Fix issue where calendar icons wouldn't align correctly
## [2.1.3] - 2017-10-01
**Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install`

View File

@ -122,7 +122,7 @@ The following properties can be configured:
| **Option** | **Description** |
| --- | --- |
| `port` | The port on which the MagicMirror² server will run on. The default value is `8080`. |
| `address` | The ip address the accept connections. The default open bind `::` is IPv6 is available or `0.0.0.0` IPv4 run on. Example config: `192.168.10.100`. |
| `address` | The ip address the accept connections. The default open bind `localhost`. Example config: `192.168.10.100`. |
| `ipWhitelist` | The list of IPs from which you are allowed to access the MagicMirror². The default value is `["127.0.0.1", "::ffff:127.0.0.1", "::1"]`. It is possible to specify IPs with subnet masks (`["127.0.0.1", "127.0.0.1/24"]`) or define ip ranges (`["127.0.0.1", ["192.168.0.1", "192.168.0.100"]]`). Set `[]` to allow all IP addresses. For more information about how configure this directive see the [follow post ipWhitelist HowTo](https://forum.magicmirror.builders/topic/1326/ipwhitelist-howto) |
| `zoom` | This allows to scale the mirror contents with a given zoom factor. The default value is `1.0`|
| `language` | The language of the interface. (Note: Not all elements will be localized.) Possible values are `en`, `nl`, `ru`, `fr`, etc., but the default value is `en`. |

12
fonts/package-lock.json generated Normal file
View File

@ -0,0 +1,12 @@
{
"name": "magicmirror-fonts",
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"roboto-fontface": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/roboto-fontface/-/roboto-fontface-0.8.0.tgz",
"integrity": "sha512-ZYzRkETgBrdEGzL5JSKimvjI2CX7ioyZCkX2BpcfyjqI+079W0wHAyj5W4rIZMcDSOHgLZtgz1IdDi/vU77KEQ=="
}
}
}

View File

@ -10,6 +10,6 @@
"url": "https://github.com/MichMich/MagicMirror/issues"
},
"dependencies": {
"roboto-fontface": "^0.8.0"
"roboto-fontface": "^0.8.0"
}
}

View File

@ -38,6 +38,7 @@
</div>
<div class="region fullscreen above"><div class="container"></div></div>
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<script type="text/javascript" src="vendor/node_modules/nunjucks/browser/nunjucks.min.js"></script>
<script type="text/javascript" src="js/defaults.js"></script>
<script type="text/javascript" src="#CONFIG_FILE#"></script>
<script type="text/javascript" src="vendor/vendor.js"></script>

View File

@ -236,6 +236,33 @@ var App = function() {
});
});
};
/* stop()
* This methods stops the core app.
* This calls each node_helper's STOP() function, if it exists.
* Added to fix #1056
*/
this.stop = function() {
for (var h in nodeHelpers) {
var nodeHelper = nodeHelpers[h];
if (typeof nodeHelper.stop === "function") {
nodeHelper.stop();
}
}
};
/* Listen for SIGINT signal and call stop() function.
*
* Added to fix #1056
* Note: this is only used if running `server-only`. Otherwise
* this.stop() is called by app.on("before-quit"... in `electron.js`
*/
process.on("SIGINT", () => {
console.log("[SIGINT] Received. Shutting down server...");
setTimeout(() => { process.exit(0); }, 3000); // Force quit after 3 seconds
this.stop();
process.exit(0);
});
};
module.exports = new App();

View File

@ -96,6 +96,20 @@ app.on("activate", function() {
}
});
/* This method will be called when SIGINT is received and will call
* each node_helper's stop function if it exists. Added to fix #1056
*
* Note: this is only used if running Electron. Otherwise
* core.stop() is called by process.on("SIGINT"... in `app.js`
*/
app.on("before-quit", (event) => {
console.log("Shutting down server...");
event.preventDefault();
setTimeout(() => { process.exit(0); }, 3000); // Force-quit after 3 seconds.
core.stop();
process.exit(0);
});
// Start the core application if server is run on localhost
// This starts all node helpers and starts the webserver.
if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].indexOf(config.address) > -1) {

View File

@ -27,6 +27,11 @@ var Module = Class.extend({
// visibility when hiding and showing module.
lockStrings: [],
// Storage of the nunjuck Environment,
// This should not be referenced directly.
// Use the nunjucksEnvironment() to get it.
_nunjucksEnvironment: null,
/* init()
* Is called when the module is instantiated.
*/
@ -70,23 +75,35 @@ var Module = Class.extend({
/* getDom()
* This method generates the dom which needs to be displayed. This method is called by the Magic Mirror core.
* This method needs to be subclassed if the module wants to display info on the mirror.
* This method can to be subclassed if the module wants to display info on the mirror.
* Alternatively, the getTemplete method could be subclassed.
*
* return domobject - The dom to display.
*/
getDom: function () {
var nameWrapper = document.createElement("div");
var name = document.createTextNode(this.name);
nameWrapper.appendChild(name);
var identifierWrapper = document.createElement("div");
var identifier = document.createTextNode(this.identifier);
identifierWrapper.appendChild(identifier);
identifierWrapper.className = "small dimmed";
var div = document.createElement("div");
div.appendChild(nameWrapper);
div.appendChild(identifierWrapper);
var template = this.getTemplate();
var templateData = this.getTemplateData();
// Check to see if we need to render a template string or a file.
if (/^.*((\.html)|(\.njk))$/.test(template)) {
// the template is a filename
this.nunjucksEnvironment().render(template, templateData, function (err, res) {
if (err) {
Log.error(err)
}
// The inner content of the div will be set after the template is received.
// This isn't the most optimal way, but since it's near instant
// it probably won't be an issue.
// If it gives problems, we can always add a way to pre fetch the templates.
// Let's not over optimise this ... KISS! :)
div.innerHTML = res;
});
} else {
// the template is a template string.
div.innerHTML = this.nunjucksEnvironment().renderString(template, templateData);
}
return div;
},
@ -102,6 +119,28 @@ var Module = Class.extend({
return this.data.header;
},
/* getTemplate()
* This method returns the template for the module which is used by the default getDom implementation.
* This method needs to be subclassed if the module wants to use a tempate.
* It can either return a template sting, or a template filename.
* If the string ends with '.html' it's considered a file from within the module's folder.
*
* return string - The template string of filename.
*/
getTemplate: function () {
return "<div class=\"normal\">" + this.name + "</div><div class=\"small dimmed\">" + this.identifier + "</div>";
},
/* getTemplateData()
* This method returns the data to be used in the template.
* This method needs to be subclassed if the module wants to use a custom data.
*
* return Object
*/
getTemplateData: function () {
return {}
},
/* notificationReceived(notification, payload, sender)
* This method is called when a notification arrives.
* This method is called by the Magic Mirror core.
@ -118,6 +157,30 @@ var Module = Class.extend({
}
},
/** nunjucksEnvironment()
* Returns the nunjucks environment for the current module.
* The environment is checked in the _nunjucksEnvironment instance variable.
* @returns Nunjucks Environment
*/
nunjucksEnvironment: function() {
if (this._nunjucksEnvironment != null) {
return this._nunjucksEnvironment;
}
var self = this;
this._nunjucksEnvironment = new nunjucks.Environment(new nunjucks.WebLoader(this.file(""), {async: true}), {
trimBlocks: true,
lstripBlocks: true
});
this._nunjucksEnvironment.addFilter("translate", function(str) {
return self.translate(str)
});
return this._nunjucksEnvironment;
},
/* socketNotificationReceived(notification, payload)
* This method is called when a socket notification arrives.
*
@ -276,8 +339,8 @@ var Module = Class.extend({
* Request the translation for a given key with optional variables and default value.
*
* argument key string - The key of the string to translate
* argument defaultValueOrVariables string/object - The default value or variables for translating. (Optional)
* argument defaultValue string - The default value with variables. (Optional)
* argument defaultValueOrVariables string/object - The default value or variables for translating. (Optional)
* argument defaultValue string - The default value with variables. (Optional)
*/
translate: function (key, defaultValueOrVariables, defaultValue) {
if(typeof defaultValueOrVariables === "object") {

View File

@ -555,6 +555,17 @@ start: function() {
}
````
#### `stop()`
This method is called when the MagicMirror server receives a `SIGINT` command and is shutting down. This method should include any commands needed to close any open connections, stop any sub-processes and gracefully exit the module.
**Example:**
````javascript
stop: function() {
console.log("Shutting down MyModule");
this.connection.close();
}
````
#### `socketNotificationReceived: function(notification, payload)`
With this method, your node helper can receive notifications from your modules. When this method is called, it has 2 arguments:

View File

@ -0,0 +1,4 @@
{
"sysTitle": "MagicMirror нотификация",
"welcome": "Добре дошли, стартирането беше успешно"
}

View File

@ -150,7 +150,7 @@ Module.register("calendar", {
for(var i = 0; i < symbols.length; i++) {
var symbol = document.createElement("span");
symbol.className = "fa fa-" + symbols[i];
symbol.className = "fa fa-fw fa-" + symbols[i];
if(i > 0){
symbol.style.paddingLeft = "5px";
}
@ -356,7 +356,7 @@ Module.register("calendar", {
return a.startDate - b.startDate;
});
return events;
return events.slice(0, this.config.maximumEntries);
},
/* createEventList(url)

View File

@ -94,7 +94,7 @@ Module.register("clock",{
dateWrapper.innerHTML = now.format(this.config.dateFormat);
}
if (this.config.showWeek) {
weekWrapper.innerHTML = this.translate("WEEK") + " " + now.week();
weekWrapper.innerHTML = this.translate("WEEK", { weekNumber: now.week() });
}
timeWrapper.innerHTML = timeString;
secondsWrapper.innerHTML = now.format("ss");

View File

@ -46,6 +46,7 @@ The following properties can be configured:
| `onlyTemp` | Show only current Temperature and weather icon. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `useBeaufort` | Pick between using the Beaufort scale for wind speed or using the default units. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `lang` | The language of the days. <br><br> **Possible values:** `en`, `nl`, `ru`, etc ... <br> **Default value:** uses value of _config.language_
| `decimalSymbol` | The decimal symbol to use.<br><br> **Possible values:** `.`, `,` or any other symbol.<br> **Default value:** `.`
| `initialLoadDelay` | The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds) <br><br> **Possible values:** `1000` - `5000` <br> **Default value:** `0`
| `retryDelay` | The delay before retrying after a request failure. (Milliseconds) <br><br> **Possible values:** `1000` - `60000` <br> **Default value:** `2500`
| `apiVersion` | The OpenWeatherMap API version to use. <br><br> **Default value:** `2.5`

View File

@ -24,6 +24,7 @@ Module.register("currentweather",{
showWindDirectionAsArrow: false,
useBeaufort: true,
lang: config.language,
decimalSymbol: ".",
showHumidity: false,
degreeLabel: false,
showIndoorTemperature: false,
@ -33,7 +34,7 @@ Module.register("currentweather",{
retryDelay: 2500,
apiVersion: "2.5",
apiBase: "http://api.openweathermap.org/data/",
apiBase: "https://api.openweathermap.org/data/",
weatherEndpoint: "weather",
appendLocationNameToHeader: true,
@ -209,9 +210,13 @@ Module.register("currentweather",{
}
}
if (this.config.decimalSymbol === "") {
this.config.decimalSymbol = ".";
}
var temperature = document.createElement("span");
temperature.className = "bright";
temperature.innerHTML = " " + this.temperature + "&deg;" + degreeLabel;
temperature.innerHTML = " " + this.temperature.replace(".", this.config.decimalSymbol) + "&deg;" + degreeLabel;
large.appendChild(temperature);
if (this.config.showIndoorTemperature && this.indoorTemperature) {
@ -221,7 +226,7 @@ Module.register("currentweather",{
var indoorTemperatureElem = document.createElement("span");
indoorTemperatureElem.className = "bright";
indoorTemperatureElem.innerHTML = " " + this.indoorTemperature + "&deg;" + degreeLabel;
indoorTemperatureElem.innerHTML = " " + this.indoorTemperature.replace(".", this.config.decimalSymbol) + "&deg;" + degreeLabel;
large.appendChild(indoorTemperatureElem);
}

View File

@ -14,10 +14,11 @@ Module.register("helloworld",{
text: "Hello World!"
},
// Override dom generator.
getDom: function() {
var wrapper = document.createElement("div");
wrapper.innerHTML = this.config.text;
return wrapper;
getTemplate: function () {
return "helloworld.njk"
},
getTemplateData: function () {
return this.config
}
});

View File

@ -0,0 +1,5 @@
<!--
Use ` | safe` to allow html tages within the text string.
https://mozilla.github.io/nunjucks/templating.html#autoescaping
-->
<div>{{text | safe}}</div>

View File

@ -57,25 +57,28 @@ The third party [MMM-Gestures](https://github.com/thobach/MMM-Gestures) module s
The following properties can be configured:
| Option | Description
| ----------------- | -----------
| `feeds` | An array of feed urls that will be used as source. <br> More info about this object can be found below. <br> **Default value:** `[{ title: "New York Times", url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml", encoding: "UTF-8" }]`
| `showSourceTitle` | Display the title of the source. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showPublishDate` | Display the publish date of an headline. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showDescription` | Display the description of an item. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `wrapTitle` | Wrap the title of the item to multiple lines. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `wrapDescription` | Wrap the description of the item to multiple lines. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `hideLoading` | Hide module instead of showing LOADING status. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `reloadInterval` | How often does the content needs to be fetched? (Milliseconds) <br><br> **Possible values:** `1000` - `86400000` <br> **Default value:** `300000` (5 minutes)
| `updateInterval` | How often do you want to display a new headline? (Milliseconds) <br><br> **Possible values:**`1000` - `60000` <br> **Default value:** `10000` (10 seconds)
| `animationSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `2500` (2.5 seconds)
| `maxNewsItems` | Total amount of news items to cycle through. (0 for unlimited) <br><br> **Possible values:**`0` - `...` <br> **Default value:** `0`
| `ignoreOldItems` | Ignore news items that are outdated. <br><br> **Possible values:**`true` or `false <br> **Default value:** `false`
| `ignoreOlderThan` | How old should news items be before they are considered outdated? (Milliseconds) <br><br> **Possible values:**`1` - `...` <br> **Default value:** `86400000` (1 day)
| `removeStartTags` | Some newsfeeds feature tags at the **beginning** of their titles or descriptions, such as _[VIDEO]_. This setting allows for the removal of specified tags from the beginning of an item's description and/or title. <br><br> **Possible values:**`'title'`, `'description'`, `'both'`
| `startTags` | List the tags you would like to have removed at the beginning of the feed item <br><br> **Possible values:** `['TAG']` or `['TAG1','TAG2',...]`
| `removeEndTags` | Remove specified tags from the **end** of an item's description and/or title. <br><br> **Possible values:**`'title'`, `'description'`, `'both'`
| `endTags` | List the tags you would like to have removed at the end of the feed item <br><br> **Possible values:** `['TAG']` or `['TAG1','TAG2',...]`
| Option | Description
| ------------------ | -----------
| `feeds` | An array of feed urls that will be used as source. <br> More info about this object can be found below. <br> **Default value:** `[{ title: "New York Times", url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml", encoding: "UTF-8" }]`<br>You can add `reloadInterval` option to set particular reloadInterval to a feed.
| `showSourceTitle` | Display the title of the source. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showPublishDate` | Display the publish date of an headline. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showDescription` | Display the description of an item. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `wrapTitle` | Wrap the title of the item to multiple lines. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `wrapDescription` | Wrap the description of the item to multiple lines. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `truncDescription` | Truncate description? <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `lengthDescription`| How many characters to be displayed for a truncated description? <br><br> **Possible values:** `1` - `500` <br> **Default value:** `400`
| `hideLoading` | Hide module instead of showing LOADING status. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `reloadInterval` | How often does the content needs to be fetched? (Milliseconds) <br><br> **Possible values:** `1000` - `86400000` <br> **Default value:** `300000` (5 minutes)
| `updateInterval` | How often do you want to display a new headline? (Milliseconds) <br><br> **Possible values:**`1000` - `60000` <br> **Default value:** `10000` (10 seconds)
| `animationSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `2500` (2.5 seconds)
| `maxNewsItems` | Total amount of news items to cycle through. (0 for unlimited) <br><br> **Possible values:**`0` - `...` <br> **Default value:** `0`
| `ignoreOldItems` | Ignore news items that are outdated. <br><br> **Possible values:**`true` or `false <br> **Default value:** `false`
| `ignoreOlderThan` | How old should news items be before they are considered outdated? (Milliseconds) <br><br> **Possible values:**`1` - `...` <br> **Default value:** `86400000` (1 day)
| `removeStartTags` | Some newsfeeds feature tags at the **beginning** of their titles or descriptions, such as _[VIDEO]_. This setting allows for the removal of specified tags from the beginning of an item's description and/or title. <br><br> **Possible values:**`'title'`, `'description'`, `'both'`
| `startTags` | List the tags you would like to have removed at the beginning of the feed item <br><br> **Possible values:** `['TAG']` or `['TAG1','TAG2',...]`
| `removeEndTags` | Remove specified tags from the **end** of an item's description and/or title. <br><br> **Possible values:**`'title'`, `'description'`, `'both'`
| `endTags` | List the tags you would like to have removed at the end of the feed item <br><br> **Possible values:** `['TAG']` or `['TAG1','TAG2',...]`
| `prohibitedWords` | Remove news feed item if one of these words is found anywhere in the title (case insensitive and greedy matching) <br><br> **Possible values:** `['word']` or `['word1','word2',...]`
The `feeds` property contains an array with multiple objects. These objects have the following properties:

View File

@ -51,7 +51,7 @@ var Fetcher = function(url, reloadInterval, encoding) {
if (title && pubdate) {
var regex = /(<([^>]+)>)/ig;
description = description.replace(regex, "");
description = description.toString().replace(regex, "");
items.push({
title: title,
@ -61,17 +61,16 @@ var Fetcher = function(url, reloadInterval, encoding) {
});
} else {
// console.log("Can't parse feed item:");
// console.log(item);
// console.log('Title: ' + title);
// console.log('Description: ' + description);
// console.log('Pubdate: ' + pubdate);
console.log("Can't parse feed item:");
console.log(item);
console.log("Title: " + title);
console.log("Description: " + description);
console.log("Pubdate: " + pubdate);
}
});
parser.on("end", function() {
parser.on("end", function() {
//console.log("end parsing - " + url);
self.broadcastItems();
scheduleTimer();
});
@ -83,7 +82,9 @@ var Fetcher = function(url, reloadInterval, encoding) {
nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
headers = {"User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)"}
headers = {"User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)",
"Cache-Control": "max-age=0, no-cache, no-store, must-revalidate",
"Pragma": "no-cache"}
request({uri: url, encoding: null, headers: headers})
.on("error", function(error) {

View File

@ -23,8 +23,10 @@ Module.register("newsfeed",{
showDescription: false,
wrapTitle: true,
wrapDescription: true,
truncDescription: true,
lengthDescription: 400,
hideLoading: false,
reloadInterval: 5 * 60 * 1000, // every 5 minutes
reloadInterval: 5 * 60 * 1000, // every 5 minutes
updateInterval: 10 * 1000,
animationSpeed: 2.5 * 1000,
maxNewsItems: 0, // 0 for unlimited
@ -33,8 +35,8 @@ Module.register("newsfeed",{
removeStartTags: "",
removeEndTags: "",
startTags: [],
endTags: []
endTags: [],
prohibitedWords: []
},
// Define required scripts.
@ -168,7 +170,9 @@ Module.register("newsfeed",{
if (this.config.showDescription) {
var description = document.createElement("div");
description.className = "small light" + (!this.config.wrapDescription ? " no-wrap" : "");
description.innerHTML = this.newsItems[this.activeItem].description;
var txtDesc = this.newsItems[this.activeItem].description;
//Log.info('txtDesc.length = ' + txtDesc.length + " - " + this.config.lengthDescription);
description.innerHTML = (this.config.truncDescription ? (txtDesc.length > this.config.lengthDescription ? txtDesc.substring(0, this.config.lengthDescription) + "..." : txtDesc) : txtDesc);
wrapper.appendChild(description);
}
@ -241,6 +245,18 @@ Module.register("newsfeed",{
if(this.config.maxNewsItems > 0) {
newsItems = newsItems.slice(0, this.config.maxNewsItems);
}
if(this.config.prohibitedWords.length > 0) {
newsItems = newsItems.filter(function(value){
for (var i=0; i < this.config.prohibitedWords.length; i++) {
if (value["title"].toLowerCase().indexOf(this.config.prohibitedWords[i].toLowerCase()) > -1) {
return false;
}
}
return true;
}, this);
}
this.newsItems = newsItems;
},

View File

@ -36,7 +36,7 @@ module.exports = NodeHelper.create({
var url = feed.url || "";
var encoding = feed.encoding || "UTF-8";
var reloadInterval = config.reloadInterval || 5 * 60 * 1000;
var reloadInterval = feed.reloadInterval || config.reloadInterval || 5 * 60 * 1000;
if (!validUrl.isUri(url)) {
self.sendSocketNotification("INCORRECT_URL", url);

View File

@ -64,7 +64,10 @@ module.exports = NodeHelper.create({
sg.git.fetch().status(function(err, data) {
data.module = sg.module;
if (!err) {
self.sendSocketNotification("STATUS", data);
sg.git.log({"-1": null}, function(err, data2) {
data.hash = data2.latest.hash;
self.sendSocketNotification("STATUS", data);
});
}
});
});

View File

@ -34,6 +34,17 @@ Module.register("updatenotification", {
}
},
diffLink: function(text) {
var localRef = this.status.hash;
var remoteRef = this.status.tracking.replace(/.*\//, "");
return "<a href=\"https://github.com/MichMich/MagicMirror/compare/"+localRef+"..."+remoteRef+"\" "+
"class=\"xsmall dimmed\" "+
"style=\"text-decoration: none;\" "+
"target=\"_blank\" >" +
text +
"</a>";
},
// Override dom generator.
getDom: function () {
var wrapper = document.createElement("div");
@ -47,9 +58,14 @@ Module.register("updatenotification", {
icon.innerHTML = "&nbsp;";
message.appendChild(icon);
var subtextHtml = this.translate("UPDATE_INFO")
.replace("COMMIT_COUNT", this.status.behind + " " + ((this.status.behind == 1) ? "commit" : "commits"))
.replace("BRANCH_NAME", this.status.current);
var text = document.createElement("span");
if (this.status.module == "default") {
text.innerHTML = this.translate("UPDATE_NOTIFICATION");
subtextHtml = this.diffLink(subtextHtml);
} else {
text.innerHTML = this.translate("UPDATE_NOTIFICATION_MODULE").replace("MODULE_NAME", this.status.module);
}
@ -58,9 +74,7 @@ Module.register("updatenotification", {
wrapper.appendChild(message);
var subtext = document.createElement("div");
subtext.innerHTML = this.translate("UPDATE_INFO")
.replace("COMMIT_COUNT", this.status.behind + " " + ((this.status.behind == 1) ? "commit" : "commits"))
.replace("BRANCH_NAME", this.status.current);
subtext.innerHTML = subtextHtml;
subtext.className = "xsmall dimmed";
wrapper.appendChild(subtext);
}

View File

@ -37,6 +37,7 @@ The following properties can be configured:
| `updateInterval` | How often does the content needs to be fetched? (Milliseconds) <br><br> **Possible values:** `1000` - `86400000` <br> **Default value:** `600000` (10 minutes)
| `animationSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `1000` (1 second)
| `lang` | The language of the days. <br><br> **Possible values:** `en`, `nl`, `ru`, etc ... <br> **Default value:** uses value of _config.language_
| `decimalSymbol` | The decimal symbol to use.<br><br> **Possible values:** `.`, `,` or any other symbol.<br> **Default value:** `.`
| `fade` | Fade the future events to black. (Gradient) <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `fadePoint` | Where to start fade? <br><br> **Possible values:** `0` (top of the list) - `1` (bottom of list) <br> **Default value:** `0.25`
| `initialLoadDelay` | The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds) <br><br> **Possible values:** `1000` - `5000` <br> **Default value:** `2500` (2.5 seconds delay. This delay is used to keep the OpenWeather API happy.)

View File

@ -21,6 +21,7 @@ Module.register("weatherforecast",{
animationSpeed: 1000,
timeFormat: config.timeFormat,
lang: config.language,
decimalSymbol: ".",
fade: true,
fadePoint: 0.25, // Start on 1/4th of the list.
colored: false,
@ -30,7 +31,7 @@ Module.register("weatherforecast",{
retryDelay: 2500,
apiVersion: "2.5",
apiBase: "http://api.openweathermap.org/data/",
apiBase: "https://api.openweathermap.org/data/",
forecastEndpoint: "forecast/daily",
appendLocationNameToHeader: true,
@ -155,13 +156,17 @@ Module.register("weatherforecast",{
}
}
if (this.config.decimalSymbol === "" || this.config.decimalSymbol === " ") {
this.config.decimalSymbol = ".";
}
var maxTempCell = document.createElement("td");
maxTempCell.innerHTML = forecast.maxTemp + degreeLabel;
maxTempCell.innerHTML = forecast.maxTemp.replace(".", this.config.decimalSymbol) + degreeLabel;
maxTempCell.className = "align-right bright max-temp";
row.appendChild(maxTempCell);
var minTempCell = document.createElement("td");
minTempCell.innerHTML = forecast.minTemp + degreeLabel;
minTempCell.innerHTML = forecast.minTemp.replace(".", this.config.decimalSymbol) + degreeLabel;
minTempCell.className = "align-right min-temp";
row.appendChild(minTempCell);

View File

@ -23,6 +23,16 @@ NodeHelper = Class.extend({
console.log("Starting module helper: " + this.name);
},
/* stop()
* Called when the MagicMirror server receives a `SIGINT`
* Close any open connections, stop any sub-processes and
* gracefully exit the module.
*
*/
stop: function() {
console.log("Stopping module helper: " + this.name);
},
/* socketNotificationReceived(notification, payload)
* This method is called when a socket notification arrives.
*

6367
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "magicmirror",
"version": "2.1.3",
"version": "2.2.0",
"description": "The open source modular smart mirror platform.",
"main": "js/electron.js",
"scripts": {
@ -33,39 +33,39 @@
},
"homepage": "https://magicmirror.builders",
"devDependencies": {
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"current-week-number": "^1.0.7",
"grunt": "latest",
"grunt-eslint": "latest",
"grunt-jsonlint": "latest",
"grunt-markdownlint": "^1.0.39",
"grunt-markdownlint": "^1.0.43",
"grunt-stylelint": "latest",
"grunt-yamllint": "latest",
"http-auth": "^3.1.3",
"jshint": "^2.9.4",
"mocha": "^3.4.2",
"http-auth": "^3.2.3",
"jshint": "^2.9.5",
"mocha": "^4.1.0",
"mocha-each": "^1.1.0",
"spectron": "3.6.x",
"stylelint": "^8.0.0",
"spectron": "3.7.x",
"stylelint": "^8.4.0",
"stylelint-config-standard": "latest",
"time-grunt": "latest"
},
"dependencies": {
"body-parser": "^1.17.2",
"body-parser": "^1.18.2",
"colors": "^1.1.2",
"electron": "^1.6.10",
"express": "^4.15.3",
"electron": "1.4.15",
"express": "^4.16.2",
"express-ipfilter": "0.3.1",
"feedme": "latest",
"helmet": "^3.6.1",
"helmet": "^3.9.0",
"iconv-lite": "latest",
"mocha-logger": "^1.0.5",
"moment": "latest",
"request": "^2.81.0",
"rrule-alt": "^2.2.5",
"simple-git": "^1.73.0",
"socket.io": "^2.0.2",
"request": "^2.83.0",
"rrule-alt": "^2.2.7",
"simple-git": "^1.85.0",
"socket.io": "^2.0.4",
"valid-url": "latest",
"walk": "latest"
}

View File

@ -1,4 +1,4 @@
if [ -z "$DISPLAY" ]; then #If not set DISPLAY is SSH remote or tty
export DISPLAY=:0 # Set by defaul display
export DISPLAY=:0 # Set by default display
fi
electron js/electron.js $1

View File

@ -54,7 +54,7 @@ fs.readFile(configFileName, "utf-8", function (err, data) {
v.JSHINT(data); // Parser by jshint
if (v.JSHINT.errors.length == 0) {
console.log("Your configuration file don't containt syntax error :)");
console.log("Your configuration file doesn't contain syntax errors :)");
return true;
} else {
errors = v.JSHINT.data().errors;

32
translations/bg.json Normal file
View File

@ -0,0 +1,32 @@
{
"LOADING": "Зареждане &hellip;",
"TODAY": "Днес",
"TOMORROW": "Утре",
"DAYAFTERTOMORROW": "Вдругиден",
"RUNNING": "Свършва на",
"EMPTY": "Няма предстоящи събития.",
"WEEK": "Седмица {weekNumber}",
"N": "С",
"NNE": "ССИ",
"NE": "СИ",
"ENE": "ИСИ",
"E": "И",
"ESE": "ИЮИ",
"SE": "ЮИ",
"SSE": "ЮЮИ",
"S": "Ю",
"SSW": "ЮЮЗ",
"SW": "ЮЗ",
"WSW": "ЗЮЗ",
"W": "З",
"WNW": "ЗСЗ",
"NW": "СЗ",
"NNW": "ССЗ",
"UPDATE_NOTIFICATION": "Налична актуализация за MagicMirror².",
"UPDATE_NOTIFICATION_MODULE": "Налична актуализация за MODULE_NAME модул.",
"UPDATE_INFO": "Текущата инсталация е изостанала с COMMIT_COUNT къмита на клон BRANCH_NAME."
}

32
translations/ca.json Normal file
View File

@ -0,0 +1,32 @@
{
"LOADING": "Carregant &hellip;",
"TODAY": "Avui",
"TOMORROW": "Demà",
"DAYAFTERTOMORROW": "Demà passat",
"RUNNING": "Acaba en",
"EMPTY": "No hi ha esdeveniments programats.",
"WEEK": "Setmana",
"N": "N",
"NNE": "NNE",
"NE": "NE",
"ENE": "ENE",
"E": "E",
"ESE": "ESE",
"SE": "SE",
"SSE": "SSE",
"S": "S",
"SSW": "SSO",
"SW": "SO",
"WSW": "OSO",
"W": "O",
"WNW": "ONO",
"NW": "NO",
"NNW": "NNO",
"UPDATE_NOTIFICATION": "MagicMirror² actualizació disponible.",
"UPDATE_NOTIFICATION_MODULE": "Disponible una actualizació per al mòdul MODULE_NAME.",
"UPDATE_INFO": "La teva instal·lació actual està COMMIT_COUNT canvis darrere de la branca BRANCH_NAME."
}

32
translations/cs.json Normal file
View File

@ -0,0 +1,32 @@
{
"LOADING": "Načítání &hellip;",
"TODAY": "Dnes",
"TOMORROW": "Zítra",
"DAYAFTERTOMORROW": "Pozítří",
"RUNNING": "Končí za",
"EMPTY": "Žádné nadcházející události.",
"WEEK": "{weekNumber}. týden",
"N": "S",
"NNE": "SSV",
"NE": "SV",
"ENE": "VSV",
"E": "V",
"ESE": "VJV",
"SE": "JV",
"SSE": "JJV",
"S": "J",
"SSW": "JJZ",
"SW": "JZ",
"WSW": "ZJZ",
"W": "Z",
"WNW": "ZSZ",
"NW": "SZ",
"NNW": "SSZ",
"UPDATE_NOTIFICATION": "Dostupná aktualizace pro MagicMirror².",
"UPDATE_NOTIFICATION_MODULE": "Dostupná aktualizace pro modul MODULE_NAME.",
"UPDATE_INFO": "Současná instalace je na větvi BRANCH_NAME pozadu o COMMIT_COUNT."
}

View File

@ -7,7 +7,7 @@
"RUNNING": "Gorffen mewn",
"EMPTY": "Dim digwyddiadau.",
"WEEK": "Wythnos",
"WEEK": "Wythnos {weekNumber}",
"N": "Go",
"NNE": "GoGoDw",

View File

@ -7,7 +7,7 @@
"RUNNING": "noch",
"EMPTY": "Keine Termine.",
"WEEK": "Woche",
"WEEK": "{weekNumber}. Kalenderwoche",
"N": "N",
"NNE": "NNO",

View File

@ -7,7 +7,7 @@
"RUNNING": "Ends in",
"EMPTY": "No upcoming events.",
"WEEK": "Week",
"WEEK": "Week {weekNumber}",
"N": "N",
"NNE": "NNE",

View File

@ -7,7 +7,7 @@
"RUNNING": "Termina en",
"EMPTY": "No hay eventos programados.",
"WEEK": "Semana",
"WEEK": "Semana {weekNumber}",
"N": "N",
"NNE": "NNE",

View File

@ -7,7 +7,7 @@
"RUNNING": "Se termine dans",
"EMPTY": "Aucun RDV à venir.",
"WEEK": "Semaine",
"WEEK": "Semaine {weekNumber}",
"N": "N",
"NNE": "NNE",

View File

@ -7,24 +7,26 @@
"RUNNING": "Berakhir dalam",
"EMPTY": "Tidak ada agenda",
"N": "U",
"NNE": "UUT",
"NE": "NE",
"ENE": "TUT",
"E": "T",
"ESE": "TST",
"SE": "ST",
"SSE": "SST",
"S": "S",
"SSW": "SSB",
"SW": "SB",
"WSW": "BSB",
"W": "B",
"WNW": "BUB",
"NW": "UB",
"NNW": "UUB",
"WEEK": "Pekan",
"UPDATE_NOTIFICATION": "Update MagicMirror² tersedia.",
"UPDATE_NOTIFICATION_MODULE": "Update tersedia untuk modul MODULE_NAME.",
"N": "U",
"NNE": "UTL",
"NE": "TL",
"ENE": "TTL",
"E": "T",
"ESE": "TMg",
"SE": "TG",
"SSE": "SMg",
"S": "S",
"SSW": "SBD",
"SW": "BD",
"WSW": "BBD",
"W": "B",
"WNW": "BBL",
"NW": "BL",
"NNW": "UBL",
"UPDATE_NOTIFICATION": "Memperbarui MagicMirror² tersedia.",
"UPDATE_NOTIFICATION_MODULE": "Memperbarui tersedia untuk modul MODULE_NAME.",
"UPDATE_INFO": "Instalasi saat ini tertinggal COMMIT_COUNT pada cabang BRANCH_NAME."
}

View File

@ -7,7 +7,7 @@
"RUNNING": "Slutter om",
"EMPTY": "Ingen kommende arrangementer.",
"WEEK": "Uke",
"WEEK": "Uke {weekNumber}",
"N": "N",
"NNE": "NNØ",

View File

@ -7,7 +7,7 @@
"RUNNING": "Koniec za",
"EMPTY": "Brak wydarzeń.",
"WEEK": "Tydzień",
"WEEK": "Tydzień {weekNumber}",
"N": "N",
"NNE": "NNE",

View File

@ -6,7 +6,7 @@
"RUNNING": "Termina em",
"EMPTY": "Sem eventos programados.",
"WEEK": "Semana",
"WEEK": "Semana {weekNumber}",
"N": "N",
"NNE": "NNE",

View File

@ -7,7 +7,7 @@
"RUNNING": "Se termină în",
"EMPTY": "Nici un eveniment.",
"WEEK": "Săptămâna",
"WEEK": "Săptămâna {weekNumber}",
"N": "N",
"NNE": "NNE",

View File

@ -7,7 +7,7 @@
"RUNNING": "Заканчивается через",
"EMPTY": "Нет предстоящих событий",
"WEEK": "Неделя",
"WEEK": "Неделя {weekNumber}",
"N": "С",
"NNE": "ССВ",

View File

@ -7,7 +7,7 @@
"RUNNING": "Slutar",
"EMPTY": "Inga kommande händelser.",
"WEEK": "Vecka",
"WEEK": "Vecka {weekNumber}",
"N": "N",
"NNE": "NNO",

View File

@ -13,6 +13,7 @@ var translations = {
"fr" : "translations/fr.json", // French
"fy" : "translations/fy.json", // Frysk
"es" : "translations/es.json", // Spanish
"ca" : "translations/ca.json", // Catalan
"nb" : "translations/nb.json", // Norsk bokmål
"nn" : "translations/nn.json", // Norsk nynorsk
"pt" : "translations/pt.json", // Português
@ -34,7 +35,9 @@ var translations = {
"et" : "translations/et.json", // Estonian
"kr" : "translations/kr.json", // Korean
"ro" : "translations/ro.json", // Romanian
"cy" : "translations/cy.json" // Welsh (Cymraeg)
"cy" : "translations/cy.json", // Welsh (Cymraeg)
"bg" : "translations/bg.json", // Bulgarian
"cs" : "translations/cs.json" // Czech
};
if (typeof module !== "undefined") {module.exports = translations;}

1434
vendor/package-lock.json generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
vendor/package.json vendored
View File

@ -13,6 +13,7 @@
"font-awesome": "^4.7.0",
"moment": "^2.17.1",
"moment-timezone": "^0.5.11",
"nunjucks": "^3.0.1",
"weathericons": "^2.1.0"
}
}

3
vendor/vendor.js vendored
View File

@ -12,7 +12,8 @@ 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-awesome.css": "node_modules/font-awesome/css/font-awesome.min.css",
"nunjucks.js": "node_modules/nunjucks/browser/nunjucks.min.js"
};
if (typeof module !== "undefined"){module.exports = vendor;}