Skip to content

Commit cf465a1

Browse files
authored
Merge pull request #394 from MichMich/develop
Release 2.0.4
2 parents 5d9d71d + f311982 commit cf465a1

32 files changed

+7661
-516
lines changed

.snyk

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
version: v1
1+
version: v1.5.2
2+
ignore: {}
3+
patch:
4+
'npm:minimatch:20160620':
5+
- snyk > recursive-readdir > minimatch:
6+
patched: '2016-07-30T14:02:31.280Z'
7+
'npm:negotiator:20160616':
8+
- socket.io > engine.io > accepts > negotiator:
9+
patched: '2016-07-30T14:02:31.280Z'
10+
'npm:ws:20160624':
11+
- socket.io > engine.io > ws:
12+
patched: '2016-07-30T14:02:31.280Z'
13+
- socket.io > socket.io-client > engine.io-client > ws:
14+
patched: '2016-07-30T14:02:31.280Z'

CHANGELOG.md

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

5+
## [2.0.4] - 2016-08-07
6+
7+
### Added
8+
- Brazilian Portuguese Translation.
9+
- Option to enable Kios mode.
10+
- Added ability to start the app with Dev Tools.
11+
- Added ability to turn off the date display in `clock.js` when in analog mode.
12+
- Greek Translation
13+
14+
### Fixed
15+
- Prevent `getModules()` selectors from returning duplicate entries.
16+
- Append endpoints of weather modules with `/` to retreive the correct data. (Issue [#337](https://github.com/MichMich/MagicMirror/issues/337))
17+
- Corrected grammer in `module.js` from 'suspend' to 'suspended'.
18+
- Fixed openweathermap.org URL in config sample.
19+
- Prevent currentweather module from crashing when received data object is incorrect.
20+
- Fix issue where translation loading prevented the UI start-up when the language was set to 'en'. (Issue [#388](https://github.com/MichMich/MagicMirror/issues/388))
21+
22+
### Updated
23+
- Updated package.json to fix possible vulnerabilities. (Using Snyk)
24+
- Updated weathericons
25+
- Updated default weatherforecast to work with the new icons.
26+
- More detailed error message in case config file couldn't be loaded.
27+
528
## [2.0.3] - 2016-07-12
629
### Added
730
- Add max newsitems parameter to the newsfeed module.
@@ -10,8 +33,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1033
- Add an analog clock in addition to the digital one.
1134

1235
### Fixed
13-
- Edit Alert Module to display title & message if they are provided in the notification (Issue #300)
14-
- Removed 'null' reference from updateModuleContent(). This fixes recent Edge and Internet Explorer browser displays (Issue #319)
36+
- Edit Alert Module to display title & message if they are provided in the notification (Issue [#300](https://github.com/MichMich/MagicMirror/issues/300))
37+
- Removed 'null' reference from updateModuleContent(). This fixes recent Edge and Internet Explorer browser displays (Issue [#319](https://github.com/MichMich/MagicMirror/issues/319))
1538

1639
### Changed
1740
- Added default string to calendar titleReplace.

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<a href="https://snyk.io/test/github/MichMich/MagicMirror"><img src="https://snyk.io/test/github/MichMich/MagicMirror/badge.svg" alt="Known Vulnerabilities" data-canonical-src="https://snyk.io/test/github/MichMich/MagicMirror" style="max-width:100%;"></a>
1010
</p>
1111

12-
**MagicMirror²** is an open source modular smart mirror platform. With a growing list of installable modules, the **MagicMirror²** allows you to convert your hallway or bathroom mirror into your personal assistant. **MagicMirror²** is built by the creator of [the original MagicMirror](http://michaelteeuw.nl/tagged/magicmirror) with the incredible help of a [growing community of contributors](https://github.com/MichMich/MagicMirror/graphs/contributors).
12+
**MagicMirror²** is an open source modular smart mirror platform. With a growing list of installable modules, the **MagicMirror²** allows you to convert your hallway or bathroom mirror into your personal assistant. **MagicMirror²** is built by the creator of [the original MagicMirror](http://michaelteeuw.nl/tagged/magicmirror) with the incredible help of a [growing community of contributors](https://github.com/MichMich/MagicMirror/graphs/contributors).
1313

1414
MagicMirror² focuses on a modular plugin system and uses [Electron](http://electron.atom.io/) as an application wrapper. So no more web server or browser installs necessary!
1515

@@ -22,7 +22,7 @@ MagicMirror² focuses on a modular plugin system and uses [Electron](http://elec
2222
- [community](#community)
2323
- [Contributing Guidelines](#contributing-guidelines)
2424

25-
## Usage
25+
## Usage
2626

2727
#### Raspberry Pi Support
2828
Electron, the app wrapper around MagicMirror², only supports the Raspberry Pi 2 & 3. The Raspberry Pi 1 is currently **not** supported. If you want to run this on a Raspberry Pi 1, use the [server only](#server-only) feature and setup a fullscreen browser yourself.
@@ -43,6 +43,8 @@ curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installer
4343

4444
**Important:** `npm start` does **not** work via SSH, use `DISPLAY=:0 nohup npm start &` instead. This starts the mirror on the remote display.
4545

46+
**Note:** if you want to debug on Raspberry Pi you can use `npm start dev` which will start the MagicMirror app with Dev Tools enabled.
47+
4648
#### Server Only
4749

4850
In some cases, you want to start the application without an actual app window. In this case, execute the following command from the MagicMirror folder: `node serveronly`. This will start the server, after which you can open the application in your browser of choice.
@@ -59,9 +61,9 @@ If you want to update your MagicMirror² to the latest version, use your termina
5961

6062
````
6163
git pull
62-
````
64+
````
6365

64-
If you changed nothing more than the config or the modules, this should work without any problems.
66+
If you changed nothing more than the config or the modules, this should work without any problems.
6567
Type `git status` to see your changes, if there are any, you can reset them with `git reset --hard`. After that, git pull should be possible.
6668

6769
## Configuration
@@ -75,6 +77,7 @@ The following properties can be configured:
7577
| **Option** | **Description** |
7678
| --- | --- |
7779
| `port` | The port on which the MagicMirror² server will run on. The default value is `8080`. |
80+
| `kioskmode` | This allows MagicMirror² to run in Kiosk Mode. It protects from other programs popping on top of your screen. The default value is `false`|
7881
| `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`. |
7982
| `timeFormat` | The form of time notation that will be used. Possible values are `12` or `24`. The default is `24`. |
8083
| `units` | The units that will be used in the default weather modules. Possible values are `metric` or `imperial`. The default is `metric`. |
@@ -108,7 +111,7 @@ For more available modules, check out out the wiki page: [MagicMirror² Modules]
108111
## Known issues
109112

110113
- Electron seems to have some issues on certain Raspberry Pi 2's. See [#145](https://github.com/MichMich/MagicMirror/issues/145).
111-
- MagicMirror² (Electron) sometimes quits without an error after an extended period of use. See [#150](https://github.com/MichMich/MagicMirror/issues/150).
114+
- MagicMirror² (Electron) sometimes quits without an error after an extended period of use. See [#150](https://github.com/MichMich/MagicMirror/issues/150).
112115

113116
## Community
114117

@@ -120,10 +123,9 @@ Contributions of all kinds are welcome, not only in the form of code but also wi
120123

121124
Please keep the following in mind:
122125

123-
- **Bug Reports**: Make sure you're running the latest version. If the issue(s) still persist: please open a clearly documented issue with a clear title.
126+
- **Bug Reports**: Make sure you're running the latest version. If the issue(s) still persist: please open a clearly documented issue with a clear title.
124127
- **Minor Bug Fixes**: Please send a pull request with a clear explanation of the issue or a link to the issue it solves.
125128
- **Major Bug Fixes**: please discuss your approach in an GitHub issue before you start to alter a big part of the code.
126129
- **New Features**: please please discuss in a GitHub issue before you start to alter a big part of the code. Without discussion upfront, the pull request will not be accepted / merged.
127130

128-
Thanks for your help in making MagicMirror² better!
129-
131+
Thanks for your help in making MagicMirror² better!

config/config.js.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var config = {
4141
position: 'top_right',
4242
config: {
4343
location: 'New York',
44-
locationID: '', //ID from bulk.openweather.org/sample/
44+
locationID: '', //ID from http://www.openweathermap.org
4545
appid: 'YOUR_OPENWEATHER_API_KEY'
4646
}
4747
},
@@ -51,7 +51,7 @@ var config = {
5151
header: 'Weather Forecast',
5252
config: {
5353
location: 'New York',
54-
locationID: '5128581', //ID from bulk.openweather.org/sample/
54+
locationID: '5128581', //ID from http://www.openweathermap.org
5555
appid: 'YOUR_OPENWEATHER_API_KEY'
5656
}
5757
},

js/app.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,16 @@ var App = function() {
4141
var config = Object.assign(defaults, c);
4242
callback(config);
4343
} catch (e) {
44-
console.error("WARNING! Could not find config. Please create one.");
45-
callback(defaults);
44+
if (e.code == "ENOENT") {
45+
console.error("WARNING! Could not find config file. Please create one. Starting with default configuration.");
46+
callback(defaults);
47+
} else if (e instanceof ReferenceError || e instanceof SyntaxError) {
48+
console.error("WARNING! Could not validate config file. Please correct syntax errors. Starting with default configuration.");
49+
callback(defaults);
50+
} else {
51+
console.error("WARNING! Could not load config file. Starting with default configuration. Error found: " + e);
52+
callback(defaults);
53+
}
4654
}
4755
};
4856

js/defaults.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99

1010
var defaults = {
1111
port: 8080,
12+
kioskmode: false,
1213

1314
language: "en",
1415
timeFormat: 24,
1516
units: "metric",
16-
17+
1718
modules: [
1819
{
1920
module: "helloworld",

js/electron.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,20 @@ let mainWindow;
1717

1818
function createWindow() {
1919
// Create the browser window.
20-
mainWindow = new BrowserWindow({width: 800, height: 600, fullscreen: true, autoHideMenuBar: true, darkTheme: true, webPreferences: {nodeIntegration: false}});
20+
if (config.kioskmode) {
21+
mainWindow = new BrowserWindow({width: 800, height: 600, x: 0, y: 0, kiosk:true, darkTheme: true, webPreferences: {nodeIntegration: false}});
22+
} else {
23+
mainWindow = new BrowserWindow({width: 800, height: 600, x: 0, y: 0, fullscreen: true, autoHideMenuBar: true, darkTheme: true, webPreferences: {nodeIntegration: false}});
24+
}
2125

2226
// and load the index.html of the app.
2327
//mainWindow.loadURL('file://' + __dirname + '../../index.html');
2428
mainWindow.loadURL("http://localhost:" + config.port);
2529

26-
// Open the DevTools.
27-
//mainWindow.webContents.openDevTools();
30+
// Open the DevTools if run with "npm start dev"
31+
if(process.argv[2] == "dev"){
32+
mainWindow.webContents.openDevTools();
33+
}
2834

2935
// Emitted when the window is closed.
3036
mainWindow.on("closed", function() {

js/main.js

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* global Log, Loader, Module, config, defaults */
2+
/* jshint -W020 */
23

34
/* Magic Mirror
45
* Main System
@@ -225,24 +226,23 @@ var MM = (function() {
225226
* return array - Filtered collection of modules.
226227
*/
227228
var withClass = function(className) {
228-
var newModules = [];
229-
230229
var searchClasses = className;
231230
if (typeof className === "string") {
232231
searchClasses = className.split(" ");
233232
}
234233

235-
for (var m in modules) {
236-
var module = modules[m];
234+
var newModules = modules.filter(function(module) {
237235
var classes = module.data.classes.toLowerCase().split(" ");
238236

239237
for (var c in searchClasses) {
240238
var searchClass = searchClasses[c];
241239
if (classes.indexOf(searchClass.toLowerCase()) !== -1) {
242-
newModules.push(module);
240+
return true;
243241
}
244242
}
245-
}
243+
244+
return false;
245+
});
246246

247247
setSelectionMethodsForModules(newModules);
248248
return newModules;
@@ -256,28 +256,23 @@ var MM = (function() {
256256
* return array - Filtered collection of modules.
257257
*/
258258
var exceptWithClass = function(className) {
259-
var newModules = [];
260-
261259
var searchClasses = className;
262260
if (typeof className === "string") {
263261
searchClasses = className.split(" ");
264262
}
265263

266-
for (var m in modules) {
267-
var module = modules[m];
264+
var newModules = modules.filter(function(module) {
268265
var classes = module.data.classes.toLowerCase().split(" ");
269-
var foundClass = false;
266+
270267
for (var c in searchClasses) {
271268
var searchClass = searchClasses[c];
272269
if (classes.indexOf(searchClass.toLowerCase()) !== -1) {
273-
foundClass = true;
274-
break;
270+
return false;
275271
}
276272
}
277-
if (!foundClass) {
278-
newModules.push(module);
279-
}
280-
}
273+
274+
return true;
275+
});
281276

282277
setSelectionMethodsForModules(newModules);
283278
return newModules;
@@ -291,14 +286,9 @@ var MM = (function() {
291286
* return array - Filtered collection of modules.
292287
*/
293288
var exceptModule = function(module) {
294-
var newModules = [];
295-
296-
for (var m in modules) {
297-
var mod = modules[m];
298-
if (mod.identifier !== module.identifier) {
299-
newModules.push(mod);
300-
}
301-
}
289+
var newModules = modules.filter(function(mod) {
290+
return mod.identifier !== module.identifier;
291+
});
302292

303293
setSelectionMethodsForModules(newModules);
304294
return newModules;
@@ -310,10 +300,9 @@ var MM = (function() {
310300
* argument callback function - The function to execute with the module as an argument.
311301
*/
312302
var enumerate = function(callback) {
313-
for (var m in modules) {
314-
var module = modules[m];
303+
modules.map(function(module) {
315304
callback(module);
316-
}
305+
});
317306
};
318307

319308
if (typeof modules.withClass === "undefined") { Object.defineProperty(modules, "withClass", {value: withClass, enumerable: false}); }

js/module.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ var Module = Class.extend({
114114
* This method is called when a module is hidden.
115115
*/
116116
suspend: function() {
117-
Log.log(this.name + " is suspend.");
117+
Log.log(this.name + " is suspended.");
118118
},
119119

120120
/* resume()
@@ -247,7 +247,7 @@ var Module = Class.extend({
247247

248248
// If a translation file is set, load it and then also load the fallback translation file.
249249
// Otherwise only load the fallback translation file.
250-
if (translationFile !== undefined) {
250+
if (translationFile !== undefined && translationFile !== translationsFallbackFile) {
251251
Translator.load(self, translationFile, false, function() {
252252
Translator.load(self, translationsFallbackFile, true, callback);
253253
});

modules/default/clock/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,12 @@ The following properties can be configured:
101101
<br><b>Default value:</b> <code>bottom</code>
102102
</td>
103103
</tr>
104+
<tr>
105+
<td><code>analogShowDate</code></td>
106+
<td><strong>Specific to the analog clock.</strong> If the clock is used as a separate module and set to analog only, this configures whether a date is also displayed with the clock.<br>
107+
<br><b>Possible values:</b> <code>false</code>, <code>top</code>, or <code>bottom</code>
108+
<br><b>Default value:</b> <code>top</code>
109+
</td>
110+
</tr>
104111
</tbody>
105112
</table>

0 commit comments

Comments
 (0)