mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge branch '0.15.0'
This commit is contained in:
@@ -168,7 +168,7 @@
|
||||
msg.onclick = function() {
|
||||
var node = RED.nodes.node(o.id) || RED.nodes.node(o.z);
|
||||
if (node) {
|
||||
RED.workspaces.show(node.z);
|
||||
RED.view.reveal(node.id);
|
||||
}
|
||||
|
||||
};
|
||||
|
@@ -175,7 +175,7 @@ module.exports = function(RED) {
|
||||
node.log(RED._("mqtt.state.connected",{broker:(node.clientid?node.clientid+"@":"")+node.brokerurl}));
|
||||
for (var id in node.users) {
|
||||
if (node.users.hasOwnProperty(id)) {
|
||||
node.users[id].status({fill:"green",shape:"dot",text:"common.status.connected"});
|
||||
node.users[id].status({fill:"green",shape:"dot",text:"node-red:common.status.connected"});
|
||||
}
|
||||
}
|
||||
// Remove any existing listeners before resubscribing to avoid duplicates in the event of a re-connection
|
||||
@@ -205,7 +205,7 @@ module.exports = function(RED) {
|
||||
node.client.on("reconnect", function() {
|
||||
for (var id in node.users) {
|
||||
if (node.users.hasOwnProperty(id)) {
|
||||
node.users[id].status({fill:"yellow",shape:"ring",text:"common.status.connecting"});
|
||||
node.users[id].status({fill:"yellow",shape:"ring",text:"node-red:common.status.connecting"});
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -216,7 +216,7 @@ module.exports = function(RED) {
|
||||
node.log(RED._("mqtt.state.disconnected",{broker:(node.clientid?node.clientid+"@":"")+node.brokerurl}));
|
||||
for (var id in node.users) {
|
||||
if (node.users.hasOwnProperty(id)) {
|
||||
node.users[id].status({fill:"red",shape:"ring",text:"common.status.disconnected"});
|
||||
node.users[id].status({fill:"red",shape:"ring",text:"node-red:common.status.disconnected"});
|
||||
}
|
||||
}
|
||||
} else if (node.connecting) {
|
||||
@@ -329,7 +329,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
var node = this;
|
||||
if (this.brokerConn) {
|
||||
this.status({fill:"red",shape:"ring",text:"common.status.disconnected"});
|
||||
this.status({fill:"red",shape:"ring",text:"node-red:common.status.disconnected"});
|
||||
if (this.topic) {
|
||||
node.brokerConn.register(this);
|
||||
this.brokerConn.subscribe(this.topic,this.qos,function(topic,payload,packet) {
|
||||
@@ -341,7 +341,7 @@ module.exports = function(RED) {
|
||||
node.send(msg);
|
||||
}, this.id);
|
||||
if (this.brokerConn.connected) {
|
||||
node.status({fill:"green",shape:"dot",text:"common.status.connected"});
|
||||
node.status({fill:"green",shape:"dot",text:"node-red:common.status.connected"});
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -369,7 +369,7 @@ module.exports = function(RED) {
|
||||
var node = this;
|
||||
|
||||
if (this.brokerConn) {
|
||||
this.status({fill:"red",shape:"ring",text:"common.status.disconnected"});
|
||||
this.status({fill:"red",shape:"ring",text:"node-red:common.status.disconnected"});
|
||||
this.on("input",function(msg) {
|
||||
if (msg.qos) {
|
||||
msg.qos = parseInt(msg.qos);
|
||||
@@ -391,7 +391,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
});
|
||||
if (this.brokerConn.connected) {
|
||||
node.status({fill:"green",shape:"dot",text:"common.status.connected"});
|
||||
node.status({fill:"green",shape:"dot",text:"node-red:common.status.connected"});
|
||||
}
|
||||
node.brokerConn.register(node);
|
||||
this.on('close', function(done) {
|
||||
|
@@ -27,7 +27,7 @@
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-url"><i class="fa fa-globe"></i> <span data-i18n="httpin.label.url"></span></label>
|
||||
<input type="text" id="node-input-url" placeholder="/url">
|
||||
<div id="node-input-url" contenteditable="true" placeholder="/url"></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
||||
@@ -117,7 +117,7 @@ msg.cookies = {
|
||||
color:"rgb(231, 231, 174)",
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
url: {value:"",required:true},
|
||||
url: {value:"",required:true,format:"url"},
|
||||
method: {value:"get",required:true},
|
||||
swaggerDoc: {type:"swagger-doc", required:false}
|
||||
},
|
||||
|
@@ -27,7 +27,7 @@
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-url"><i class="fa fa-globe"></i> <span data-i18n="httpin.label.url"></span></label>
|
||||
<input type="text" id="node-input-url" placeholder="http://">
|
||||
<div id="node-input-url" contenteditable="true" placeholder="http://"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
@@ -102,7 +102,7 @@
|
||||
name: {value:""},
|
||||
method:{value:"GET"},
|
||||
ret: {value:"txt"},
|
||||
url:{value:""},
|
||||
url:{value:"",format:"url"},
|
||||
tls: {type:"tls-config",required: false}
|
||||
},
|
||||
credentials: {
|
||||
|
@@ -74,6 +74,8 @@ module.exports = function(RED) {
|
||||
var opts = urllib.parse(url);
|
||||
opts.method = method;
|
||||
opts.headers = {};
|
||||
var ctSet = "Content-Type"; // set default camel case
|
||||
var clSet = "Content-Length";
|
||||
if (msg.headers) {
|
||||
for (var v in msg.headers) {
|
||||
if (msg.headers.hasOwnProperty(v)) {
|
||||
@@ -83,6 +85,8 @@ module.exports = function(RED) {
|
||||
// function. Otherwise leave them alone.
|
||||
name = v;
|
||||
}
|
||||
else if (name === 'content-type') { ctSet = v; }
|
||||
else { clSet = v; }
|
||||
opts.headers[name] = msg.headers[v];
|
||||
}
|
||||
}
|
||||
@@ -103,18 +107,27 @@ module.exports = function(RED) {
|
||||
} else {
|
||||
payload = JSON.stringify(msg.payload);
|
||||
if (opts.headers['content-type'] == null) {
|
||||
opts.headers['content-type'] = "application/json";
|
||||
opts.headers[ctSet] = "application/json";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (opts.headers['content-length'] == null) {
|
||||
if (Buffer.isBuffer(payload)) {
|
||||
opts.headers['content-length'] = payload.length;
|
||||
opts.headers[clSet] = payload.length;
|
||||
} else {
|
||||
opts.headers['content-length'] = Buffer.byteLength(payload);
|
||||
opts.headers[clSet] = Buffer.byteLength(payload);
|
||||
}
|
||||
}
|
||||
}
|
||||
// revert to user supplied Capitalisation if needed.
|
||||
if (opts.headers.hasOwnProperty('content-type') && (ctSet !== 'content-type')) {
|
||||
opts.headers[ctSet] = opts.headers['content-type'];
|
||||
delete opts.headers['content-type'];
|
||||
}
|
||||
if (opts.headers.hasOwnProperty('content-length') && (clSet !== 'content-length')) {
|
||||
opts.headers[clSet] = opts.headers['content-length'];
|
||||
delete opts.headers['content-length'];
|
||||
}
|
||||
var urltotest = url;
|
||||
var noproxy;
|
||||
if (noprox) {
|
||||
@@ -135,7 +148,6 @@ module.exports = function(RED) {
|
||||
opts.path = opts.pathname = path;
|
||||
opts.headers = heads;
|
||||
opts.method = method;
|
||||
//console.log(opts);
|
||||
urltotest = match[0];
|
||||
}
|
||||
else { node.warn("Bad proxy url: "+process.env.http_proxy); }
|
||||
|
@@ -145,7 +145,7 @@
|
||||
RED.nodes.registerType('websocket-listener',{
|
||||
category: 'config',
|
||||
defaults: {
|
||||
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/) },
|
||||
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/),format:"filepath" },
|
||||
wholemsg: {value:"false"}
|
||||
},
|
||||
inputs:0,
|
||||
@@ -179,7 +179,7 @@
|
||||
RED.nodes.registerType('websocket-client',{
|
||||
category: 'config',
|
||||
defaults: {
|
||||
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/) },
|
||||
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/),format:"filepath" },
|
||||
wholemsg: {value:"false"}
|
||||
},
|
||||
inputs:0,
|
||||
@@ -232,7 +232,7 @@
|
||||
<script type="text/x-red" data-template-name="websocket-listener">
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-path"><i class="fa fa-bookmark"></i> <span data-i18n="websocket.label.path"></span></label>
|
||||
<input type="text" id="node-config-input-path" placeholder="/ws/example">
|
||||
<div id="node-config-input-path" contenteditable="true" placeholder="/ws/example"></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-wholemsg"> </label>
|
||||
@@ -255,7 +255,7 @@
|
||||
<script type="text/x-red" data-template-name="websocket-client">
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-path"><i class="fa fa-bookmark"></i> <span data-i18n="websocket.label.url"></span></label>
|
||||
<input type="text" id="node-config-input-path" placeholder="ws://example.com/ws">
|
||||
<div id="node-config-input-path" contenteditable="true" placeholder="ws://example.com/ws"></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-wholemsg"> </label>
|
||||
|
@@ -17,7 +17,7 @@
|
||||
<script type="text/x-red" data-template-name="watch">
|
||||
<div class="form-row node-input-filename">
|
||||
<label for="node-input-files"><i class="fa fa-file"></i> <span data-i18n="watch.label.files"></span></label>
|
||||
<input type="text" id="node-input-files" data-i18n="[placeholder]watch.placeholder.files">
|
||||
<div id="node-input-files" contenteditable="true" tabindex="1" data-i18n="[placeholder]watch.placeholder.files"></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
||||
@@ -46,7 +46,7 @@
|
||||
category: 'advanced-input',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
files: {value:"",required:true}
|
||||
files: {value:"",required:true, format:"filepath"}
|
||||
},
|
||||
color:"BurlyWood",
|
||||
inputs:0,
|
||||
|
@@ -17,7 +17,7 @@
|
||||
<script type="text/x-red" data-template-name="tail">
|
||||
<div class="form-row">
|
||||
<label for="node-input-filename"><i class="fa fa-file"></i> <span data-i18n="tail.label.filename"></span></label>
|
||||
<input type="text" id="node-input-filename">
|
||||
<div id="node-input-filename" contenteditable="true"></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-filetype"><i class="fa fa-file-text-o"></i> <span data-i18n="tail.label.type"></span></label>
|
||||
@@ -50,7 +50,7 @@
|
||||
name: {value:""},
|
||||
filetype: {value:"text"},
|
||||
split: {value:false},
|
||||
filename: {value:"",required:true}
|
||||
filename: {value:"",required:true,format:"filepath"}
|
||||
},
|
||||
color:"BurlyWood",
|
||||
inputs:0,
|
||||
|
@@ -17,7 +17,7 @@
|
||||
<script type="text/x-red" data-template-name="file">
|
||||
<div class="form-row node-input-filename">
|
||||
<label for="node-input-filename"><i class="fa fa-file"></i> <span data-i18n="file.label.filename"></span></label>
|
||||
<input type="text" id="node-input-filename">
|
||||
<div id="node-input-filename" contenteditable="true"></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-overwriteFile"><i class="fa fa-random"></i> <span data-i18n="file.label.action"></span></label>
|
||||
@@ -56,7 +56,7 @@
|
||||
<script type="text/x-red" data-template-name="file in">
|
||||
<div class="form-row">
|
||||
<label for="node-input-filename"><i class="fa fa-file"></i> <span data-i18n="file.label.filename"></span></label>
|
||||
<input type="text" id="node-input-filename" data-i18n="[placeholder]file.label.filename">
|
||||
<div id="node-input-filename" contenteditable="true" data-i18n="[placeholder]file.label.filename"></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-format"><i class="fa fa-sign-out"></i> <span data-i18n="file.label.outputas"></span></label>
|
||||
@@ -83,7 +83,7 @@
|
||||
category: 'storage-output',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
filename: {value:""},
|
||||
filename: {value:"",format:"filepath"},
|
||||
appendNewline: {value:true},
|
||||
createDir: {value:false},
|
||||
overwriteFile: {value:"false"}
|
||||
@@ -115,7 +115,7 @@
|
||||
category: 'storage-input',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
filename: {value:""},
|
||||
filename: {value:"",format:"filepath"},
|
||||
format: {value:"utf8"},
|
||||
},
|
||||
color:"BurlyWood",
|
||||
|
Reference in New Issue
Block a user