diff --git a/.gitignore b/.gitignore index 67feae54..1e17ef8b 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ Temporary Items # Ignore all modules except the default modules. /modules/** +!/modules/default !/modules/default/** !/modules/README.md** diff --git a/CHANGELOG.md b/CHANGELOG.md index b9551b79..09c1d13d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,27 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [2.1.1] - Unreleased + +**Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install` + +### Changed +- Installer: Use init config.js from config.js.sample. +- Switched out `rrule` package for `rrule-alt` in order to improve calendar issues. (Experimental: [#565](https://github.com/MichMich/MagicMirror/issues/565)) +- Make mouse events pass through the region fullscreen_above to modules below. + +### Added +- Add loaded function to modules, providing an async callback. +- Made default newsfeed module aware of gesture events from [MMM-Gestures](https://github.com/thobach/MMM-Gestures) +- Add use pm2 for manager process into Installer RaspberryPi script +- Russian Translation +- Afrikaans Translation + +### Fixed +- Update .gitignore to not ignore default modules folder. +- Remove white flash on boot up. +- Added `update` in Raspberry Pi installation script. + ## [2.1.0] - 2016-12-31 **Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install` @@ -118,7 +139,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Added reference to Italian Translation. -- Added the missing NE translation to all languages. [#334](https://github.com/MichMich/MagicMirror/issues/344) +- Added the missing NE translation to all languages. [#565](https://github.com/MichMich/MagicMirror/issues/344) - Added proper User-Agent string to calendar call. ### Changed diff --git a/LICENSE.md b/LICENSE.md index d4765af2..09ac7e6f 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,7 @@ The MIT License (MIT) ===================== -Copyright © 2016 Michael Teeuw +Copyright © 2016-2017 Michael Teeuw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/README.md b/README.md index 7c5286dd..126a1d7f 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ MagicMirror² focuses on a modular plugin system and uses [Electron](http://elec - [Configuration](#configuration) - [Modules](#modules) - [Known Issues](#known-issues) -- [community](#community) +- [Community](#community) - [Contributing Guidelines](#contributing-guidelines) ## Usage diff --git a/css/main.css b/css/main.css index 5e63e596..f1c07fa0 100644 --- a/css/main.css +++ b/css/main.css @@ -135,6 +135,11 @@ sup { left: -60px; right: -60px; bottom: -60px; + pointer-events: none; +} + +.region.fullscreen * { + pointer-events: auto; } .region.right { diff --git a/installers/mm.sh b/installers/mm.sh new file mode 100755 index 00000000..cc6c4bb3 --- /dev/null +++ b/installers/mm.sh @@ -0,0 +1,2 @@ +cd ~/MagicMirror +DISPLAY=:0 npm start diff --git a/installers/pm2_MagicMirror.json b/installers/pm2_MagicMirror.json new file mode 100644 index 00000000..55f8df31 --- /dev/null +++ b/installers/pm2_MagicMirror.json @@ -0,0 +1,7 @@ +{ + apps : [{ + name : "MagicMirror", + script : "/home/pi/MagicMirror/installer/mm.sh", + watch : ["/home/pi/MagicMirror/config/config.js"] + }] +} diff --git a/installers/raspberry.sh b/installers/raspberry.sh index cd995a1e..718f78b6 100644 --- a/installers/raspberry.sh +++ b/installers/raspberry.sh @@ -36,6 +36,10 @@ fi function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; } function command_exists () { type "$1" &> /dev/null ;} +# Update before first apt-get +echo -e "\e[96mUpdating packages ...\e[90m" +sudo apt-get update || echo -e "\e[91mUpdate failed, carrying on installation ...\e[90m" + # Installing helper tools echo -e "\e[96mInstalling helper tools ...\e[90m" sudo apt-get install curl wget git build-essential unzip || exit @@ -113,6 +117,9 @@ else exit; fi +# Use sample config for start MagicMirror +cp config/config.js.sample config/config.js + # Check if plymouth is installed (default with PIXEL desktop environment), then install custom splashscreen. echo -e "\e[96mCheck plymouth installation ...\e[0m" if command_exists plymouth; then @@ -141,6 +148,16 @@ else echo -e "\e[93mplymouth is not installed.\e[0m"; fi +# Use pm2 control like a service MagicMirror +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 +fi + echo " " echo -e "\e[92mWe're ready! Run \e[1m\e[97mDISPLAY=:0 npm start\e[0m\e[92m from the ~/MagicMirror directory to start your MagicMirror.\e[0m" echo " " diff --git a/js/app.js b/js/app.js index ba6cd1a9..91149906 100644 --- a/js/app.js +++ b/js/app.js @@ -66,7 +66,7 @@ var App = function() { * * argument module string - The name of the module (including subpath). */ - var loadModule = function(module) { + var loadModule = function(module, callback) { var elements = module.split("/"); var moduleName = elements[elements.length - 1]; @@ -103,6 +103,10 @@ var App = function() { m.setName(moduleName); m.setPath(path.resolve(moduleFolder)); nodeHelpers.push(m); + + m.loaded(callback); + } else { + callback(); } }; @@ -111,14 +115,24 @@ var App = function() { * * argument module string - The name of the module (including subpath). */ - var loadModules = function(modules) { + var loadModules = function(modules, callback) { console.log("Loading module helpers ..."); - for (var m in modules) { - loadModule(modules[m]); - } + var loadNextModule = function() { + if (modules.length > 0) { + var nextModule = modules[0]; + loadModule(nextModule, function() { + modules = modules.slice(1); + loadNextModule(); + }); + } else { + // All modules are loaded + console.log("All module helpers loaded."); + callback(); + } + }; - console.log("All module helpers loaded."); + loadNextModule(); }; /* cmpVersions(a,b) @@ -164,24 +178,24 @@ var App = function() { } } - loadModules(modules); + loadModules(modules, function() { + var server = new Server(config, function(app, io) { + console.log("Server started ..."); - var server = new Server(config, function(app, io) { - console.log("Server started ..."); + for (var h in nodeHelpers) { + var nodeHelper = nodeHelpers[h]; + nodeHelper.setExpressApp(app); + nodeHelper.setSocketIO(io); + nodeHelper.start(); + } - for (var h in nodeHelpers) { - var nodeHelper = nodeHelpers[h]; - nodeHelper.setExpressApp(app); - nodeHelper.setSocketIO(io); - nodeHelper.start(); - } + console.log("Sockets connected & modules started ..."); - console.log("Sockets connected & modules started ..."); - - if (typeof callback === "function") { - callback(config); - } + if (typeof callback === "function") { + callback(config); + } + }); }); }); }; diff --git a/js/electron.js b/js/electron.js index 173abe68..1f16092b 100644 --- a/js/electron.js +++ b/js/electron.js @@ -28,7 +28,8 @@ function createWindow() { webPreferences: { nodeIntegration: false, zoomFactor: config.zoom - } + }, + backgroundColor: "#000000" } // DEPRECATED: "kioskmode" backwards compatibility, to be removed diff --git a/modules/README.md b/modules/README.md index 42a31dfa..03664b15 100644 --- a/modules/README.md +++ b/modules/README.md @@ -96,6 +96,21 @@ requiresVersion: "2.1.0", ####`init()` This method is called when a module gets instantiated. In most cases you do not need to subclass this method. +####`loaded(callback)` + +*Introduced in version: 2.1.1.* + +This method is called when a module is loaded. Subsequent modules in the config are not yet loaded. The `callback` function MUST be called when the module is done loading. In most cases you do not need to subclass this method. + +**Example:** +````javascript +loaded: function(callback) { + this.finishLoading(); + Log.log(this.name + ' is loaded!'); + 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: diff --git a/modules/default/alert/translations/ru.json b/modules/default/alert/translations/ru.json new file mode 100644 index 00000000..ef7ee708 --- /dev/null +++ b/modules/default/alert/translations/ru.json @@ -0,0 +1,4 @@ +{ + "sysTitle": "MagicMirror Уведомление", + "welcome": "Добро пожаловать, старт был успешным!"" +} diff --git a/modules/default/calendar/vendor/ical.js/node-ical.js b/modules/default/calendar/vendor/ical.js/node-ical.js index 2f6ef3ef..e2c4a319 100644 --- a/modules/default/calendar/vendor/ical.js/node-ical.js +++ b/modules/default/calendar/vendor/ical.js/node-ical.js @@ -17,7 +17,7 @@ exports.parseFile = function(filename){ } -var rrule = require('rrule').RRule +var rrule = require('rrule-alt').RRule ical.objectHandlers['RRULE'] = function(val, params, curr, stack, line){ curr.rrule = line; diff --git a/modules/default/newsfeed/README.md b/modules/default/newsfeed/README.md index 58c7b9ae..8a0fec25 100644 --- a/modules/default/newsfeed/README.md +++ b/modules/default/newsfeed/README.md @@ -1,9 +1,10 @@ # Module: News Feed The `newsfeed ` module is one of the default modules of the MagicMirror. -This module displays news headlines based on an RSS feed. +This module displays news headlines based on an RSS feed. Scrolling through news headlines happens time-based (````updateInterval````), but can also be controlled by sending news feed specific notifications to the module. ## Using the module +### Configuration To use this module, add it to the modules array in the `config/config.js` file: ````javascript modules: [ @@ -30,6 +31,51 @@ modules: [ ] ```` +### Notifications +#### Interacting with the module +MagicMirror's [notification mechanism](https://github.com/MichMich/MagicMirror/tree/master/modules#thissendnotificationnotification-payload) allows to send notifications to the ````newsfeed```` module. The following notifications are supported: + +
Notification Identifier | +Description | +
---|---|
ARTICLE_NEXT |
+ Shows the next news title (hiding the summary or previously fully displayed article) | +
ARTICLE_PREVIOUS |
+ Shows the previous news title (hiding the summary or previously fully displayed article) | +
ARTICLE_MORE_DETAILS |
+ When received the *first time*, shows the corresponding description of the currently displayed news title. + 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````. |
+
ARTICLE_LESS_DETAILS |
+ Hides the summary or full news article and only displays the news title of the currently viewed news item. | +