diff --git a/nodes/core/core/58-debug.html b/nodes/core/core/58-debug.html index c421c0604..5eab64fad 100644 --- a/nodes/core/core/58-debug.html +++ b/nodes/core/core/58-debug.html @@ -83,6 +83,19 @@ url: "debug/"+this.id+"/"+(this.active?"enable":"disable"), type: "POST", success: function(resp, textStatus, xhr) { + var historyEvent = { + t:'edit', + node:node, + changes:{ + active: !node.active + }, + dirty:node.dirty, + changed:node.changed + }; + node.changed = true; + RED.nodes.dirty(true); + RED.history.push(historyEvent); + if (xhr.status == 200) { RED.notify(node._("debug.notification.activated",{label:label}),"success"); } else if (xhr.status == 201) { diff --git a/nodes/core/core/58-debug.js b/nodes/core/core/58-debug.js index 4e8588322..514ce09e0 100644 --- a/nodes/core/core/58-debug.js +++ b/nodes/core/core/58-debug.js @@ -100,6 +100,10 @@ module.exports = function(RED) { var seenAts = []; try { msg.format = msg.msg.constructor.name || "Object"; + // Handle special case of msg.req/res objects from HTTP In node + if (msg.format === "IncomingMessage" || msg.format === "ServerResponse") { + msg.format = "Object"; + } } catch(err) { msg.format = "Object"; } @@ -116,7 +120,7 @@ module.exports = function(RED) { msg.msg = msg.msg.slice(0,debuglength); } } - if (isArray || (msg.format === "Object")) { + if (isArray || msg.format === "Object") { msg.msg = safeJSONStringify(msg.msg, function(key, value) { if (key === '_req' || key === '_res') { return "[internal]" diff --git a/red/api/comms.js b/red/api/comms.js index cb785e239..6f5618ecf 100644 --- a/red/api/comms.js +++ b/red/api/comms.js @@ -132,14 +132,14 @@ function start() { if (anonymousUser) { log.audit({event: "comms.auth",user:anonymousUser}); completeConnection(anonymousUser.permissions,false); + //TODO: duplicated code - pull non-auth message handling out + if (msg.subscribe) { + handleRemoteSubscription(ws,msg.subscribe); + } } else { log.audit({event: "comms.auth.fail"}); completeConnection(null,false); } - //TODO: duplicated code - pull non-auth message handling out - if (msg.subscribe) { - handleRemoteSubscription(ws,msg.subscribe); - } } } }); diff --git a/red/runtime/nodes/index.js b/red/runtime/nodes/index.js index 20634c1d9..7d7cc4dd3 100644 --- a/red/runtime/nodes/index.js +++ b/red/runtime/nodes/index.js @@ -17,6 +17,7 @@ var when = require("when"); var path = require("path"); var fs = require("fs"); +var clone = require("clone"); var registry = require("./registry"); var credentials = require("./credentials"); @@ -79,6 +80,7 @@ function createNode(node,def) { } var creds = credentials.get(id); if (creds) { + creds = clone(creds); //console.log("Attaching credentials to ",node.id); // allow $(foo) syntax to substitute env variables for credentials also... for (var p in creds) { diff --git a/red/runtime/nodes/registry/localfilesystem.js b/red/runtime/nodes/registry/localfilesystem.js index 6de9c1044..f8ed507a4 100644 --- a/red/runtime/nodes/registry/localfilesystem.js +++ b/red/runtime/nodes/registry/localfilesystem.js @@ -80,6 +80,8 @@ function getLocalFile(file) { * @return an array of fully-qualified paths to .js files */ function getLocalNodeFiles(dir) { + dir = path.resolve(dir); + var result = []; var files = []; try { @@ -218,7 +220,7 @@ function getNodeFiles(disableNodePathScan) { if (settings.coreNodesDir) { nodeFiles = getLocalNodeFiles(path.resolve(settings.coreNodesDir)); - var defaultLocalesPath = path.resolve(path.join(settings.coreNodesDir,"core","locales")); + var defaultLocalesPath = path.join(settings.coreNodesDir,"core","locales"); i18n.registerMessageCatalog("node-red",defaultLocalesPath,"messages.json"); } diff --git a/test/red/runtime/nodes/registry/localfilesystem_spec.js b/test/red/runtime/nodes/registry/localfilesystem_spec.js index 50abf0f3b..53477b482 100644 --- a/test/red/runtime/nodes/registry/localfilesystem_spec.js +++ b/test/red/runtime/nodes/registry/localfilesystem_spec.js @@ -36,6 +36,7 @@ describe("red/nodes/registry/localfilesystem",function() { for (var i=0;i