Merge pull request #951 from QNimbus/fix-issue-950

Fix for issue #950
This commit is contained in:
Michael Teeuw 2017-07-20 10:12:45 +02:00 committed by GitHub
commit fbd47a7f3b
7 changed files with 35 additions and 32 deletions

View File

@ -11,10 +11,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Add symbol and color properties of event when `CALENDAR_EVENTS` notification is broadcasted from `default/calendar` module. - Add symbol and color properties of event when `CALENDAR_EVENTS` notification is broadcasted from `default/calendar` module.
### Updated ### Updated
- Changed 'default.js' - listen on all attached interfaces by default
### Fixed ### Fixed
- Fixed issue with incorrect allignment of analog clock when displayed in the center column of the MM - Fixed issue with incorrect allignment of analog clock when displayed in the center column of the MM
- Fixed ipWhitelist behaviour to make empty whitelist ([]) allow any and all hosts access to the MM
## [2.1.2] - 2017-07-01 ## [2.1.2] - 2017-07-01

View File

@ -4,15 +4,15 @@
*/ */
// Inspired by base2 and Prototype // Inspired by base2 and Prototype
(function() { (function () {
var initializing = false; var initializing = false;
var fnTest = /xyz/.test(function() {xyz;}) ? /\b_super\b/ : /.*/; var fnTest = /xyz/.test(function () { xyz; }) ? /\b_super\b/ : /.*/;
// The base Class implementation (does nothing) // The base Class implementation (does nothing)
this.Class = function() {}; this.Class = function () { };
// Create a new Class that inherits from this class // Create a new Class that inherits from this class
Class.extend = function(prop) { Class.extend = function (prop) {
var _super = this.prototype; var _super = this.prototype;
// Instantiate a base class (but only create the instance, // Instantiate a base class (but only create the instance,
@ -30,23 +30,23 @@
for (var name in prop) { for (var name in prop) {
// Check if we're overwriting an existing function // Check if we're overwriting an existing function
prototype[name] = typeof prop[name] == "function" && prototype[name] = typeof prop[name] == "function" &&
typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn) { typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function (name, fn) {
return function() { return function () {
var tmp = this._super; var tmp = this._super;
// Add a new ._super() method that is the same method // Add a new ._super() method that is the same method
// but on the super-class // but on the super-class
this._super = _super[name]; this._super = _super[name];
// The method only need to be bound temporarily, so we // The method only need to be bound temporarily, so we
// remove it when we're done executing // remove it when we're done executing
var ret = fn.apply(this, arguments); var ret = fn.apply(this, arguments);
this._super = tmp; this._super = tmp;
return ret; return ret;
}; };
})(name, prop[name]) : prop[name]; })(name, prop[name]) : prop[name];
} }
// The dummy class constructor // The dummy class constructor
@ -90,4 +90,4 @@ function cloneObject(obj) {
} }
/*************** DO NOT EDIT THE LINE BELOW ***************/ /*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = Class;} if (typeof module !== "undefined") { module.exports = Class; }

View File

@ -8,7 +8,7 @@
*/ */
var port = 8080; var port = 8080;
var address = "localhost"; var address = ""; // Default to listening on all interfaces
if (typeof(mmPort) !== "undefined") { if (typeof(mmPort) !== "undefined") {
port = mmPort; port = mmPort;
} }

View File

@ -46,8 +46,9 @@ function createWindow() {
mainWindow = new BrowserWindow(electronOptions); mainWindow = new BrowserWindow(electronOptions);
// and load the index.html of the app. // and load the index.html of the app.
//mainWindow.loadURL('file://' + __dirname + '../../index.html'); // If config.address is not defined or is an empty string (listening on all interfaces), connect to localhost
mainWindow.loadURL(`http://${config.address}:${config.port}`); var address = config.address === void 0 | config.address === "" ? config.address = "localhost" : config.address;
mainWindow.loadURL(`http://${address}:${config.port}`);
// Open the DevTools if run with "npm start dev" // Open the DevTools if run with "npm start dev"
if (process.argv.includes("dev")) { if (process.argv.includes("dev")) {

View File

@ -30,7 +30,7 @@ var Server = function(config, callback) {
} }
app.use(function(req, res, next) { app.use(function(req, res, next) {
var result = ipfilter(config.ipWhitelist, {mode: "allow", log: false})(req, res, function(err) { var result = ipfilter(config.ipWhitelist, {mode: config.ipWhitelist.length === 0 ? "deny" : "allow", log: false})(req, res, function(err) {
if (err === undefined) { if (err === undefined) {
return next(); return next();
} }

View File

@ -11,11 +11,11 @@ Module.register("updatenotification", {
}, },
notificationReceived: function(notification, payload, sender) { notificationReceived: function (notification, payload, sender) {
if (notification === "DOM_OBJECTS_CREATED") { if (notification === "DOM_OBJECTS_CREATED") {
this.sendSocketNotification("CONFIG", this.config); this.sendSocketNotification("CONFIG", this.config);
this.sendSocketNotification("MODULES", Module.definitions); this.sendSocketNotification("MODULES", Module.definitions);
this.hide(0,{lockString: self.identifier}); this.hide(0, { lockString: self.identifier });
} }
}, },
@ -26,11 +26,11 @@ Module.register("updatenotification", {
} }
}, },
updateUI: function() { updateUI: function () {
var self = this; var self = this;
if (this.status && this.status.behind > 0) { if (this.status && this.status.behind > 0) {
self.updateDom(0); self.updateDom(0);
self.show(1000, {lockString: self.identifier}); self.show(1000, { lockString: self.identifier });
} }
}, },
@ -59,8 +59,8 @@ Module.register("updatenotification", {
var subtext = document.createElement("div"); var subtext = document.createElement("div");
subtext.innerHTML = this.translate("UPDATE_INFO") subtext.innerHTML = this.translate("UPDATE_INFO")
.replace("COMMIT_COUNT", this.status.behind + " " + ((this.status.behind == 1)? "commit" : "commits")) .replace("COMMIT_COUNT", this.status.behind + " " + ((this.status.behind == 1) ? "commit" : "commits"))
.replace("BRANCH_NAME", this.status.current); .replace("BRANCH_NAME", this.status.current);
subtext.className = "xsmall dimmed"; subtext.className = "xsmall dimmed";
wrapper.appendChild(subtext); wrapper.appendChild(subtext);
} }

View File

@ -14,7 +14,7 @@ var path = require("path");
var fs = require("fs"); var fs = require("fs");
var Utils = require(__dirname + "/../../js/utils.js"); var Utils = require(__dirname + "/../../js/utils.js");
if (process.env.NODE_ENV == "test") {return 0}; if (process.env.NODE_ENV == "test") { return 0 };
/* getConfigFile() /* getConfigFile()
* Return string with path of configuration file * Return string with path of configuration file
@ -48,9 +48,9 @@ try {
// In case the there errors show messages and // In case the there errors show messages and
// return // return
console.info(Utils.colors.info("Checking file... ", configFileName)); console.info(Utils.colors.info("Checking file... ", configFileName));
// I'm not sure if all ever is utf-8 // I'm not sure if all ever is utf-8
fs.readFile(configFileName, "utf-8", function(err, data) { fs.readFile(configFileName, "utf-8", function (err, data) {
if (err) {throw err;} if (err) { throw err; }
v.JSHINT(data); // Parser by jshint v.JSHINT(data); // Parser by jshint
if (v.JSHINT.errors.length == 0) { if (v.JSHINT.errors.length == 0) {