mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-03 06:15:59 +00:00
commit
525c235d3b
@ -1,7 +1,12 @@
|
||||
dist: trusty
|
||||
language: node_js
|
||||
node_js:
|
||||
- "8"
|
||||
- "10
|
||||
|
||||
before_install:
|
||||
- npm i -g npm
|
||||
|
||||
|
||||
before_script:
|
||||
- yarn danger ci
|
||||
- npm install grunt-cli -g
|
||||
|
10
CHANGELOG.md
10
CHANGELOG.md
@ -4,14 +4,16 @@ All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
### Added
|
||||
- move node_helper module to dedicated github repo, to prevent being erased accidentally
|
||||
|
||||
- new upgrade script to help users consume regular updates installers/upgrade-script.sh
|
||||
- new script to help setup pm2, without install installers/fixuppm2.sh
|
||||
|
||||
### Updated
|
||||
- updated compliments.js to handle newline in text, as textfields to not interpolate contents
|
||||
- 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
|
||||
|
||||
---
|
||||
- change electron version
|
||||
|
||||
❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror² core.
|
||||
|
||||
@ -21,12 +23,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
### Added
|
||||
- Timestamps in log output
|
||||
- Padding in dateheader mode of the calendar module
|
||||
|
||||
### Updated
|
||||
|
||||
### Fixed
|
||||
- Fixed issue in weatherforecast module where predicted amount of rain was not using the decimal symbol specified in config.js.
|
||||
|
||||
- Module header now updates correctly, if a module need to dynamically show/hide its header based on a condition.
|
||||
|
||||
## [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).
|
||||
|
17
js/main.js
17
js/main.js
@ -39,11 +39,13 @@ var MM = (function() {
|
||||
dom.opacity = 0;
|
||||
wrapper.appendChild(dom);
|
||||
|
||||
if (typeof module.getHeader() !== "undefined" && module.getHeader() !== "") {
|
||||
var moduleHeader = document.createElement("header");
|
||||
moduleHeader.innerHTML = module.getHeader();
|
||||
moduleHeader.className = "module-header";
|
||||
dom.appendChild(moduleHeader);
|
||||
var moduleHeader = document.createElement("header");
|
||||
moduleHeader.innerHTML = module.getHeader();
|
||||
moduleHeader.className = "module-header";
|
||||
dom.appendChild(moduleHeader);
|
||||
|
||||
if (typeof module.getHeader() === "undefined" || module.getHeader() !== "") {
|
||||
moduleHeader.style = "display: none;";
|
||||
}
|
||||
|
||||
var moduleContent = document.createElement("div");
|
||||
@ -210,9 +212,8 @@ var MM = (function() {
|
||||
contentWrapper[0].innerHTML = "";
|
||||
contentWrapper[0].appendChild(newContent);
|
||||
|
||||
if( headerWrapper.length > 0 && newHeader) {
|
||||
headerWrapper[0].innerHTML = newHeader;
|
||||
}
|
||||
headerWrapper[0].innerHTML = newHeader;
|
||||
headerWrapper[0].style = headerWrapper.length > 0 && newHeader ? undefined : "display: none;";
|
||||
};
|
||||
|
||||
/* hideModule(module, speed, callback)
|
||||
|
@ -24,7 +24,7 @@ var Server = function(config, callback) {
|
||||
|
||||
console.log("Starting server on port " + port + " ... ");
|
||||
|
||||
server.listen(port, config.address ? config.address : null);
|
||||
server.listen(port, config.address ? config.address : "localhost");
|
||||
|
||||
if (config.ipWhitelist instanceof Array && config.ipWhitelist.length === 0) {
|
||||
console.info(Utils.colors.warn("You're using a full whitelist configuration to allow for all IPs"));
|
||||
|
@ -180,6 +180,7 @@ Module.register("calendar", {
|
||||
|
||||
dateCell.colSpan = "3";
|
||||
dateCell.innerHTML = dateAsString;
|
||||
dateCell.style.paddingTop = "10px";
|
||||
dateRow.appendChild(dateCell);
|
||||
wrapper.appendChild(dateRow);
|
||||
|
||||
|
@ -36,9 +36,10 @@ Module.register("compliments", {
|
||||
morningStartTime: 3,
|
||||
morningEndTime: 12,
|
||||
afternoonStartTime: 12,
|
||||
afternoonEndTime: 17
|
||||
afternoonEndTime: 17,
|
||||
random: true
|
||||
},
|
||||
|
||||
lastIndexUsed:-1,
|
||||
// Set currentweather from module
|
||||
currentWeatherType: "",
|
||||
|
||||
@ -147,19 +148,43 @@ Module.register("compliments", {
|
||||
* return compliment string - A compliment.
|
||||
*/
|
||||
randomCompliment: function() {
|
||||
// get the current time of day compliments list
|
||||
var compliments = this.complimentArray();
|
||||
var index = this.randomIndex(compliments);
|
||||
// variable for index to next message to display
|
||||
let index=0
|
||||
// are we randomizing
|
||||
if(this.config.random){
|
||||
// yes
|
||||
index = this.randomIndex(compliments);
|
||||
}
|
||||
else{
|
||||
// no, sequetial
|
||||
// if doing sequential, don't fall off the end
|
||||
index = (this.lastIndexUsed >= (compliments.length-1))?0: ++this.lastIndexUsed
|
||||
}
|
||||
|
||||
return compliments[index];
|
||||
},
|
||||
|
||||
// Override dom generator.
|
||||
// Override dom generator.
|
||||
getDom: function() {
|
||||
var complimentText = this.randomCompliment();
|
||||
|
||||
var compliment = document.createTextNode(complimentText);
|
||||
var wrapper = document.createElement("div");
|
||||
wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright pre-line";
|
||||
// get the compliment text
|
||||
var complimentText = this.randomCompliment();
|
||||
// split it into parts on newline text
|
||||
var parts= complimentText.split('\n')
|
||||
// create a span to hold it all
|
||||
var compliment=document.createElement('span')
|
||||
// process all the parts of the compliment text
|
||||
for (part of parts){
|
||||
// create a text element for each part
|
||||
compliment.appendChild(document.createTextNode(part))
|
||||
// add a break `
|
||||
compliment.appendChild(document.createElement('BR'))
|
||||
}
|
||||
// remove the last break
|
||||
compliment.lastElementChild.remove();
|
||||
wrapper.appendChild(compliment);
|
||||
|
||||
return wrapper;
|
||||
|
125
modules/node_modules/node_helper/index.js
generated
vendored
125
modules/node_modules/node_helper/index.js
generated
vendored
@ -1,125 +0,0 @@
|
||||
/* Magic Mirror
|
||||
* Node Helper Superclass
|
||||
*
|
||||
* By Michael Teeuw http://michaelteeuw.nl
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
var Class = require("../../../js/class.js");
|
||||
var express = require("express");
|
||||
var path = require("path");
|
||||
|
||||
NodeHelper = Class.extend({
|
||||
init: function() {
|
||||
console.log("Initializing new module helper ...");
|
||||
},
|
||||
|
||||
loaded: function(callback) {
|
||||
console.log("Module helper loaded: " + this.name);
|
||||
callback();
|
||||
},
|
||||
|
||||
start: function() {
|
||||
console.log("Starting module helper: " + this.name);
|
||||
},
|
||||
|
||||
/* stop()
|
||||
* Called when the MagicMirror server receives a `SIGINT`
|
||||
* Close any open connections, stop any sub-processes and
|
||||
* gracefully exit the module.
|
||||
*
|
||||
*/
|
||||
stop: function() {
|
||||
console.log("Stopping module helper: " + this.name);
|
||||
},
|
||||
|
||||
/* socketNotificationReceived(notification, payload)
|
||||
* This method is called when a socket notification arrives.
|
||||
*
|
||||
* argument notification string - The identifier of the notification.
|
||||
* argument payload mixed - The payload of the notification.
|
||||
*/
|
||||
socketNotificationReceived: function(notification, payload) {
|
||||
console.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);
|
||||
},
|
||||
|
||||
/* setName(name)
|
||||
* Set the module name.
|
||||
*
|
||||
* argument name string - Module name.
|
||||
*/
|
||||
setName: function(name) {
|
||||
this.name = name;
|
||||
},
|
||||
|
||||
/* setPath(path)
|
||||
* Set the module path.
|
||||
*
|
||||
* argument path string - Module path.
|
||||
*/
|
||||
setPath: function(path) {
|
||||
this.path = path;
|
||||
},
|
||||
|
||||
/* sendSocketNotification(notification, payload)
|
||||
* Send a socket notification to the node helper.
|
||||
*
|
||||
* argument notification string - The identifier of the notification.
|
||||
* argument payload mixed - The payload of the notification.
|
||||
*/
|
||||
sendSocketNotification: function(notification, payload) {
|
||||
this.io.of(this.name).emit(notification, payload);
|
||||
},
|
||||
|
||||
/* setExpressApp(app)
|
||||
* Sets the express app object for this module.
|
||||
* This allows you to host files from the created webserver.
|
||||
*
|
||||
* argument app Express app - The Express app object.
|
||||
*/
|
||||
setExpressApp: function(app) {
|
||||
this.expressApp = app;
|
||||
|
||||
var publicPath = this.path + "/public";
|
||||
app.use("/" + this.name, express.static(publicPath));
|
||||
},
|
||||
|
||||
/* setSocketIO(io)
|
||||
* Sets the socket io object for this module.
|
||||
* Binds message receiver.
|
||||
*
|
||||
* argument io Socket.io - The Socket io object.
|
||||
*/
|
||||
setSocketIO: function(io) {
|
||||
var self = this;
|
||||
self.io = io;
|
||||
|
||||
console.log("Connecting socket for: " + this.name);
|
||||
var namespace = this.name;
|
||||
io.of(namespace).on("connection", function(socket) {
|
||||
// add a catch all event.
|
||||
var onevent = socket.onevent;
|
||||
socket.onevent = function(packet) {
|
||||
var args = packet.data || [];
|
||||
onevent.call(this, packet); // original call
|
||||
packet.data = ["*"].concat(args);
|
||||
onevent.call(this, packet); // additional call to catch-all
|
||||
};
|
||||
|
||||
// register catch all.
|
||||
socket.on("*", function(notification, payload) {
|
||||
if (notification !== "*") {
|
||||
//console.log('received message in namespace: ' + namespace);
|
||||
self.socketNotificationReceived(notification, payload);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
NodeHelper.create = function(moduleDefinition) {
|
||||
return NodeHelper.extend(moduleDefinition);
|
||||
};
|
||||
|
||||
module.exports = NodeHelper;
|
2097
package-lock.json
generated
2097
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
@ -34,8 +34,8 @@
|
||||
},
|
||||
"homepage": "https://magicmirror.builders",
|
||||
"devDependencies": {
|
||||
"chai": "^4.1.2",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"chai": "latest",
|
||||
"chai-as-promised": "latest",
|
||||
"current-week-number": "^1.0.7",
|
||||
"danger": "^3.1.3",
|
||||
"grunt": "latest",
|
||||
@ -47,16 +47,16 @@
|
||||
"http-auth": "^3.2.3",
|
||||
"jsdom": "^11.6.2",
|
||||
"jshint": "^2.10.2",
|
||||
"mocha": "^4.1.0",
|
||||
"mocha-each": "^1.1.0",
|
||||
"mocha-logger": "^1.0.6",
|
||||
"spectron": "^3.8.0",
|
||||
"mocha": "latest",
|
||||
"mocha-each": "latest",
|
||||
"mocha-logger": "latest",
|
||||
"spectron": "^8.0.0",
|
||||
"stylelint": "latest",
|
||||
"stylelint-config-standard": "latest",
|
||||
"time-grunt": "latest"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"electron": "^3.0.13"
|
||||
"electron": "^6.0.12"
|
||||
},
|
||||
"dependencies": {
|
||||
"colors": "^1.1.2",
|
||||
@ -68,6 +68,7 @@
|
||||
"iconv-lite": "latest",
|
||||
"lodash": "^4.17.11",
|
||||
"moment": "latest",
|
||||
"node_helper": "git://github.com/sdetweil/nodehelper.git",
|
||||
"request": "^2.88.0",
|
||||
"rrule": "^2.6.2",
|
||||
"rrule-alt": "^2.2.8",
|
||||
|
12
run-start.sh
12
run-start.sh
@ -7,10 +7,12 @@ if [ -z "$DISPLAY" ]; then #If not set DISPLAY is SSH remote or tty
|
||||
fi
|
||||
# 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 ,\"\')
|
||||
|
||||
# get the config option, if any
|
||||
# only check non comment lines
|
||||
serveronly=$(grep -v '^\s//' config/config.js | grep -i serveronly: | awk '{print tolower($2)}' | tr -d ,\"\')
|
||||
# set default if not defined in config
|
||||
serveronly="${serveronly:=false}"
|
||||
serveronly=${serveronly:-false}
|
||||
# check for xwindows running
|
||||
xorg=$(pgrep Xorg)
|
||||
#check for macOS
|
||||
@ -21,7 +23,7 @@ mac=$(uname)
|
||||
# system is in text mode
|
||||
#
|
||||
if [ "$serveronly." != "false." -o "$arch" == "armv6l" ] || [ "$xorg." == "." -a $mac != 'Darwin' ]; 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
|
||||
@ -60,5 +62,5 @@ if [ "$serveronly." != "false." -o "$arch" == "armv6l" ] || [ "$xorg." == "."
|
||||
fi
|
||||
else
|
||||
# we can use electron directly
|
||||
`electron js/electron.js $1`;
|
||||
electron js/electron.js $1;
|
||||
fi
|
||||
|
@ -35,7 +35,10 @@ describe("Vendors", function () {
|
||||
it(`should return 200 HTTP code for vendor "${vendor}"`, function () {
|
||||
urlVendor = "http://localhost:8080/vendor/" + vendors[vendor];
|
||||
request.get(urlVendor, function (err, res, body) {
|
||||
expect(res.statusCode).to.equal(200);
|
||||
if (!err)
|
||||
expect(res.statusCode).to.equal(200);
|
||||
else
|
||||
mlog.pending(`There error vendor 200 test ${err}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user