make electronOptions configurable, remove kioskmode from documentation

This commit is contained in:
Andreas 'count' Kotes 2016-12-10 17:02:54 +01:00 committed by Andreas Kotes
parent 78aa2b491c
commit 6a184b069b
4 changed files with 11 additions and 5 deletions

View File

@ -32,6 +32,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Added option `zoom` to scale the whole mirror display with a given factor. - Added option `zoom` to scale the whole mirror display with a given factor.
- Added option `roundTemp` for currentweather and weatherforecast modules to display temperatures rounded to nearest integer. - Added option `roundTemp` for currentweather and weatherforecast modules to display temperatures rounded to nearest integer.
- Added abilty set the classes option to compliments module for style and text size of compliments. - Added abilty set the classes option to compliments module for style and text size of compliments.
- Added ability to configure electronOptions
### Updated ### Updated
- Modified translations for Frysk. - Modified translations for Frysk.

View File

@ -78,12 +78,12 @@ The following properties can be configured:
| `port` | The port on which the MagicMirror² server will run on. The default value is `8080`. | | `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 `::` is IPv6 is available or `0.0.0.0` IPv4 run on. 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"]]`).| | `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"]]`).|
| `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`|
| `zoom` | This allows to scale the mirror contents with a given zoom factor. The default value is `1.0`| | `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`. | | `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`. |
| `timeFormat` | The form of time notation that will be used. Possible values are `12` or `24`. The default is `24`. | | `timeFormat` | The form of time notation that will be used. Possible values are `12` or `24`. The default is `24`. |
| `units` | The units that will be used in the default weather modules. Possible values are `metric` or `imperial`. The default is `metric`. | | `units` | The units that will be used in the default weather modules. Possible values are `metric` or `imperial`. The default is `metric`. |
| `modules` | An array of active modules. **The array must contain objects. See the next table below for more information.** | | `modules` | An array of active modules. **The array must contain objects. See the next table below for more information.** |
| `electronOptions` | An optional array of Electron (browser) options. This allows configuration of e.g. the browser screen size and position (defaults `.width = 800` & `.height = 600`). Kiosk mode can be enabled by setting `.kiosk = true`, `.autoHideMenuBar = false`, `.fullscreen = false`. More options can be found [here](https://github.com/electron/electron/blob/master/docs/api/browser-window.md). |
Module configuration: Module configuration:

View File

@ -10,6 +10,7 @@
var defaults = { var defaults = {
port: 8080, port: 8080,
kioskmode: false, kioskmode: false,
electronOptions: {},
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en", language: "en",

View File

@ -19,7 +19,7 @@ let mainWindow;
function createWindow() { function createWindow() {
var electronOptions = { var electronOptionsDefaults = {
width: 800, width: 800,
height: 600, height: 600,
x: 0, x: 0,
@ -31,13 +31,17 @@ function createWindow() {
} }
} }
// DEPRECATED: "kioskmode" backwards compatibility, to be removed
// settings these options directly instead provides cleaner interface
if (config.kioskmode) { if (config.kioskmode) {
electronOptions.kiosk = true; electronOptionsDefaults.kiosk = true;
} else { } else {
electronOptions.fullscreen = true; electronOptionsDefaults.fullscreen = true;
electronOptions.autoHideMenuBar = true; electronOptionsDefaults.autoHideMenuBar = true;
} }
var electronOptions = Object.assign({}, electronOptionsDefaults, config.electronOptions);
// Create the browser window. // Create the browser window.
mainWindow = new BrowserWindow(electronOptions); mainWindow = new BrowserWindow(electronOptions);