diff --git a/CHANGELOG.md b/CHANGELOG.md index 98906398..4c5fc3da 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,23 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Updated - updated raspberry.sh installer script to handle new platform issues, split node/npm, pm2, and screen saver changes +- improve handling for armv6l devices, where electron support has gone away, add optional serveronly config option --- ❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror² core. +## [2.10.0] - Unreleased (Develop Branch) + +*This release is scheduled to be released on 2020-01-01.* + +### Added +- Timestamps in log output + +### Updated + +### Fixed + ## [2.9.0] - 2019-10-01 ℹ️ **Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install`. If you are having issues running Electron, make sure your [Raspbian is up to date](https://www.raspberrypi.org/documentation/raspbian/updating.md). diff --git a/config/config.js.sample b/config/config.js.sample index 790ada34..0e5ff840 100644 --- a/config/config.js.sample +++ b/config/config.js.sample @@ -24,7 +24,12 @@ var config = { language: "en", timeFormat: 24, units: "metric", - + // serverOnly: true/false/"local" , + // local for armv6l processors, default + // starts serveronly and then starts chrome browser + // false, default for all NON-armv6l devices + // true, force serveronly mode, because you want to.. no UI on this device + modules: [ { module: "alert", diff --git a/js/app.js b/js/app.js index 78f0c847..25a004d9 100644 --- a/js/app.js +++ b/js/app.js @@ -11,6 +11,9 @@ var Utils = require(__dirname + "/utils.js"); var defaultModules = require(__dirname + "/../modules/default/defaultmodules.js"); var path = require("path"); +// add timestamps in front of log messages +require('console-stamp')(console, 'HH:MM:ss.l'); + // Get version number. global.version = JSON.parse(fs.readFileSync("package.json", "utf8")).version; console.log("Starting MagicMirror: v" + global.version); diff --git a/package-lock.json b/package-lock.json index 5c706deb..c8d18a4b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "magicmirror", - "version": "2.9.0", + "version": "2.10.0-develop", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1632,6 +1632,40 @@ "date-now": "^0.1.4" } }, + "console-stamp": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/console-stamp/-/console-stamp-0.2.9.tgz", + "integrity": "sha512-jtgd1Fx3Im+pWN54mF269ptunkzF5Lpct2LBTbtyNoK2A4XjcxLM+TQW+e+XE/bLwLQNGRqPqlxm9JMixFntRA==", + "requires": { + "chalk": "^1.1.1", + "dateformat": "^1.0.11", + "merge": "^1.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" + } + } + }, "content-disposition": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", @@ -5192,6 +5226,11 @@ "trim-newlines": "^1.0.0" } }, + "merge": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.1.tgz", + "integrity": "sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ==" + }, "merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", @@ -5648,9 +5687,9 @@ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "nwmatcher": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz", - "integrity": "sha512-IKdSTiDWCarf2JTS5e9e2+5tPZGdkRJ79XjYV0pzK8Q9BpsFyBq1RGKxzs7Q8UBushGw7m6TzVKz6fcY99iSWw==", + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.4.tgz", + "integrity": "sha512-3iuY4N5dhgMpCUrOVnuAdGrgxVqV2cJpM+XNccjR2DKOB1RUP0aA+wGXEiNziG/UKboFyGBIoKOaNlJxx8bciQ==", "dev": true }, "oauth-sign": { diff --git a/package.json b/package.json index 4685bbd0..5bf564dd 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "magicmirror", - "version": "2.9.0", + "version": "2.10.0-develop", "description": "The open source modular smart mirror platform.", "main": "js/electron.js", "scripts": { - "start": "sh run-start.sh", + "start": "./run-start.sh", "install": "cd vendor && npm install", "install-fonts": "cd fonts && npm install", "postinstall": "sh untrack-css.sh && sh installers/postinstall/postinstall.sh && npm run install-fonts", @@ -55,8 +55,12 @@ "stylelint-config-standard": "latest", "time-grunt": "latest" }, + "optionalDependencies": { + "electron": "^3.0.13" + }, "dependencies": { "colors": "^1.1.2", + "console-stamp": "^0.2.9", "electron": "^3.0.13", "express": "^4.16.2", "express-ipfilter": "^1.0.1", diff --git a/run-start.sh b/run-start.sh old mode 100644 new mode 100755 index bbfcf921..a6c07520 --- a/run-start.sh +++ b/run-start.sh @@ -1,7 +1,62 @@ - +#!/bin/bash + # use bash instead of sh ./untrack-css.sh if [ -z "$DISPLAY" ]; then #If not set DISPLAY is SSH remote or tty export DISPLAY=:0 # Set by default display fi -electron js/electron.js $1 +# get the processor architecture +arch=$(uname -m) +# got the config option, if any +serveronly=$(grep -i serveronly: config/config.js | awk '{print tolower($2)}' | tr -d ,\"\') +# set default if not defined in config +serveronly="${serveronly:=false}" +# check for xwindows running +xorg=$(pgrep Xorg) +# +# if the user requested serveronly OR +# electron support for armv6l has been dropped OR +# system is in text mode +# +if [ "$serveronly." != "false." -o "$arch" == "armv6l" -o "$xorg." == "." ]; then + + # if user explicitly configured to run server only (no ui local) + # OR there is no xwindows running, so no support for browser graphics + if [ "$serveronly." == "true." -o "$xorg." == "." ]; then + # start server mode, + node serveronly + else + # start the server in the background + # wait for server to be ready + # need bash for this + exec 3< <(node serveronly) + + # Read the output of server line by line until one line 'point your browser' + while read line; do + case "$line" in + *point\ your\ browser*) + echo $line + break + ;; + *) + echo $line + #sleep .25 + ;; + esac + done <&3 + + # Close the file descriptor + exec 3<&- + + # lets use chrome to display here now + # get the server port address from the ready message + port=$(echo $line | awk -F\: '{print $4}') + # start chromium + echo "Starting chromium browser now, have patience, it takes a minute" + chromium-browser -noerrdialogs -kiosk -start_maximized --disable-infobars --app=http://localhost:$port --ignore-certificate-errors-spki-list --ignore-ssl-errors --ignore-certificate-errors 2>/dev/null + exit + fi +else + # we can use electron directly + `electron js/electron.js $1`; +fi \ No newline at end of file