@node-red/nodes 2.1.0-beta.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/common/20-inject.html +7 -4
- package/core/common/60-link.html +2 -2
- package/core/function/10-switch.html +32 -60
- package/core/function/15-change.html +16 -27
- package/core/network/10-mqtt.js +1 -1
- package/core/network/31-tcpin.html +12 -0
- package/core/network/31-tcpin.js +21 -4
- package/package.json +1 -1
- package/icons/link-call-arrow-up.svg +0 -5
- package/icons/link-return-arrow-down.svg +0 -5
|
@@ -539,12 +539,10 @@
|
|
|
539
539
|
var propertyValue = $('<input/>',{class:"node-input-prop-property-value",type:"text"})
|
|
540
540
|
.css("width","calc(70% - 30px)")
|
|
541
541
|
.appendTo(row)
|
|
542
|
-
.typedInput({default:'str',types:['flow','global','str','num','bool','json','bin','date','jsonata','env','msg']});
|
|
542
|
+
.typedInput({default:prop.vt || 'str',types:['flow','global','str','num','bool','json','bin','date','jsonata','env','msg']});
|
|
543
543
|
|
|
544
544
|
propertyName.typedInput('value',prop.p);
|
|
545
|
-
|
|
546
545
|
propertyValue.typedInput('value',prop.v);
|
|
547
|
-
propertyValue.typedInput('type',prop.vt);
|
|
548
546
|
},
|
|
549
547
|
removable: true,
|
|
550
548
|
sortable: true
|
|
@@ -564,7 +562,7 @@
|
|
|
564
562
|
var topic = {
|
|
565
563
|
p:'topic',
|
|
566
564
|
v: node.topic ? node.topic : '',
|
|
567
|
-
vt:'
|
|
565
|
+
vt:'str'
|
|
568
566
|
}
|
|
569
567
|
node.props = [payload,topic];
|
|
570
568
|
}
|
|
@@ -580,6 +578,11 @@
|
|
|
580
578
|
newProp.v = node.topic ? node.topic : '';
|
|
581
579
|
}
|
|
582
580
|
}
|
|
581
|
+
if (newProp.vt === "string") {
|
|
582
|
+
// Fix bug in pre 2.1 where an old Inject node might have
|
|
583
|
+
// a migrated rule with type 'string' not 'str'
|
|
584
|
+
newProp.vt = "str";
|
|
585
|
+
}
|
|
583
586
|
eList.editableList('addItem',newProp);
|
|
584
587
|
}
|
|
585
588
|
|
package/core/common/60-link.html
CHANGED
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
treeList = $("<div>")
|
|
53
53
|
.css({width: "100%", height: "100%"})
|
|
54
54
|
.appendTo(".node-input-link-row")
|
|
55
|
-
.treeList({})
|
|
55
|
+
.treeList({autoSelect:false})
|
|
56
56
|
.on('treelistitemmouseover',function(e,item) {
|
|
57
57
|
if (item.node) {
|
|
58
58
|
item.node.highlighted = true;
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
function onEditSave(node) {
|
|
158
158
|
var flows = treeList.treeList('data');
|
|
159
159
|
node.links = [];
|
|
160
|
-
if (node.type !== "link out" || $("node-input-mode").val() === 'link') {
|
|
160
|
+
if (node.type !== "link out" || $("#node-input-mode").val() === 'link') {
|
|
161
161
|
flows.forEach(function(f) {
|
|
162
162
|
f.children.forEach(function(n) {
|
|
163
163
|
if (n.selected) {
|
|
@@ -117,30 +117,35 @@
|
|
|
117
117
|
return r;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
function createValueField(row){
|
|
121
|
-
return $('<input/>',{class:"node-input-rule-value",type:"text",style:"width: 100%;"}).appendTo(row)
|
|
120
|
+
function createValueField(row, defaultType){
|
|
121
|
+
return $('<input/>',{class:"node-input-rule-value",type:"text",style:"width: 100%;"}).appendTo(row)
|
|
122
|
+
.typedInput({default:defaultType||'str',types:['msg','flow','global','str','num','jsonata','env',previousValueType]});
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
function createNumValueField(row){
|
|
125
|
-
return $('<input/>',{class:"node-input-rule-num-value",type:"text",style:"width: 100%;"}).appendTo(row)
|
|
125
|
+
function createNumValueField(row, defaultType){
|
|
126
|
+
return $('<input/>',{class:"node-input-rule-num-value",type:"text",style:"width: 100%;"}).appendTo(row)
|
|
127
|
+
.typedInput({default:defaultType||'num',types:['flow','global','num','jsonata','env']});
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
function createExpValueField(row){
|
|
129
|
-
return $('<input/>',{class:"node-input-rule-exp-value",type:"text",style:"width: 100%;"}).appendTo(row)
|
|
131
|
+
return $('<input/>',{class:"node-input-rule-exp-value",type:"text",style:"width: 100%;"}).appendTo(row)
|
|
132
|
+
.typedInput({default:'jsonata',types:['jsonata']});
|
|
130
133
|
}
|
|
131
134
|
|
|
132
|
-
function createBtwnValueField(row){
|
|
133
|
-
return $('<input/>',{class:"node-input-rule-btwn-value",type:"text",style:"width: 100%;"}).appendTo(row)
|
|
135
|
+
function createBtwnValueField(row, defaultType){
|
|
136
|
+
return $('<input/>',{class:"node-input-rule-btwn-value",type:"text",style:"width: 100%;"}).appendTo(row)
|
|
137
|
+
.typedInput({default:defaultType||'num',types:['msg','flow','global','str','num','jsonata','env',previousValueType]});
|
|
134
138
|
}
|
|
135
139
|
|
|
136
|
-
function createBtwnValue2Field(row3, andLabel){
|
|
140
|
+
function createBtwnValue2Field(row3, andLabel, defaultType){
|
|
137
141
|
$('<div/>',{class:"node-input-rule-btwn-label", style:"width: 120px; text-align: right;"}).text(" "+andLabel+" ").appendTo(row3);
|
|
138
142
|
var row3InputCell = $('<div/>',{style:"flex-grow:1; margin-left: 5px;"}).appendTo(row3);
|
|
139
|
-
return $('<input/>',{class:"node-input-rule-btwn-value2",type:"text",style:"width: 100%"}).appendTo(row3InputCell)
|
|
143
|
+
return $('<input/>',{class:"node-input-rule-btwn-value2",type:"text",style:"width: 100%"}).appendTo(row3InputCell)
|
|
144
|
+
.typedInput({default:defaultType||'num',types:['msg','flow','global','str','num','jsonata','env',previousValueType]});
|
|
140
145
|
}
|
|
141
146
|
|
|
142
|
-
function createTypeValueField(){
|
|
143
|
-
return $('<input/>',{class:"node-input-rule-type-value",type:"text",style:"width: 100%;"}).appendTo(row).typedInput({default:'string',types:[
|
|
147
|
+
function createTypeValueField(row, defaultType){
|
|
148
|
+
return $('<input/>',{class:"node-input-rule-type-value",type:"text",style:"width: 100%;"}).appendTo(row).typedInput({default:defaultType || 'string',types:[
|
|
144
149
|
{value:"string",label:RED._("common.type.string"),hasValue:false,icon:"red/images/typedInput/az.png"},
|
|
145
150
|
{value:"number",label:RED._("common.type.number"),hasValue:false,icon:"red/images/typedInput/09.png"},
|
|
146
151
|
{value:"boolean",label:RED._("common.type.boolean"),hasValue:false,icon:"red/images/typedInput/bool.png"},
|
|
@@ -211,6 +216,7 @@
|
|
|
211
216
|
var lastRule = $("#node-input-rule-container").editableList('getItemAt',i-1);
|
|
212
217
|
var exportedRule = exportRule(lastRule.element);
|
|
213
218
|
opt.r.vt = exportedRule.vt;
|
|
219
|
+
opt.r.v = "";
|
|
214
220
|
// We could copy the value over as well and preselect it (see the 'activeElement' code below)
|
|
215
221
|
// But not sure that feels right. Is copying over the last value 'expected' behaviour?
|
|
216
222
|
// It would make sense for an explicit 'copy' action, but not sure where the copy button would
|
|
@@ -278,24 +284,12 @@
|
|
|
278
284
|
selectField.on("change", function() {
|
|
279
285
|
var fieldToFocus;
|
|
280
286
|
var type = selectField.val();
|
|
281
|
-
if (valueField){
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
if (
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
if (numValueField){
|
|
288
|
-
numValueField.typedInput('hide');
|
|
289
|
-
}
|
|
290
|
-
if (typeValueField){
|
|
291
|
-
typeValueField.typedInput('hide');
|
|
292
|
-
}
|
|
293
|
-
if (btwnValueField){
|
|
294
|
-
btwnValueField.typedInput('hide');
|
|
295
|
-
}
|
|
296
|
-
if (btwnValue2Field){
|
|
297
|
-
btwnValue2Field.typedInput('hide');
|
|
298
|
-
}
|
|
287
|
+
if (valueField) { valueField.typedInput('hide'); }
|
|
288
|
+
if (expValueField) { expValueField.typedInput('hide'); }
|
|
289
|
+
if (numValueField) { numValueField.typedInput('hide'); }
|
|
290
|
+
if (typeValueField) { typeValueField.typedInput('hide'); }
|
|
291
|
+
if (btwnValueField) { btwnValueField.typedInput('hide'); }
|
|
292
|
+
if (btwnValue2Field) { btwnValue2Field.typedInput('hide'); }
|
|
299
293
|
|
|
300
294
|
if ((type === "btwn") || (type === "index")) {
|
|
301
295
|
if (!btwnValueField){
|
|
@@ -318,7 +312,7 @@
|
|
|
318
312
|
|
|
319
313
|
} else if (type === "istype") {
|
|
320
314
|
if (!typeValueField){
|
|
321
|
-
typeValueField = createTypeValueField();
|
|
315
|
+
typeValueField = createTypeValueField(rowInputCell);
|
|
322
316
|
}
|
|
323
317
|
typeValueField.typedInput('show');
|
|
324
318
|
fieldToFocus = typeValueField;
|
|
@@ -361,48 +355,26 @@
|
|
|
361
355
|
// }
|
|
362
356
|
});
|
|
363
357
|
selectField.val(rule.t);
|
|
358
|
+
|
|
364
359
|
if ((rule.t == "btwn") || (rule.t == "index")) {
|
|
365
|
-
|
|
366
|
-
btwnValueField = createBtwnValueField(rowInputCell);
|
|
367
|
-
}
|
|
360
|
+
btwnValueField = createBtwnValueField(rowInputCell,rule.vt||'num');
|
|
368
361
|
btwnValueField.typedInput('value',rule.v);
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
if (!btwnValue2Field){
|
|
372
|
-
btwnValue2Field = createBtwnValue2Field(row3, andLabel);
|
|
373
|
-
}
|
|
362
|
+
btwnValue2Field = createBtwnValue2Field(row3, andLabel,rule.v2t||'num');
|
|
374
363
|
btwnValue2Field.typedInput('value',rule.v2);
|
|
375
|
-
btwnValue2Field.typedInput('type',rule.v2t||'num');
|
|
376
364
|
} else if ((rule.t === "head") || (rule.t === "tail")) {
|
|
377
|
-
|
|
378
|
-
numValueField = createNumValueField(row);
|
|
379
|
-
}
|
|
365
|
+
numValueField = createNumValueField(rowInputCell,rule.vt||'num');
|
|
380
366
|
numValueField.typedInput('value',rule.v);
|
|
381
|
-
numValueField.typedInput('type',rule.vt||'num');
|
|
382
367
|
} else if (rule.t === "istype") {
|
|
383
|
-
|
|
384
|
-
typeValueField =createTypeValueField();
|
|
385
|
-
}
|
|
368
|
+
typeValueField = createTypeValueField(rowInputCell,rule.vt);
|
|
386
369
|
typeValueField.typedInput('value',rule.vt);
|
|
387
|
-
typeValueField.typedInput('type',rule.vt);
|
|
388
370
|
} else if (rule.t === "jsonata_exp") {
|
|
389
|
-
|
|
390
|
-
expValueField = createExpValueField(row);
|
|
391
|
-
}
|
|
371
|
+
expValueField = createExpValueField(rowInputCell,rule.vt||'jsonata');
|
|
392
372
|
expValueField.typedInput('value',rule.v);
|
|
393
|
-
expValueField.typedInput('type',rule.vt||'jsonata');
|
|
394
373
|
} else if (typeof rule.v != "undefined") {
|
|
395
|
-
|
|
396
|
-
valueField = createValueField(rowInputCell);
|
|
397
|
-
}
|
|
374
|
+
valueField = createValueField(rowInputCell,rule.vt||'str');
|
|
398
375
|
valueField.typedInput('value',rule.v);
|
|
399
|
-
valueField.typedInput('type',rule.vt||'str');
|
|
400
|
-
}
|
|
401
|
-
if (rule.case) {
|
|
402
|
-
caseSensitive.prop('checked',true);
|
|
403
|
-
} else {
|
|
404
|
-
caseSensitive.prop('checked',false);
|
|
405
376
|
}
|
|
377
|
+
caseSensitive.prop('checked',!!rule.case);
|
|
406
378
|
selectField.change();
|
|
407
379
|
|
|
408
380
|
var currentOutputs = JSON.parse(outputCount.val()||"{}");
|
|
@@ -115,12 +115,12 @@
|
|
|
115
115
|
var regex = this._("change.label.regex");
|
|
116
116
|
var deepCopyLabel = this._("change.label.deepCopy");
|
|
117
117
|
|
|
118
|
-
function createPropertyValue(row2_1,row2_2) {
|
|
118
|
+
function createPropertyValue(row2_1, row2_2, defaultType) {
|
|
119
119
|
var propValInput = $('<input/>',{class:"node-input-rule-property-value",type:"text"})
|
|
120
120
|
.appendTo(row2_1)
|
|
121
|
-
.typedInput({default:'str',types:['msg','flow','global','str','num','bool','json','bin','date','jsonata','env']});
|
|
121
|
+
.typedInput({default:defaultType||'str',types:['msg','flow','global','str','num','bool','json','bin','date','jsonata','env']});
|
|
122
122
|
|
|
123
|
-
var dcLabel = $('<label style="padding-left: 130px;
|
|
123
|
+
var dcLabel = $('<label style="padding-left: 130px;"></label>').appendTo(row2_2);
|
|
124
124
|
var deepCopy = $('<input type="checkbox" class="node-input-rule-property-deepCopy" style="width: auto; margin: 0 6px 0 0">').appendTo(dcLabel)
|
|
125
125
|
$('<span>').text(deepCopyLabel).appendTo(dcLabel)
|
|
126
126
|
|
|
@@ -129,20 +129,20 @@
|
|
|
129
129
|
})
|
|
130
130
|
return [propValInput, deepCopy];
|
|
131
131
|
}
|
|
132
|
-
function createFromValue(row3_1) {
|
|
132
|
+
function createFromValue(row3_1, defaultType) {
|
|
133
133
|
return $('<input/>',{class:"node-input-rule-property-search-value",type:"text"})
|
|
134
134
|
.appendTo(row3_1)
|
|
135
|
-
.typedInput({default:'str',types:['msg','flow','global','str','re','num','bool','env']});
|
|
135
|
+
.typedInput({default:defaultType||'str',types:['msg','flow','global','str','re','num','bool','env']});
|
|
136
136
|
}
|
|
137
|
-
function createToValue(row3_2) {
|
|
137
|
+
function createToValue(row3_2, defaultType) {
|
|
138
138
|
return $('<input/>',{class:"node-input-rule-property-replace-value",type:"text"})
|
|
139
139
|
.appendTo(row3_2)
|
|
140
|
-
.typedInput({default:'str',types:['msg','flow','global','str','num','bool','json','bin','env']});
|
|
140
|
+
.typedInput({default:defaultType||'str',types:['msg','flow','global','str','num','bool','json','bin','env']});
|
|
141
141
|
}
|
|
142
|
-
function createMoveValue(row4) {
|
|
142
|
+
function createMoveValue(row4, defaultType) {
|
|
143
143
|
return $('<input/>',{class:"node-input-rule-property-move-value",type:"text"})
|
|
144
144
|
.appendTo(row4)
|
|
145
|
-
.typedInput({default:'msg',types:['msg','flow','global']});
|
|
145
|
+
.typedInput({default:defaultType||'msg',types:['msg','flow','global']});
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
$('#node-input-rule-container').css('min-height','150px').css('min-width','450px').editableList({
|
|
@@ -268,33 +268,22 @@
|
|
|
268
268
|
propertyName.typedInput('value',rule.p);
|
|
269
269
|
propertyName.typedInput('type',rule.pt);
|
|
270
270
|
if (rule.t == "set") {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
deepCopy = parts[1];
|
|
275
|
-
}
|
|
271
|
+
var parts = createPropertyValue(row2_1, row2_2, rule.tot);
|
|
272
|
+
propertyValue = parts[0];
|
|
273
|
+
deepCopy = parts[1];
|
|
276
274
|
propertyValue.typedInput('value',rule.to);
|
|
277
|
-
propertyValue.typedInput('type',rule.tot);
|
|
278
275
|
deepCopy.prop("checked", !!rule.dc);
|
|
279
276
|
}
|
|
280
277
|
if (rule.t == "move") {
|
|
281
|
-
|
|
282
|
-
moveValue = createMoveValue(row4);
|
|
283
|
-
}
|
|
278
|
+
moveValue = createMoveValue(row4,rule.tot);
|
|
284
279
|
moveValue.typedInput('value',rule.to);
|
|
285
|
-
moveValue.typedInput('type',rule.tot);
|
|
286
280
|
}
|
|
287
281
|
if (rule.t == "change") {
|
|
288
|
-
|
|
289
|
-
fromValue = createFromValue(row3_1);
|
|
290
|
-
}
|
|
282
|
+
fromValue = createFromValue(row3_1, rule.fromt);
|
|
291
283
|
fromValue.typedInput('value',rule.from);
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
toValue = createToValue(row3_2);
|
|
295
|
-
}
|
|
284
|
+
|
|
285
|
+
toValue = createToValue(row3_2,rule.tot);
|
|
296
286
|
toValue.typedInput('value',rule.to);
|
|
297
|
-
toValue.typedInput('type',rule.tot);
|
|
298
287
|
}
|
|
299
288
|
selectField.change();
|
|
300
289
|
container[0].appendChild(fragment);
|
package/core/network/10-mqtt.js
CHANGED
|
@@ -1040,7 +1040,7 @@ module.exports = function(RED) {
|
|
|
1040
1040
|
|
|
1041
1041
|
//subscribe to sub.topic & hook up subscriptionHandler
|
|
1042
1042
|
node.brokerConn.subscribe(sub.topic, options, function (topic, payload, packet) {
|
|
1043
|
-
subscriptionHandler(node, sub.datatype, topic, payload, packet);
|
|
1043
|
+
subscriptionHandler(node, sub.datatype || node.datatype, topic, payload, packet);
|
|
1044
1044
|
}, node.id);
|
|
1045
1045
|
node.dynamicSubs[sub.topic] = sub; //save for later unsubscription & 'list' action
|
|
1046
1046
|
})
|
|
@@ -196,6 +196,13 @@
|
|
|
196
196
|
</div>
|
|
197
197
|
<div class="form-row">
|
|
198
198
|
<label for="node-input-out"><i class="fa fa-sign-out"></i> <span data-i18n="tcpin.label.return"></span></label>
|
|
199
|
+
<select type="text" id="node-input-ret" style="width:54%;">
|
|
200
|
+
<option value="buffer" data-i18n="tcpin.output.buffer"></option>
|
|
201
|
+
<option value="string" data-i18n="tcpin.output.string"></option>
|
|
202
|
+
</select>
|
|
203
|
+
</div>
|
|
204
|
+
<div class="form-row">
|
|
205
|
+
<label for="node-input-out"> </label>
|
|
199
206
|
<select type="text" id="node-input-out" style="width:54%;">
|
|
200
207
|
<option value="time" data-i18n="tcpin.return.timeout"></option>
|
|
201
208
|
<option value="char" data-i18n="tcpin.return.character"></option>
|
|
@@ -220,6 +227,7 @@
|
|
|
220
227
|
server: {value:""},
|
|
221
228
|
port: {value:"",validate:RED.validators.regex(/^(\d*|)$/)},
|
|
222
229
|
out: {value:"time",required:true},
|
|
230
|
+
ret: {value:"buffer"},
|
|
223
231
|
splitc: {value:"0",required:true},
|
|
224
232
|
name: {value:""}
|
|
225
233
|
},
|
|
@@ -234,6 +242,10 @@
|
|
|
234
242
|
},
|
|
235
243
|
oneditprepare: function() {
|
|
236
244
|
var previous = null;
|
|
245
|
+
if ($("#node-input-ret").val() == undefined) {
|
|
246
|
+
$("#node-input-ret").val("buffer");
|
|
247
|
+
this.ret = "buffer";
|
|
248
|
+
}
|
|
237
249
|
$("#node-input-out").on('focus', function () { previous = this.value; }).on("change", function() {
|
|
238
250
|
$("#node-input-splitc").show();
|
|
239
251
|
if (previous === null) { previous = $("#node-input-out").val(); }
|
package/core/network/31-tcpin.js
CHANGED
|
@@ -311,7 +311,7 @@ module.exports = function(RED) {
|
|
|
311
311
|
}
|
|
312
312
|
setupTcpClient();
|
|
313
313
|
|
|
314
|
-
node.on("input", function(msg,nodeSend,nodeDone) {
|
|
314
|
+
node.on("input", function(msg, nodeSend, nodeDone) {
|
|
315
315
|
if (node.connected && msg.payload != null) {
|
|
316
316
|
if (Buffer.isBuffer(msg.payload)) {
|
|
317
317
|
client.write(msg.payload);
|
|
@@ -444,6 +444,7 @@ module.exports = function(RED) {
|
|
|
444
444
|
this.server = n.server;
|
|
445
445
|
this.port = Number(n.port);
|
|
446
446
|
this.out = n.out;
|
|
447
|
+
this.ret = n.ret || "buffer";
|
|
447
448
|
this.splitc = n.splitc;
|
|
448
449
|
|
|
449
450
|
if (this.out === "immed") { this.splitc = -1; this.out = "time"; }
|
|
@@ -488,7 +489,7 @@ module.exports = function(RED) {
|
|
|
488
489
|
connected: false,
|
|
489
490
|
connecting: false
|
|
490
491
|
};
|
|
491
|
-
enqueue(clients[connection_id].msgQueue, {msg:msg,nodeSend:nodeSend, nodeDone:
|
|
492
|
+
enqueue(clients[connection_id].msgQueue, {msg:msg, nodeSend:nodeSend, nodeDone:nodeDone});
|
|
492
493
|
clients[connection_id].lastMsg = msg;
|
|
493
494
|
|
|
494
495
|
if (!clients[connection_id].connecting && !clients[connection_id].connected) {
|
|
@@ -532,8 +533,12 @@ module.exports = function(RED) {
|
|
|
532
533
|
if (node.out === "sit") { // if we are staying connected just send the buffer
|
|
533
534
|
if (clients[connection_id]) {
|
|
534
535
|
const msg = clients[connection_id].lastMsg || {};
|
|
535
|
-
msg.payload = data;
|
|
536
|
-
|
|
536
|
+
msg.payload = RED.util.cloneMessage(data);
|
|
537
|
+
if (node.ret === "string") {
|
|
538
|
+
try { msg.payload = msg.payload.toString(); }
|
|
539
|
+
catch(e) { node.error("Failed to create string", msg); }
|
|
540
|
+
}
|
|
541
|
+
nodeSend(msg);
|
|
537
542
|
}
|
|
538
543
|
}
|
|
539
544
|
// else if (node.splitc === 0) {
|
|
@@ -556,6 +561,10 @@ module.exports = function(RED) {
|
|
|
556
561
|
const msg = clients[connection_id].lastMsg || {};
|
|
557
562
|
msg.payload = Buffer.alloc(i+1);
|
|
558
563
|
buf.copy(msg.payload,0,0,i+1);
|
|
564
|
+
if (node.ret === "string") {
|
|
565
|
+
try { msg.payload = msg.payload.toString(); }
|
|
566
|
+
catch(e) { node.error("Failed to create string", msg); }
|
|
567
|
+
}
|
|
559
568
|
nodeSend(msg);
|
|
560
569
|
if (clients[connection_id].client) {
|
|
561
570
|
node.status({});
|
|
@@ -578,6 +587,10 @@ module.exports = function(RED) {
|
|
|
578
587
|
const msg = clients[connection_id].lastMsg || {};
|
|
579
588
|
msg.payload = Buffer.alloc(i);
|
|
580
589
|
buf.copy(msg.payload,0,0,i);
|
|
590
|
+
if (node.ret === "string") {
|
|
591
|
+
try { msg.payload = msg.payload.toString(); }
|
|
592
|
+
catch(e) { node.error("Failed to create string", msg); }
|
|
593
|
+
}
|
|
581
594
|
nodeSend(msg);
|
|
582
595
|
if (clients[connection_id].client) {
|
|
583
596
|
node.status({});
|
|
@@ -597,6 +610,10 @@ module.exports = function(RED) {
|
|
|
597
610
|
const msg = clients[connection_id].lastMsg || {};
|
|
598
611
|
msg.payload = Buffer.alloc(i);
|
|
599
612
|
buf.copy(msg.payload,0,0,i);
|
|
613
|
+
if (node.ret === "string") {
|
|
614
|
+
try { msg.payload = msg.payload.toString(); }
|
|
615
|
+
catch(e) { node.error("Failed to create string", msg); }
|
|
616
|
+
}
|
|
600
617
|
nodeSend(msg);
|
|
601
618
|
if (clients[connection_id].client) {
|
|
602
619
|
node.status({});
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
-
<svg width="10.583mm" height="15.875mm" version="1.1" viewBox="0 0 10.583 15.875" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
-
<path d="m5.2917 1.8521-3.9688 2.9104h1.8521v2.0789c0.45142-0.69251 1.2323-1.1529 2.1167-1.1529 0.88347 0 1.6645 0.45944 2.1167 1.1508v-2.0769h1.8521zm0 4.7625c-0.8893 0-1.5994 0.71008-1.5994 1.5994 0 0.8893 0.71008 1.5999 1.5994 1.5999s1.6015-0.7106 1.6015-1.5999c0-0.8893-0.71215-1.5994-1.6015-1.5994zm-2.1167 2.9724 1e-7 3.6422h4.2333l-1e-7 -3.6401c-0.4522 0.69139-1.2332 1.1503-2.1167 1.1503-0.88433 0-1.6652-0.45988-2.1167-1.1524z" fill="#fff"/>
|
|
5
|
-
</svg>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
-
<svg width="10.583mm" height="15.875mm" version="1.1" viewBox="0 0 10.583 15.875" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
-
<path d="m5.2917 14.023-3.9688-2.9104h1.8521v-2.0789c0.45142 0.69251 1.2323 1.1529 2.1167 1.1529 0.88347 0 1.6645-0.45944 2.1167-1.1508v2.0769h1.8521zm0-4.7625c-0.8893 0-1.5994-0.71008-1.5994-1.5994 0-0.8893 0.71008-1.5999 1.5994-1.5999s1.6015 0.7106 1.6015 1.5999c0 0.8893-0.71215 1.5994-1.6015 1.5994zm-2.1167-2.9724 1e-7 -3.6422h4.2333l-1e-7 3.6401c-0.4522-0.69139-1.2332-1.1503-2.1167-1.1503-0.88433 0-1.6652 0.45988-2.1167 1.1524z" fill="#fff"/>
|
|
5
|
-
</svg>
|