mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
commit
d2b30b4f9c
@ -14,7 +14,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
### Added
|
### Added
|
||||||
- Timestamps in log output.
|
- Timestamps in log output.
|
||||||
- Padding in dateheader mode of the calendar module .
|
- Padding in dateheader mode of the calendar module .
|
||||||
- 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 upgrade script to help users consume regular updates installers/upgrade-script.sh.
|
||||||
- New script to help setup pm2, without install installers/fixuppm2.sh.
|
- New script to help setup pm2, without install installers/fixuppm2.sh.
|
||||||
|
|
||||||
|
125
modules/node_modules/node_helper/index.js
generated
vendored
Normal file
125
modules/node_modules/node_helper/index.js
generated
vendored
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
/* 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;
|
10
package-lock.json
generated
10
package-lock.json
generated
@ -5764,10 +5764,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_helper": {
|
|
||||||
"version": "git://github.com/sdetweil/nodehelper.git#c01ad10b38c81938a9ba3e55ab72ffd81d4bc0d4",
|
|
||||||
"from": "git://github.com/sdetweil/nodehelper.git"
|
|
||||||
},
|
|
||||||
"nopt": {
|
"nopt": {
|
||||||
"version": "3.0.6",
|
"version": "3.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
|
||||||
@ -6275,9 +6271,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"postcss": {
|
"postcss": {
|
||||||
"version": "7.0.25",
|
"version": "7.0.26",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.25.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.26.tgz",
|
||||||
"integrity": "sha512-NXXVvWq9icrm/TgQC0O6YVFi4StfJz46M1iNd/h6B26Nvh/HKI+q4YZtFN/EjcInZliEscO/WL10BXnc1E5nwg==",
|
"integrity": "sha512-IY4oRjpXWYshuTDFxMVkJDtWIk2LhsTlu8bZnbEJA4+bYT16Lvpo8Qv6EvDumhYRgzjZl489pmsY3qVgJQ08nA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"chalk": "^2.4.2",
|
"chalk": "^2.4.2",
|
||||||
|
@ -68,7 +68,6 @@
|
|||||||
"iconv-lite": "latest",
|
"iconv-lite": "latest",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"moment": "latest",
|
"moment": "latest",
|
||||||
"node_helper": "git://github.com/sdetweil/nodehelper.git",
|
|
||||||
"request": "^2.88.0",
|
"request": "^2.88.0",
|
||||||
"rrule": "^2.6.2",
|
"rrule": "^2.6.2",
|
||||||
"rrule-alt": "^2.2.8",
|
"rrule-alt": "^2.2.8",
|
||||||
|
2
vendor/package-lock.json
generated
vendored
2
vendor/package-lock.json
generated
vendored
@ -5,7 +5,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-free": {
|
"@fortawesome/fontawesome-free": {
|
||||||
"version": "5.6.3",
|
"version": "5.6.3",
|
||||||
"resolved": "https://npm.fontawesome.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.6.3.tgz",
|
||||||
"integrity": "sha512-s5PLdI9NYgjBvfrv6rhirPHlAHWx+Sfo/IjsAeiXYfmemC/GSjwsyz1wLnGPazbLPXWfk62ks980o9AmsxYUEQ=="
|
"integrity": "sha512-s5PLdI9NYgjBvfrv6rhirPHlAHWx+Sfo/IjsAeiXYfmemC/GSjwsyz1wLnGPazbLPXWfk62ks980o9AmsxYUEQ=="
|
||||||
},
|
},
|
||||||
"a-sync-waterfall": {
|
"a-sync-waterfall": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user