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.
### Updated
- Changed 'default.js' - listen on all attached interfaces by default
### Fixed
- 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

View File

@ -4,15 +4,15 @@
*/
// Inspired by base2 and Prototype
(function() {
(function () {
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)
this.Class = function() {};
this.Class = function () { };
// Create a new Class that inherits from this class
Class.extend = function(prop) {
Class.extend = function (prop) {
var _super = this.prototype;
// Instantiate a base class (but only create the instance,
@ -30,8 +30,8 @@
for (var name in prop) {
// Check if we're overwriting an existing function
prototype[name] = typeof prop[name] == "function" &&
typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn) {
return function() {
typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function (name, fn) {
return function () {
var tmp = this._super;
// Add a new ._super() method that is the same method
@ -90,4 +90,4 @@ function cloneObject(obj) {
}
/*************** 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 address = "localhost";
var address = ""; // Default to listening on all interfaces
if (typeof(mmPort) !== "undefined") {
port = mmPort;
}

View File

@ -46,8 +46,9 @@ function createWindow() {
mainWindow = new BrowserWindow(electronOptions);
// and load the index.html of the app.
//mainWindow.loadURL('file://' + __dirname + '../../index.html');
mainWindow.loadURL(`http://${config.address}:${config.port}`);
// If config.address is not defined or is an empty string (listening on all interfaces), connect to localhost
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"
if (process.argv.includes("dev")) {

View File

@ -30,7 +30,7 @@ var Server = function(config, callback) {
}
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) {
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") {
this.sendSocketNotification("CONFIG", this.config);
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;
if (this.status && this.status.behind > 0) {
self.updateDom(0);
self.show(1000, {lockString: self.identifier});
self.show(1000, { lockString: self.identifier });
}
},
@ -59,7 +59,7 @@ Module.register("updatenotification", {
var subtext = document.createElement("div");
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);
subtext.className = "xsmall dimmed";
wrapper.appendChild(subtext);

View File

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