@gregoriusrippenstein/node-red-contrib-introspection 0.6.1 → 0.6.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/README.md +16 -4
- package/examples/obfuscation.json +411 -0
- package/nodes/60-client-code.js +28 -27
- package/package.json +1 -1
- package/plugins/sidebar.html +49 -1
package/README.md
CHANGED
|
@@ -49,6 +49,22 @@ Disappointments:
|
|
|
49
49
|
|
|
50
50
|
Clicking on a node will highlight that node in the workspace. The nodes shown are across all flows and tabs.
|
|
51
51
|
|
|
52
|
+
### Link Calls & Undocumented
|
|
53
|
+
|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
The Link Calls button will highlight all *link call* nodes with a dot to indicate whether the link call is valid, i.e., there is an existing link-in node to which it links:
|
|
57
|
+
|
|
58
|
+

|
|
59
|
+
|
|
60
|
+
Clicking on the green dot will take the user to the corresponding link-in node which will then also be highlighted by a green dot. That dot brings the user back to the original link-call node.
|
|
61
|
+
|
|
62
|
+

|
|
63
|
+
|
|
64
|
+
The green dot on the link-in node brings the clickee back to the original link-call node (i.e. the first green dot clicked). Also, to remove the green dots, switch between flow tabs. It can be tried out in the [crash-test dummy Node-RED](https://cdn.flowhub.org/?fhid=c520d9da20ad7f1d&t=0&sb=Introspection).
|
|
65
|
+
|
|
66
|
+
The Undocumented button will highlight all nodes that *have* documentation with a yellow dot (think sun) and list all those node that don't have any documentation.
|
|
67
|
+
|
|
52
68
|
### Obfuscate
|
|
53
69
|
|
|
54
70
|

|
|
@@ -161,7 +177,3 @@ Please here at GitHub via issues.
|
|
|
161
177
|
- [GitHub Repository](https://github.com/gorenje/node-red-contrib-introspection)
|
|
162
178
|
- [Flow that maintains this package](https://flowhub.org/f/d73d76db3df96ba2)
|
|
163
179
|
- [Node-RED node package](https://flows.nodered.org/node/@gregoriusrippenstein/node-red-contrib-introspection)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "6fb884be0636fe23",
|
|
4
|
+
"type": "link in",
|
|
5
|
+
"z": "a8d0a74af83ab37c",
|
|
6
|
+
"name": "link in 5",
|
|
7
|
+
"links": [],
|
|
8
|
+
"x": 142,
|
|
9
|
+
"y": 751,
|
|
10
|
+
"wires": [
|
|
11
|
+
[
|
|
12
|
+
"124636494f252f9a",
|
|
13
|
+
"2349c1716c09d973"
|
|
14
|
+
]
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "124636494f252f9a",
|
|
19
|
+
"type": "function",
|
|
20
|
+
"z": "a8d0a74af83ab37c",
|
|
21
|
+
"name": "function 21",
|
|
22
|
+
"func": "\nreturn msg;",
|
|
23
|
+
"outputs": 1,
|
|
24
|
+
"timeout": 0,
|
|
25
|
+
"noerr": 0,
|
|
26
|
+
"initialize": "",
|
|
27
|
+
"finalize": "",
|
|
28
|
+
"libs": [],
|
|
29
|
+
"x": 452,
|
|
30
|
+
"y": 703,
|
|
31
|
+
"wires": [
|
|
32
|
+
[
|
|
33
|
+
"77d9823dfd334c66",
|
|
34
|
+
"af8b9e17146bcbc7"
|
|
35
|
+
]
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "2349c1716c09d973",
|
|
40
|
+
"type": "change",
|
|
41
|
+
"z": "a8d0a74af83ab37c",
|
|
42
|
+
"name": "",
|
|
43
|
+
"rules": [
|
|
44
|
+
{
|
|
45
|
+
"t": "set",
|
|
46
|
+
"p": "payload",
|
|
47
|
+
"pt": "msg",
|
|
48
|
+
"to": "",
|
|
49
|
+
"tot": "str"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"action": "",
|
|
53
|
+
"property": "",
|
|
54
|
+
"from": "",
|
|
55
|
+
"to": "",
|
|
56
|
+
"reg": false,
|
|
57
|
+
"x": 417,
|
|
58
|
+
"y": 870,
|
|
59
|
+
"wires": [
|
|
60
|
+
[
|
|
61
|
+
"96bc0eadf9074328"
|
|
62
|
+
]
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "197e3889afbe7565",
|
|
67
|
+
"type": "link out",
|
|
68
|
+
"z": "a8d0a74af83ab37c",
|
|
69
|
+
"name": "link out 130",
|
|
70
|
+
"mode": "return",
|
|
71
|
+
"links": [],
|
|
72
|
+
"x": 1014,
|
|
73
|
+
"y": 927,
|
|
74
|
+
"wires": []
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"id": "46ca59c96fe5df51",
|
|
78
|
+
"type": "link out",
|
|
79
|
+
"z": "a8d0a74af83ab37c",
|
|
80
|
+
"name": "link out 131",
|
|
81
|
+
"mode": "return",
|
|
82
|
+
"links": [],
|
|
83
|
+
"x": 1003,
|
|
84
|
+
"y": 1042,
|
|
85
|
+
"wires": []
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"id": "01ea48b2cf1732ba",
|
|
89
|
+
"type": "link out",
|
|
90
|
+
"z": "a8d0a74af83ab37c",
|
|
91
|
+
"name": "link out 132",
|
|
92
|
+
"mode": "return",
|
|
93
|
+
"links": [],
|
|
94
|
+
"x": 1104,
|
|
95
|
+
"y": 629,
|
|
96
|
+
"wires": []
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"id": "96bc0eadf9074328",
|
|
100
|
+
"type": "switch",
|
|
101
|
+
"z": "a8d0a74af83ab37c",
|
|
102
|
+
"name": "",
|
|
103
|
+
"property": "payload",
|
|
104
|
+
"propertyType": "msg",
|
|
105
|
+
"rules": [
|
|
106
|
+
{
|
|
107
|
+
"t": "eq",
|
|
108
|
+
"v": "",
|
|
109
|
+
"vt": "str"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"t": "eq",
|
|
113
|
+
"v": "",
|
|
114
|
+
"vt": "str"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"t": "eq",
|
|
118
|
+
"v": "",
|
|
119
|
+
"vt": "str"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"t": "eq",
|
|
123
|
+
"v": "",
|
|
124
|
+
"vt": "str"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"checkall": "true",
|
|
128
|
+
"repair": false,
|
|
129
|
+
"outputs": 4,
|
|
130
|
+
"x": 637,
|
|
131
|
+
"y": 960,
|
|
132
|
+
"wires": [
|
|
133
|
+
[
|
|
134
|
+
"197e3889afbe7565"
|
|
135
|
+
],
|
|
136
|
+
[
|
|
137
|
+
"46ca59c96fe5df51"
|
|
138
|
+
],
|
|
139
|
+
[],
|
|
140
|
+
[
|
|
141
|
+
"0910feac9ba83f3d"
|
|
142
|
+
]
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"id": "77d9823dfd334c66",
|
|
147
|
+
"type": "function",
|
|
148
|
+
"z": "a8d0a74af83ab37c",
|
|
149
|
+
"name": "function 22",
|
|
150
|
+
"func": "\nreturn msg;",
|
|
151
|
+
"outputs": 1,
|
|
152
|
+
"timeout": 0,
|
|
153
|
+
"noerr": 0,
|
|
154
|
+
"initialize": "",
|
|
155
|
+
"finalize": "",
|
|
156
|
+
"libs": [],
|
|
157
|
+
"x": 668,
|
|
158
|
+
"y": 771,
|
|
159
|
+
"wires": [
|
|
160
|
+
[
|
|
161
|
+
"01ea48b2cf1732ba",
|
|
162
|
+
"5d492ede56e00c66"
|
|
163
|
+
]
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"id": "af8b9e17146bcbc7",
|
|
168
|
+
"type": "function",
|
|
169
|
+
"z": "a8d0a74af83ab37c",
|
|
170
|
+
"name": "function 23",
|
|
171
|
+
"func": "\nreturn msg;",
|
|
172
|
+
"outputs": 1,
|
|
173
|
+
"timeout": 0,
|
|
174
|
+
"noerr": 0,
|
|
175
|
+
"initialize": "",
|
|
176
|
+
"finalize": "",
|
|
177
|
+
"libs": [],
|
|
178
|
+
"x": 728,
|
|
179
|
+
"y": 616,
|
|
180
|
+
"wires": [
|
|
181
|
+
[
|
|
182
|
+
"69bcb6d83acf8611"
|
|
183
|
+
]
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"id": "69bcb6d83acf8611",
|
|
188
|
+
"type": "debug",
|
|
189
|
+
"z": "a8d0a74af83ab37c",
|
|
190
|
+
"name": "debug 175",
|
|
191
|
+
"active": true,
|
|
192
|
+
"tosidebar": true,
|
|
193
|
+
"console": false,
|
|
194
|
+
"tostatus": false,
|
|
195
|
+
"complete": "false",
|
|
196
|
+
"statusVal": "",
|
|
197
|
+
"statusType": "auto",
|
|
198
|
+
"x": 996,
|
|
199
|
+
"y": 528,
|
|
200
|
+
"wires": []
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"id": "2e54dba4702eb253",
|
|
204
|
+
"type": "link call",
|
|
205
|
+
"z": "a8d0a74af83ab37c",
|
|
206
|
+
"name": "",
|
|
207
|
+
"links": [
|
|
208
|
+
"6fb884be0636fe23"
|
|
209
|
+
],
|
|
210
|
+
"linkType": "static",
|
|
211
|
+
"timeout": "30",
|
|
212
|
+
"x": 559,
|
|
213
|
+
"y": 246,
|
|
214
|
+
"wires": [
|
|
215
|
+
[
|
|
216
|
+
"a8497bc590bbe022"
|
|
217
|
+
]
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"id": "6a0be88182b9dc7d",
|
|
222
|
+
"type": "inject",
|
|
223
|
+
"z": "a8d0a74af83ab37c",
|
|
224
|
+
"name": "",
|
|
225
|
+
"props": [
|
|
226
|
+
{
|
|
227
|
+
"p": "payload"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"p": "topic",
|
|
231
|
+
"vt": "str"
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"repeat": "",
|
|
235
|
+
"crontab": "",
|
|
236
|
+
"once": false,
|
|
237
|
+
"onceDelay": 0.1,
|
|
238
|
+
"topic": "",
|
|
239
|
+
"payload": "",
|
|
240
|
+
"payloadType": "date",
|
|
241
|
+
"x": 422,
|
|
242
|
+
"y": 336,
|
|
243
|
+
"wires": [
|
|
244
|
+
[
|
|
245
|
+
"2e54dba4702eb253"
|
|
246
|
+
]
|
|
247
|
+
]
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"id": "be1edbcda597951b",
|
|
251
|
+
"type": "debug",
|
|
252
|
+
"z": "a8d0a74af83ab37c",
|
|
253
|
+
"name": "debug 176",
|
|
254
|
+
"active": true,
|
|
255
|
+
"tosidebar": true,
|
|
256
|
+
"console": false,
|
|
257
|
+
"tostatus": false,
|
|
258
|
+
"complete": "false",
|
|
259
|
+
"statusVal": "",
|
|
260
|
+
"statusType": "auto",
|
|
261
|
+
"x": 1233,
|
|
262
|
+
"y": 325,
|
|
263
|
+
"wires": []
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"id": "b8fabbb52343dc35",
|
|
267
|
+
"type": "link call",
|
|
268
|
+
"z": "a8d0a74af83ab37c",
|
|
269
|
+
"name": "",
|
|
270
|
+
"links": [
|
|
271
|
+
"6fb884be0636fe23"
|
|
272
|
+
],
|
|
273
|
+
"linkType": "static",
|
|
274
|
+
"timeout": "30",
|
|
275
|
+
"x": 838,
|
|
276
|
+
"y": 414,
|
|
277
|
+
"wires": [
|
|
278
|
+
[
|
|
279
|
+
"10fda304159e4487"
|
|
280
|
+
]
|
|
281
|
+
]
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"id": "5bfeda4e28f766ed",
|
|
285
|
+
"type": "link call",
|
|
286
|
+
"z": "a8d0a74af83ab37c",
|
|
287
|
+
"name": "",
|
|
288
|
+
"links": [
|
|
289
|
+
"6fb884be0636fe23"
|
|
290
|
+
],
|
|
291
|
+
"linkType": "static",
|
|
292
|
+
"timeout": "30",
|
|
293
|
+
"x": 1103,
|
|
294
|
+
"y": 237,
|
|
295
|
+
"wires": [
|
|
296
|
+
[
|
|
297
|
+
"be1edbcda597951b"
|
|
298
|
+
]
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"id": "5d492ede56e00c66",
|
|
303
|
+
"type": "function",
|
|
304
|
+
"z": "a8d0a74af83ab37c",
|
|
305
|
+
"name": "function 24",
|
|
306
|
+
"func": "\nreturn msg;",
|
|
307
|
+
"outputs": 1,
|
|
308
|
+
"timeout": 0,
|
|
309
|
+
"noerr": 0,
|
|
310
|
+
"initialize": "",
|
|
311
|
+
"finalize": "",
|
|
312
|
+
"libs": [],
|
|
313
|
+
"x": 1001,
|
|
314
|
+
"y": 785,
|
|
315
|
+
"wires": [
|
|
316
|
+
[
|
|
317
|
+
"cd6c6e404bb86358"
|
|
318
|
+
]
|
|
319
|
+
]
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"id": "cd6c6e404bb86358",
|
|
323
|
+
"type": "change",
|
|
324
|
+
"z": "a8d0a74af83ab37c",
|
|
325
|
+
"name": "",
|
|
326
|
+
"rules": [
|
|
327
|
+
{
|
|
328
|
+
"t": "set",
|
|
329
|
+
"p": "payload",
|
|
330
|
+
"pt": "msg",
|
|
331
|
+
"to": "",
|
|
332
|
+
"tot": "str"
|
|
333
|
+
}
|
|
334
|
+
],
|
|
335
|
+
"action": "",
|
|
336
|
+
"property": "",
|
|
337
|
+
"from": "",
|
|
338
|
+
"to": "",
|
|
339
|
+
"reg": false,
|
|
340
|
+
"x": 1262,
|
|
341
|
+
"y": 695,
|
|
342
|
+
"wires": [
|
|
343
|
+
[]
|
|
344
|
+
]
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"id": "0910feac9ba83f3d",
|
|
348
|
+
"type": "change",
|
|
349
|
+
"z": "a8d0a74af83ab37c",
|
|
350
|
+
"name": "",
|
|
351
|
+
"rules": [
|
|
352
|
+
{
|
|
353
|
+
"t": "set",
|
|
354
|
+
"p": "payload",
|
|
355
|
+
"pt": "msg",
|
|
356
|
+
"to": "",
|
|
357
|
+
"tot": "str"
|
|
358
|
+
}
|
|
359
|
+
],
|
|
360
|
+
"action": "",
|
|
361
|
+
"property": "",
|
|
362
|
+
"from": "",
|
|
363
|
+
"to": "",
|
|
364
|
+
"reg": false,
|
|
365
|
+
"x": 916,
|
|
366
|
+
"y": 1154,
|
|
367
|
+
"wires": [
|
|
368
|
+
[]
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"id": "a8497bc590bbe022",
|
|
373
|
+
"type": "function",
|
|
374
|
+
"z": "a8d0a74af83ab37c",
|
|
375
|
+
"name": "function 25",
|
|
376
|
+
"func": "\nreturn msg;",
|
|
377
|
+
"outputs": 1,
|
|
378
|
+
"timeout": 0,
|
|
379
|
+
"noerr": 0,
|
|
380
|
+
"initialize": "",
|
|
381
|
+
"finalize": "",
|
|
382
|
+
"libs": [],
|
|
383
|
+
"x": 721,
|
|
384
|
+
"y": 327,
|
|
385
|
+
"wires": [
|
|
386
|
+
[
|
|
387
|
+
"b8fabbb52343dc35"
|
|
388
|
+
]
|
|
389
|
+
]
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"id": "10fda304159e4487",
|
|
393
|
+
"type": "function",
|
|
394
|
+
"z": "a8d0a74af83ab37c",
|
|
395
|
+
"name": "function 26",
|
|
396
|
+
"func": "\nreturn msg;",
|
|
397
|
+
"outputs": 1,
|
|
398
|
+
"timeout": 0,
|
|
399
|
+
"noerr": 0,
|
|
400
|
+
"initialize": "",
|
|
401
|
+
"finalize": "",
|
|
402
|
+
"libs": [],
|
|
403
|
+
"x": 955,
|
|
404
|
+
"y": 327,
|
|
405
|
+
"wires": [
|
|
406
|
+
[
|
|
407
|
+
"5bfeda4e28f766ed"
|
|
408
|
+
]
|
|
409
|
+
]
|
|
410
|
+
}
|
|
411
|
+
]
|
package/nodes/60-client-code.js
CHANGED
|
@@ -74,38 +74,39 @@ module.exports = function(RED) {
|
|
|
74
74
|
RED.httpAdmin.post("/ClientCode/:id/ugify",
|
|
75
75
|
RED.auth.needsPermission("ClientCode.write"),
|
|
76
76
|
(req, res) => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (req.body ) {
|
|
81
|
-
req.body.nodes.forEach( n => {
|
|
77
|
+
try {
|
|
78
|
+
if (req.body ) {
|
|
79
|
+
req.body.nodes.forEach( n => {
|
|
82
80
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
if ( n.format == "javascript") {
|
|
82
|
+
/* this handles PkgFile nodes and template nodes */
|
|
83
|
+
let result = UglifyJS.minify(n.template, req.body.cfg)
|
|
84
|
+
if ( result.code && !result.error) {
|
|
85
|
+
n.template = result.code
|
|
86
|
+
} else {
|
|
87
|
+
n._error = result.error
|
|
88
|
+
n._code = result.code
|
|
89
89
|
}
|
|
90
|
+
}
|
|
90
91
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
if (n.type == "function") {
|
|
93
|
+
let result = UglifyJS.minify(n.func, req.body.cfg)
|
|
94
|
+
if (result.code && !result.error) {
|
|
95
|
+
n.func = result.code
|
|
96
|
+
} else {
|
|
97
|
+
n._error = result.error
|
|
98
|
+
n._code = result.code
|
|
96
99
|
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
} catch (err) {
|
|
103
|
-
res.sendStatus(500);
|
|
104
|
-
node.error("ClientCode: Submission failed: " +
|
|
105
|
-
err.toString())
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
res.status(200).send(req.body.nodes);
|
|
103
|
+
} else {
|
|
104
|
+
res.sendStatus(404);
|
|
106
105
|
}
|
|
107
|
-
}
|
|
108
|
-
res.sendStatus(
|
|
106
|
+
} catch (err) {
|
|
107
|
+
res.sendStatus(500);
|
|
108
|
+
node.error("ClientCode: Submission failed: " +
|
|
109
|
+
err.toString())
|
|
109
110
|
}
|
|
110
111
|
});
|
|
111
112
|
|
package/package.json
CHANGED
package/plugins/sidebar.html
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
(function() {
|
|
3
3
|
var globalRefToSvgData;
|
|
4
4
|
|
|
5
|
-
let obfuscateHelpers={getFlowDataFromCurrentWorkspace:e=>{var e=e||RED.workspaces.active(),
|
|
5
|
+
let obfuscateHelpers={getFlowDataFromCurrentWorkspace:e=>{var e=e||RED.workspaces.active(),t=RED.nodes.groups(e),e=(t=(t=t.concat(RED.nodes.junctions(e))).concat(RED.nodes.filterNodes({z:e})),RED.nodes.eachConfig(function(e){e.z===RED.workspaces.active()&&!1===e._def.hasUsers&&t.push(e)}),RED.nodes.workspace(e)||RED.nodes.subflow(e));return t.unshift(e),RED.nodes.createExportableNodeSet(t)},openImportDialog:e=>{RED.clipboard.import();let t=e;setTimeout(()=>{$("#red-ui-clipboard-dialog-import-text").val(JSON.stringify(t)).trigger("paste")},300)}};function obfuscatieCurrentFlow(t){let c=obfuscateHelpers.getFlowDataFromCurrentWorkspace(),u=(t.remove_groups&&(c=c.filter(e=>"group"!=e.type)).forEach(e=>{delete e.g}),{}),r=[],s={},d={},o={},i=[],a={};if(c.forEach(e=>{"subflow"==(u[e.id]=e).type&&(a[e.id]=e),"junction"==e.type&&(s[e.id]=e),"link out"==e.type&&(o[e.id]=e),"link in"==e.type&&(d[e.id]=e),"link call"==e.type&&i.push(e.id),!t.javascript||"javascript"!=e.format&&"function"!=e.type||r.push(e)}),t.remove_junctions&&(Object.keys(s).forEach(o=>{let i=s[o];a[i.z]||c.forEach(t=>{for(let e=0;e<(t.wires||[]).length;e++){var r=t.wires[e].indexOf(o);-1<r&&(t.wires[e].splice(r,1),t.wires[e].push(...i.wires[0]))}})}),c=c.filter(e=>!("junction"==e.type&&!a[e.z]))),t.remove_linknodes){let r=[],l=(Object.keys(o).forEach(i=>{var e=o[i],t=e.links||[];t.reduce((e,t)=>e&&!!d[t],!0)&&"return"!=e.mode&&(r.push(i),t.forEach(o=>{d[o]&&c.forEach(t=>{for(let e=0;e<(t.wires||[]).length;e++){var r=t.wires[e].indexOf(i);-1<r&&(t.wires[e].splice(r,1),t.wires[e].push(...d[o].wires[0]))}})}))}),(o,e)=>{let t=[],i=[],r=[];function n(e){if(r.indexOf(e.id)<0)if(r.push(e.id),t.push(e),"link out"===e.type){if("return"!=e.mode)throw"not handable"}else RED.nodes.getNodeLinks(e).forEach(function(e){n(e.target)})}try{RED.nodes.getNodeLinks(e).forEach(function(e){n(e.target),i.push(e.target.id)});let r={};var s=t.map(e=>{var t={...u[e.id]};return t.id=RED.nodes.id(),t.x=o.x,t.y=o.y,r[e.id]=t});return s.forEach(e=>{e.wires&&(e.wires=e.wires.map(e=>e.map(e=>{var t=r[e];return"link out"==t.type?[...o.wires[0],(t||{}).id||e]:(t||{}).id||e}).flat()))}),{nodes:s.filter(e=>"link out"!=e.type),entryNodes:i.map(e=>r[e])}}catch(e){return console.log(e),!1}}),t=[],p=[];i.forEach(n=>{let s=u[n],a=d[s.links[0]];a&&l(s,a)&&(t.push(s.id),c.forEach(t=>{for(let e=0;e<(t.wires||[]).length;e++){var r,o,i=t.wires[e].indexOf(n);-1<i&&(o=(r=l(s,a)).entryNodes.map(e=>e.id),t.wires[e].splice(i,1),t.wires[e].push(...o),p.push(...r.nodes))}}))}),(c=c.filter(e=>r.indexOf(e.id)<0&&t.indexOf(e.id)<0)).push(...p)}var e;c.forEach(e=>{t.name&&(e.name=e.id),t.info&&(e.info="",delete e.outputLabels,delete e.inputLabels),t.position&&(e.x=150,e.y=150),t.remove_icons&&delete e.icon}),0<r.length?(e={parse:{},compress:{},mangle:{reserved:["$","export","require"]},output:null,sourceMap:null,nameCache:null,toplevel:!1,warnings:!1},$.ajax({url:"ClientCode/"+RED.nodes.id()+"/ugify",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({nodes:r,cfg:e}),success:function(e){e.forEach(e=>{var t=u[e.id];"function"==t.type?t.func=e.func:"javascript"==t.format&&(t.template=e.template)}),obfuscateHelpers.openImportDialog(c)},error:function(e,t,r){RED.notify("ClientCode Communcation Failure: "+n.id+": "+t,{type:"error",timeout:3e3})}})):obfuscateHelpers.openImportDialog(c)}
|
|
6
6
|
|
|
7
7
|
function setupTreelist(){var e=collectOrphans();if(0==e.length){RED.notify("No Orphans Found",{type:"warning",timeout:2e3});try{$("#node-input-orphan-target-container-div").treeList("empty")}catch(e){}}else{try{$("#node-input-orphan-target-container-div").treeList("empty")}catch(e){$("#node-input-orphan-target-container-div").css({width:"100%",height:"calc(100%)"}).treeList({multi:!1}).on("treelistitemmouseover",function(e,t){}).on("treelistitemmouseout",function(e,t){}).on("treelistselect",function(e,t){t.node&&(RED.workspaces.show(t.node.z,!1,!1,!0),RED.view.reveal(t.node.id,!0),RED.view.redraw())}).on("treelistconfirm",function(e,t){var n;t.node&&(n=t.node.id,setTimeout(()=>{var e=RED.nodes.node(n);e&&(RED.view.reveal(e.id),RED.view.select(e.id),RED.editor.edit(e)),n==RED.workspaces.active()&&RED.workspaces.edit()},50))}),$("#node-input-orphan-target-filter").show();var n=$("#node-input-orphan-target-filter").searchBox({style:"compact",delay:300,change:function(){var e,t=$(this).val().trim().toLowerCase();""===t?($("#node-input-orphan-target-container-div").treeList("filter",null),n.searchBox("count","")):(e=$("#node-input-orphan-target-container-div").treeList("filter",function(e){return-1<e.label.toLowerCase().indexOf(t)||-1<e.node.type.toLowerCase().indexOf(t)}),n.searchBox("count",e+" / "+$("#node-input-orphan-target-container-div").treeList("data").length))}})}$("#node-input-orphan-target-container-div").treeList("data",e.sort((e,t)=>e.node.z>t.node.z))}}function collectOrphans(){const t=new Set;var n=[],i=(RED.nodes.eachLink(e=>{t.add(e.source),t.add(e.target)}),RED.nodes.eachNode(e=>{t.has(e)||n.push(e)}),[]),r={};return n.forEach(function(e){var t=RED.nodes.getType(e.type);if(t){var n=t.label,n=("function"==typeof n?n.call(e):n)||"",o=e.type;if(0===o.indexOf("subflow:"))return}t&&n||(n=e.type),r[e.id]={node:e,label:n,sublabel:o,selected:!1,checkbox:!1},i.push(r[e.id])}),i}
|
|
8
8
|
|
|
@@ -66,7 +66,11 @@
|
|
|
66
66
|
name: $('#node-input-obfuscate-name').is(":checked"),
|
|
67
67
|
info: $('#node-input-obfuscate-info').is(":checked"),
|
|
68
68
|
position: $('#node-input-obfuscate-position').is(":checked"),
|
|
69
|
+
remove_groups: $('#node-input-obfuscate-remove-groups').is(":checked"),
|
|
69
70
|
javascript: $('#node-input-obfuscate-javascript').is(":checked"),
|
|
71
|
+
remove_junctions: $('#node-input-obfuscate-remove-junctions').is(":checked"),
|
|
72
|
+
remove_linknodes: $('#node-input-obfuscate-remove-linknodes').is(":checked"),
|
|
73
|
+
remove_icons: $('#node-input-obfuscate-remove-icons').is(":checked"),
|
|
70
74
|
})
|
|
71
75
|
})
|
|
72
76
|
|
|
@@ -115,6 +119,8 @@
|
|
|
115
119
|
setupTreelistInfoness();
|
|
116
120
|
})
|
|
117
121
|
|
|
122
|
+
RED.actions.add( "introspection:show-link-call-links", highlightAllLinkCalls)
|
|
123
|
+
|
|
118
124
|
$('#node-input-linkcalls-find-btn').on('click', (e) => {
|
|
119
125
|
if ( e ) { e.preventDefault() }
|
|
120
126
|
highlightAllLinkCalls()
|
|
@@ -209,6 +215,16 @@
|
|
|
209
215
|
<input type="checkbox" checked=checked id="node-input-obfuscate-name"
|
|
210
216
|
style="display:inline-block; width:15px; vertical-align:baseline;">
|
|
211
217
|
</div>
|
|
218
|
+
|
|
219
|
+
<div class="form-row col-100">
|
|
220
|
+
<label for="node-input-obfuscate-remove-icons" class="w-30">
|
|
221
|
+
<i class="fa fa-tag"></i>
|
|
222
|
+
<span>Remove Icon?</span>
|
|
223
|
+
</label>
|
|
224
|
+
<input type="checkbox" checked=checked id="node-input-obfuscate-remove-icons"
|
|
225
|
+
style="display:inline-block; width:15px; vertical-align:baseline;">
|
|
226
|
+
</div>
|
|
227
|
+
|
|
212
228
|
<div class="form-row">
|
|
213
229
|
<label for="node-input-obfuscate-position" class="w-30">
|
|
214
230
|
<i class="fa fa-map-pin"></i>
|
|
@@ -225,6 +241,16 @@
|
|
|
225
241
|
<input type="checkbox" checked=checked id="node-input-obfuscate-info"
|
|
226
242
|
style="display:inline-block; width:15px; vertical-align:baseline;">
|
|
227
243
|
</div>
|
|
244
|
+
|
|
245
|
+
<div class="form-row">
|
|
246
|
+
<label for="node-input-obfuscate-remove-groups" class="w-30">
|
|
247
|
+
<i class="fa fa-info"></i>
|
|
248
|
+
<span>Remove Groups?</span>
|
|
249
|
+
</label>
|
|
250
|
+
<input type="checkbox" checked=checked id="node-input-obfuscate-remove-groups"
|
|
251
|
+
style="display:inline-block; width:15px; vertical-align:baseline;">
|
|
252
|
+
</div>
|
|
253
|
+
|
|
228
254
|
<div class="form-row">
|
|
229
255
|
<label for="node-input-obfuscate-javascript" class="w-30">
|
|
230
256
|
<i class="fa fa-code"></i>
|
|
@@ -233,6 +259,28 @@
|
|
|
233
259
|
<input type="checkbox" checked=checked id="node-input-obfuscate-javascript"
|
|
234
260
|
style="display:inline-block; width:15px; vertical-align:baseline;">
|
|
235
261
|
</div>
|
|
262
|
+
<div class="form-row">
|
|
263
|
+
<label for="node-input-obfuscate-remove-junctions" class="w-30">
|
|
264
|
+
<i class="fa fa-sitemap"></i>
|
|
265
|
+
<span>Remove Junctions?</span>
|
|
266
|
+
</label>
|
|
267
|
+
<input type="checkbox" checked=checked id="node-input-obfuscate-remove-junctions"
|
|
268
|
+
style="display:inline-block; width:15px; vertical-align:baseline;">
|
|
269
|
+
</div>
|
|
270
|
+
|
|
271
|
+
<div class="form-row">
|
|
272
|
+
<label for="node-input-obfuscate-remove-linknodes" class="w-30">
|
|
273
|
+
<i class="fa fa-link"></i>
|
|
274
|
+
<span>Remove Link Nodes?</span>
|
|
275
|
+
</label>
|
|
276
|
+
<input type="checkbox" checked=checked id="node-input-obfuscate-remove-linknodes"
|
|
277
|
+
style="display:inline-block; width:15px; vertical-align:baseline;">
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
<div class="form-row" style="margin-left: 10px">
|
|
281
|
+
<b>Warning</b>: No guarantee is made that the obfuscated flow still works. This has not be
|
|
282
|
+
thoroughly tested or promises to fulfil any purpose - good or bad.
|
|
283
|
+
</div>
|
|
236
284
|
</div>
|
|
237
285
|
|
|
238
286
|
</script>
|