Skip to content

Commit

Permalink
Merge pull request #1776 from MichMich/develop
Browse files Browse the repository at this point in the history
v2.9.0
  • Loading branch information
MichMich authored Oct 1, 2019
2 parents a31546b + d90de18 commit 500147e
Show file tree
Hide file tree
Showing 40 changed files with 3,136 additions and 2,028 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2017,
"ecmaFeatures": {
"globalReturn": true
}
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ coverage
.grunt
.lock-wscript
build/Release
node_modules
/node_modules/**/*
fonts/node_modules/**/*
vendor/node_modules/**/*
jspm_modules
.npm
.node_repl_history
Expand Down Expand Up @@ -81,3 +83,5 @@ Temporary Items
*.orig
*.rej
*.bak

!/tests/node_modules/**/*
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist: trusty
language: node_js
node_js:
- "8"
Expand Down
31 changes: 27 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@ This project adheres to [Semantic Versioning](http://semver.org/).

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

## [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).

### Added
- Spanish translation for "PRECIP".
- Adding a Malay (Malaysian) translation for MagicMirror².
- Add test check URLs of vendors 200 and 404 HTTP CODE.
- Add tests for new weather module and helper to stub ajax requests.

### Updated
- Updatenotification module: Display update notification for a limited (configurable) time.
- Enabled e2e/vendor_spec.js tests.
- The css/custom.css will be rename after the next release. We've add into `run-start.sh` a instruction by GIT to ignore with `--skip-worktree` and `rm --cached`. [#1540](https://github.com/MichMich/MagicMirror/issues/1540)
- Disable sending of notification CLOCK_SECOND when displaySeconds is false.

### Fixed
- Updatenotification module: Properly handle race conditions, prevent crash.
- Send `NEWS_FEED` notification also for the first news messages which are shown.
- Fixed issue where weather module would not refresh data after a network or API outage. [#1722](https://github.com/MichMich/MagicMirror/issues/1722)
- Fixed weatherforecast module not displaying rain amount on fallback endpoint.
- Notifications CLOCK_SECOND & CLOCK_MINUTE being from startup instead of matched against the clock and avoid drifting.

## [2.8.0] - 2019-07-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).
Expand All @@ -28,18 +51,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Automatically try to fix eslint errors by passing `--fix` option to it
- Added sunrise and sunset times to weathergov weather provider [#1705](https://github.com/MichMich/MagicMirror/issues/1705)
- Added "useLocationAsHeader" to display "location" in `config.js` as header when location name is not returned
- Added to `newsfeed.js`: in order to design the news article better with css, three more class-names were introduced: newsfeed-desc, newsfeed-desc, newsfeed-desc
- Added to `newsfeed.js`: in order to design the news article better with css, three more class-names were introduced: newsfeed-desc, newsfeed-desc, newsfeed-desc

### Updated
- English translation for "Feels" to "Feels like"
- Fixed the example calender url in `config.js.sample`
- Update `ical.js` to solve various calendar issues.
- Update weather city list url [#1676](https://github.com/MichMich/MagicMirror/issues/1676)
- Update weather city list url [#1676](https://github.com/MichMich/MagicMirror/issues/1676)
- Only update clock once per minute when seconds aren't shown

### Fixed
- Fixed uncaught exception, race condition on module update
- Fixed issue [#1696](https://github.com/MichMich/MagicMirror/issues/1696), some ical files start date to not parse to date type
- Fixed uncaught exception, race condition on module update
- Fixed issue [#1696](https://github.com/MichMich/MagicMirror/issues/1696), some ical files start date to not parse to date type
- Allowance HTML5 autoplay-policy (policy is changed from Chrome 66 updates)
- Handle SIGTERM messages
- Fixes sliceMultiDayEvents so it respects maximumNumberOfDays
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)
=====================

Copyright © 2016-2017 Michael Teeuw
Copyright © 2016-2019 Michael Teeuw

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
7 changes: 0 additions & 7 deletions installers/raspberry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,6 @@ if $NPM_INSTALL; then

echo -e "\e[96mInstalling npm ...\e[90m"

# Fetch the latest version of npm from the selected branch
# The NODE_STABLE_BRANCH variable will need to be manually adjusted when a new branch is released. (e.g. 7.x)
# Only tested (stable) versions are recommended as newer versions could break MagicMirror.

#NODE_STABLE_BRANCH="9.x"
#curl -sL https://deb.nodesource.com/setup_$NODE_STABLE_BRANCH | sudo -E bash -
#
sudo apt-get install -y npm
echo -e "\e[92mnpm installation Done!\e[0m"
fi
Expand Down
2 changes: 1 addition & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ var MM = (function() {
*/
var updateModuleContent = function(module, newHeader, newContent) {
var moduleWrapper = document.getElementById(module.identifier);
if (moduleWrapper === null) return;
if (moduleWrapper === null) {return;}
var headerWrapper = moduleWrapper.getElementsByClassName("module-header");
var contentWrapper = moduleWrapper.getElementsByClassName("module-content");

Expand Down
2 changes: 1 addition & 1 deletion modules/default/calendar/vendor/ical.js/node-ical.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ical.objectHandlers['RRULE'] = function(val, params, curr, stack, line){
var originalEnd = ical.objectHandlers['END'];
ical.objectHandlers['END'] = function (val, params, curr, stack) {
// Recurrence rules are only valid for VEVENT, VTODO, and VJOURNAL.
// More specifically, we need to filter the VCALENDAR type because we might end up with a defined rrule
// More specifically, we need to filter the VCALENDAR type because we might end up with a defined rrule
// due to the subtypes.
if ((val === "VEVENT") || (val === "VTODO") || (val === "VJOURNAL")) {
if (curr.rrule) {
Expand Down
48 changes: 31 additions & 17 deletions modules/default/clock/clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,40 @@ Module.register("clock",{

// Schedule update interval.
var self = this;
self.second = 0;
self.minute = 0;
self.lastDisplayedMinute = null;
setInterval(function() {
if (self.config.displaySeconds || self.lastDisplayedMinute !== moment().minute()) {
self.updateDom();
self.second = moment().second();
self.minute = moment().minute();

//Calculate how many ms should pass until next update depending on if seconds is displayed or not
var delayCalculator = function(reducedSeconds) {
if (self.config.displaySeconds) {
return 1000 - moment().milliseconds();
} else {
return ((60 - reducedSeconds) * 1000) - moment().milliseconds();
}
if (self.second === 59) {
self.second = 0;
if (self.minute === 59){
self.minute = 0;
} else {
self.minute++;
};

//A recursive timeout function instead of interval to avoid drifting
var notificationTimer = function() {
self.updateDom();

//If seconds is displayed CLOCK_SECOND-notification should be sent (but not when CLOCK_MINUTE-notification is sent)
if (self.config.displaySeconds) {
self.second = (self.second + 1) % 60;
if (self.second !== 0) {
self.sendNotification("CLOCK_SECOND", self.second);
setTimeout(notificationTimer, delayCalculator(0));
return;
}
self.sendNotification("CLOCK_MINUTE", self.minute);
} else {
self.second++;
self.sendNotification("CLOCK_SECOND", self.second);
}
}, 1000);

//If minute changed or seconds isn't displayed send CLOCK_MINUTE-notification
self.minute = (self.minute + 1) % 60;
self.sendNotification("CLOCK_MINUTE", self.minute);
setTimeout(notificationTimer, delayCalculator(0));
};

//Set the initial timeout with the amount of seconds elapsed as reducedSeconds so it will trigger when the minute changes
setTimeout(notificationTimer, delayCalculator(self.second));

// Set locale.
moment.locale(config.language);
Expand Down
2 changes: 1 addition & 1 deletion modules/default/currentweather/currentweather.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ Module.register("currentweather",{
if (this.config.useLocationAsHeader && this.config.location !== false) {
return this.config.location;
}

return this.data.header;
},

Expand Down
5 changes: 5 additions & 0 deletions modules/default/newsfeed/newsfeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,11 @@ Module.register("newsfeed",{

self.updateDom(self.config.animationSpeed);

// Broadcast NewsFeed if needed
if (self.config.broadcastNewsFeeds) {
self.sendNotification("NEWS_FEED", {items: self.newsItems});
}

timer = setInterval(function() {
self.activeItem++;
self.updateDom(self.config.animationSpeed);
Expand Down
22 changes: 14 additions & 8 deletions modules/default/updatenotification/node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,25 @@ module.exports = NodeHelper.create({
config: {},

updateTimer: null,
updateProcessStarted: false,

start: function () {
},

configureModules: function(modules) {

// Push MagicMirror itself , biggest chance it'll show up last in UI and isn't overwritten
// others will be added in front, asynchronously
simpleGits.push({"module": "default", "git": SimpleGit(path.normalize(__dirname + "/../../../"))});

for (moduleName in modules) {
if (defaultModules.indexOf(moduleName) < 0) {
// Default modules are included in the main MagicMirror repo
var moduleFolder = path.normalize(__dirname + "/../../" + moduleName);

var stat;
try {
//console.log("checking git for module="+moduleName)
stat = fs.statSync(path.join(moduleFolder, ".git"));
} catch(err) {
// Error when directory .git doesn't exist
Expand All @@ -36,30 +43,29 @@ module.exports = NodeHelper.create({
// No valid remote for folder, skip
return;
}

// Folder has .git and has at least one git remote, watch this folder
simpleGits.push({"module": mn, "git": git});
simpleGits.unshift({"module": mn, "git": git});
});
}(moduleName, moduleFolder);
}
}

// Push MagicMirror itself last, biggest chance it'll show up last in UI and isn't overwritten
simpleGits.push({"module": "default", "git": SimpleGit(path.normalize(__dirname + "/../../../"))});
},

socketNotificationReceived: function (notification, payload) {
if (notification === "CONFIG") {
this.config = payload;
} else if(notification === "MODULES") {
this.configureModules(payload);
this.preformFetch();
// if this is the 1st time thru the update check process
if(this.updateProcessStarted==false ){
this.updateProcessStarted=true;
this.configureModules(payload);
this.preformFetch();
}
}
},

preformFetch() {
var self = this;

simpleGits.forEach(function(sg) {
sg.git.fetch().status(function(err, data) {
data.module = sg.module;
Expand Down
Loading

0 comments on commit 500147e

Please sign in to comment.