Skip to content

Commit b595cdd

Browse files
authored
Merge pull request #1850 from MichMich/develop
Version 2.10.0
2 parents 500147e + e64870c commit b595cdd

28 files changed

+3648
-2163
lines changed

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ Temporary Items
5959
.directory
6060
.Trash-*
6161

62-
# Various Magic Mirror ignoramuses and anti-ignoramuses.
63-
64-
# Don't ignore the node_helper core module.
65-
!/modules/node_helper
66-
!/modules/node_helper/**
67-
6862
# Ignore all modules except the default modules.
6963
/modules/**
7064
!/modules/default

.snyk

Lines changed: 0 additions & 14 deletions
This file was deleted.

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
dist: trusty
22
language: node_js
33
node_js:
4-
- "8"
4+
- "10"
5+
before_install:
6+
- npm i -g npm
57
before_script:
68
- yarn danger ci
79
- npm install grunt-cli -g
810
- "export DISPLAY=:99.0"
911
- "sh -e /etc/init.d/xvfb start"
1012
- sleep 5
1113
script:
12-
- grunt
13-
- npm run test:unit
1414
- npm run test:e2e
15+
- npm run test:unit
16+
- grunt
1517
after_script:
1618
- npm list
1719
cache:

CHANGELOG.md

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

6-
---
7-
86
❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror² core.
97

8+
## [2.10.0] - 2020-01-01
9+
10+
ℹ️ **Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install`.
11+
12+
### Added
13+
- Timestamps in log output.
14+
- Padding in dateheader mode of the calendar module.
15+
- New upgrade script to help users consume regular updates installers/upgrade-script.sh.
16+
- New script to help setup pm2, without install installers/fixuppm2.sh.
17+
18+
### Updated
19+
- Updated lower bound of `lodash` and `helmet` dependencies for security patches.
20+
- Updated compliments.js to handle newline in text, as textfields to not interpolate contents.
21+
- Updated raspberry.sh installer script to handle new platform issues, split node/npm, pm2, and screen saver changes.
22+
- Improve handling for armv6l devices, where electron support has gone away, add optional serveronly config option.
23+
- Improved run-start.sh to handle for serveronly mode, by choice, or when electron not available.
24+
- Only check for xwindows running if not on macOS.
25+
26+
### Fixed
27+
- Fixed issue in weatherforecast module where predicted amount of rain was not using the decimal symbol specified in config.js.
28+
- Module header now updates correctly, if a module need to dynamically show/hide its header based on a condition.
29+
- Fix handling of config.js for serverOnly mode commented out.
30+
- Fixed issue in calendar module where the debug script didn't work correctly with authentication
31+
- Fixed issue that some full day events were not correctly recognized as such
32+
- Display full day events lasting multiple days as happening today instead of some days ago if they are still ongoing
33+
1034
## [2.9.0] - 2019-10-01
1135

1236
ℹ️ **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).

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,19 @@ For more available modules, check out out the wiki page [MagicMirror² 3rd Party
177177

178178
If you want to update your MagicMirror² to the latest version, use your terminal to go to your Magic Mirror folder and type the following command:
179179

180-
```bash
181-
git pull && npm install
182180
```
181+
bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/upgrade-script.sh)"
182+
```
183+
This will do a test run
183184

184-
If you changed nothing more than the config or the modules, this should work without any problems.
185-
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.
186-
185+
If the test update looks good then run this command
186+
```
187+
bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/upgrade-script.sh)" apply
188+
```
189+
If there are changes you have made, they will be listed, and u will have the opportunity to save your work
187190

191+
The script will also update the dependencies of any active modules
192+
If there are update issues, please come to the forums for help
188193
## Community
189194

190195
The community around the MagicMirror² is constantly growing. We even have a [forum](https://forum.magicmirror.builders) now where you can share your ideas, ask questions, help others and get inspired by other builders. We would love to see you there!
@@ -222,7 +227,7 @@ A real Manifesto is still to be written. Till then, Michael's response on [one o
222227
>
223228
>Of course, a bundled version can be complimentary to the regular un-bundled version. And I'm sure a lot of (new) users will opt for the bundled version. But this means those users won't be motivated to take a peek under the hood. They will just remain 'users'. They won't become contributors, and worse: they won't be motivated to take their first steps in software development.
224229
>
225-
>And to be honest: motivating curious users to step out of their comfort zone and take those first steps is what drives me in this project. Therefor my ultimate goal is this project is to keep it as accessible as possible."
230+
>And to be honest: motivating curious users to step out of their comfort zone and take those first steps is what drives me in this project. Therefore my ultimate goal is this project is to keep it as accessible as possible."
226231
>
227232
> ~ Michael Teeuw
228233

config/config.js.sample

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ var config = {
2424
language: "en",
2525
timeFormat: 24,
2626
units: "metric",
27-
27+
// serverOnly: true/false/"local" ,
28+
// local for armv6l processors, default
29+
// starts serveronly and then starts chrome browser
30+
// false, default for all NON-armv6l devices
31+
// true, force serveronly mode, because you want to.. no UI on this device
32+
2833
modules: [
2934
{
3035
module: "alert",

css/custom.css

Lines changed: 0 additions & 14 deletions
This file was deleted.

installers/dumpactivemodules.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const config = require('../config/config.js');const fs=require('fs');
2+
for(let m of config.modules){
3+
if(!(m.disabled || false)){
4+
try {
5+
let f=fs.statSync(m.module);
6+
if(f.isDirectory()){
7+
f1=fs.statSync(m.module+'/package.json');
8+
if (f1.isFile()){
9+
console.log(m.module);
10+
}
11+
}
12+
}
13+
catch (ex) {}
14+
}
15+
}

installers/fixuppm2.sh

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
#!/bin/bash
2+
# Define the tested version of Node.js.
3+
NODE_TESTED="v10.1.0"
4+
NPM_TESTED="V6.0.0"
5+
USER=`whoami`
6+
PM2_FILE=pm2_MagicMirror.json
7+
mac=$(uname -s)
8+
if [ $mac == 'Darwin' ]; then
9+
cmd=greadlink
10+
else
11+
cmd=readlink
12+
fi
13+
14+
if [ -d ~/MagicMirror ]; then
15+
# put the log where the script is located
16+
logdir=$(dirname $($cmd -f "$0"))
17+
# if the script was execute from the web
18+
if [[ $logdir != *"MagicMirror/installers"* ]]; then
19+
# use the MagicMirror/installers folder
20+
cd ~/MagicMirror/installers >/dev/null
21+
logdir=$(pwd)
22+
cd - >/dev/null
23+
fi
24+
logfile=$logdir/pm2_setup.log
25+
echo the log will be saved in $logfile
26+
date +"pm2 setup starting - %a %b %e %H:%M:%S %Z %Y" >>$logfile
27+
echo system is $(uname -a) >> $logfile
28+
if [ "$mac" == "Darwin" ]; then
29+
echo the os is macOS $(sw_vers -productVersion) >> $logfile
30+
else
31+
echo the os is $(lsb_release -a 2>/dev/null) >> $logfile
32+
fi
33+
node_installed=$(which node)
34+
if [ "$node_installed." == "." ]; then
35+
# node not installed
36+
echo Installing node >>$logfile
37+
if [ $mac == 'Darwin' ]; then
38+
brew install node
39+
else
40+
NODE_STABLE_BRANCH="10.x"
41+
curl -sL https://deb.nodesource.com/setup_$NODE_STABLE_BRANCH | sudo -E bash -
42+
sudo apt-get install -y nodejs
43+
fi
44+
fi
45+
node_version=$(node -v)
46+
echo node version $node_version >>$logfile
47+
npm_installed=$(which npm)
48+
if [ "$npm_installed." == "." ]; then
49+
# npm not installed
50+
echo Installing npm >>$logfile
51+
if [ $mac != 'Darwin' ]; then
52+
sudo apt-get install -y npm
53+
fi
54+
fi
55+
# get latest
56+
echo force installing latest npm version via npm >>$logfile
57+
#sudo npm i -g npm
58+
npm_version=$(npm -v)
59+
echo npm version $npm_version >>$logfile
60+
# assume pm2 will be found on the path
61+
pm2cmd=pm2
62+
up=""
63+
if [ $mac == 'Darwin' ]; then
64+
up="--unsafe-perm"
65+
launchctl=launchctl
66+
launchctl_path=$(which $launchctl)
67+
`export PATH=$PATH:${launchctl_path%/$launchctl}`
68+
fi
69+
# check to see if already installed
70+
pm2_installed=$(which $pm2cmd)
71+
if [ "$pm2_installed." != "." ]; then
72+
# does it work?
73+
echo pm2 installed >> $logfile
74+
pm2_fails=$(pm2 list | grep -i -m 1 "App Name" | wc -l )
75+
if [ $pm2_fails != 1 ]; then
76+
# uninstall it
77+
echo pm2 installed, but does not work, uninstalling >> $logfile
78+
sudo npm uninstall $up -g pm2
79+
# force reinstall
80+
pm2_installed=
81+
fi
82+
fi
83+
# in not installed
84+
if [ "$pm2_installed." == "." ]; then
85+
# install it.
86+
echo pm2 not installed, installing >>$logfile
87+
result=$(sudo npm install $up -g pm2)
88+
# if this is a mac
89+
if [ $mac == 'Darwin' ]; then
90+
echo this is a mac, fixup for path >>$logfile
91+
# get the location of pm2 install
92+
# parse the npm install output to get the command
93+
pm2cmd=`echo $result | awk -F - '{print $1}' | tr -d '[:space:]'`
94+
c='/pm2'
95+
# get the path only
96+
echo ${pm2cmd%$c} >installers/pm2path
97+
fi
98+
fi
99+
# remove MagicMirror if defined
100+
$pm2cmd delete MagicMirror >/dev/null 2>&1
101+
cd ~/MagicMirror
102+
echo get the pm2 platform specific startup command >>$logfile
103+
# get the platform specific pm2 startup command
104+
v=$($pm2cmd startup | tail -n 1)
105+
if [ $mac != 'Darwin' ]; then
106+
# check to see if we can get the OS package name (Ubuntu)
107+
if [ $(which lsb_release| wc -l) >0 ]; then
108+
# fix command
109+
# if ubuntu 18.04, pm2 startup gets something wrong
110+
if [ $(lsb_release -r | grep -m1 18.04 | wc -l) > 0 ]; then
111+
v=$(echo $v | sed 's/\/bin/\/bin:\/bin/')
112+
fi
113+
fi
114+
fi
115+
echo startup command = $v >>$logfile
116+
# execute the command returned
117+
$v 2>&1 >>$logfile
118+
echo pm2 startup command done >>$logfile
119+
# is this is mac
120+
# need to fix pm2 startup, only on catalina
121+
if [ $mac == 'Darwin' ]; then
122+
if [ $(sw_vers -productVersion | head -c 6) == '10.15.' ]; then
123+
# only do if the faulty tag is present (pm2 may fix this, before the script is fixed)
124+
if [ $(grep -m 1 UserName /Users/$USER/Library/LaunchAgents/pm2.$USER.plist | wc -l) -eq 1 ]; then
125+
# copy the pm2 startup file config
126+
cp /Users/$USER/Library/LaunchAgents/pm2.$USER.plist .
127+
# edit out the UserName key/value strings
128+
sed -e '/UserName/{N;d;}' pm2.$USER.plist > pm2.$USER.plist.new
129+
# copy the file back
130+
sudo cp pm2.$USER.plist.new /Users/$USER/Library/LaunchAgents/pm2.$USER.plist
131+
fi
132+
fi
133+
fi
134+
135+
# if the user is no pi, we have to fixup the pm2 json file
136+
echo configure the pm2 config file for MagicMirror >>$logfile
137+
if [ "$USER" != "pi" ]; then
138+
echo the user is not pi >>$logfile
139+
# go to the installers folder`
140+
cd installers
141+
# edit the startup script for the right user
142+
echo change mm.sh >>$logfile
143+
if [ ! -e mm_temp.sh ]; then
144+
echo save copy of mm.sh >> $logfile
145+
cp mm.sh mm_temp.sh
146+
fi
147+
if [ $(grep pi mm_temp.sh | wc -l) -gt 0 ]; then
148+
echo change hard coded pi username >> $logfile
149+
sed 's/pi/'$USER'/g' mm_temp.sh >mm.sh
150+
else
151+
echo change relative home path to hard coded path >> $logfile
152+
hf=$(echo $HOME |sed 's/\//\\\//g')
153+
sed 's/\~/'$hf'/g' mm_temp.sh >mm.sh
154+
fi
155+
# edit the pms config file for the right user
156+
echo change $PM2_FILE >>$logfile
157+
sed 's/pi/'$USER'/g' $PM2_FILE > pm2_MagicMirror_new.json
158+
# make sure to use the updated file
159+
PM2_FILE=pm2_MagicMirror_new.json
160+
# if this is a mac
161+
if [ $mac == 'Darwin' ]; then
162+
# copy the path file to the system paths list
163+
sudo cp ./pm2path /etc/paths.d
164+
# change the name of the home path for mac
165+
sed 's/home/Users/g' $PM2_FILE > pm2_MagicMirror_new1.json
166+
# make sure to use the updated file
167+
PM2_FILE=pm2_MagicMirror_new1.json
168+
fi
169+
echo now using this config file $PM2_FILE >>$logfile
170+
# go back one cd level
171+
cd - >/dev/null
172+
fi
173+
echo start MagicMirror via pm2 now >>$logfile
174+
# tell pm2 to start the app defined in the config file
175+
$pm2cmd start $HOME/MagicMirror/installers/$PM2_FILE
176+
# tell pm2 to save that configuration, for start at boot
177+
echo save MagicMirror pm2 config now >>$logfile
178+
$pm2cmd save
179+
date +"pm2 setup completed - %a %b %e %H:%M:%S %Z %Y" >>$logfile
180+
else
181+
echo It appears MagicMirror has not been installed on this system
182+
echo please run the installer, "raspberry.sh" first
183+
fi

0 commit comments

Comments
 (0)