diff --git a/nodes/nodes.json b/nodes/nodes.json index 9889b82..bf32d5f 100644 --- a/nodes/nodes.json +++ b/nodes/nodes.json @@ -888,7 +888,7 @@ "FlowHubPull" ], "user": false, - "version": "0.4.7" + "version": "0.4.8" }, { "enabled": true, @@ -900,7 +900,7 @@ "FlowHubCfg" ], "user": false, - "version": "0.4.7" + "version": "0.4.8" }, { "enabled": true, @@ -1415,7 +1415,7 @@ "Seeker" ], "user": false, - "version": "0.6.2" + "version": "0.6.3" }, { "enabled": true, @@ -1427,7 +1427,7 @@ "Sink" ], "user": false, - "version": "0.6.2" + "version": "0.6.3" }, { "enabled": true, @@ -1439,7 +1439,7 @@ "GetFlows" ], "user": false, - "version": "0.6.2" + "version": "0.6.3" }, { "enabled": true, @@ -1451,7 +1451,7 @@ "SendFlow" ], "user": false, - "version": "0.6.2" + "version": "0.6.3" }, { "enabled": true, @@ -1463,7 +1463,7 @@ "ClientCode" ], "user": false, - "version": "0.6.2" + "version": "0.6.3" }, { "enabled": true, diff --git a/plugins/plugins.html b/plugins/plugins.html index c9c263c..04c9766 100644 --- a/plugins/plugins.html +++ b/plugins/plugins.html @@ -6,7 +6,7 @@ function flowHubPullUpdateFlows(e=null){$.get("https://api.flowhub.org/v1/flows?cb="+(new Date).getTime()).done(o=>{var l=[];Object.keys(o.data).forEach(function(e){l.push({label:o.data[e].name,icon:"fa "+(RED.nodes.workspace(e)?"fa-check-circle-o":""),flowid:e,sublabel:e,selected:$("#node-input-flowhubpull-flowid").val()==e,checkbox:!1,children:void 0})}),e&&(l.sort((e,o)=>e.label{var o="",o="rejected"==e.state()?"

Failed to retrieve FlowHub catalogue, request blocked.

AdBlocker or uBlock might have prevented request.

Please check browser console for more details.

":"

Failed to retrieve FlowHub catalogue.

Check browser console for more details.

";console.warn("Error loading https://api.flowhub.org/v1/flows:",e),RED.notify(o,{type:"error",id:"FlowHubPull",timeout:4e3})})} - function escapeHtml(e){return String(e).replace(/[&<>"'`=\/]/g,function(e){return entityMap[e]})}function loadScript(e,t){var o=document.createElement("script");o.type="text/javascript",o.readyState?o.onreadystatechange=function(){"loaded"!==o.readyState&&"complete"!==o.readyState||(o.onreadystatechange=null,t&&t())}:o.onload=function(){t&&t()},o.src=e,document.getElementsByTagName("head")[0].appendChild(o)}var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},descMap={z:"Flow Tab Id",g:"Group Id",d:"Disabled"},defaultRevertHandler=(e,t,o)=>{e=RED.nodes.node(e);e&&(e[t]=o,e.dirty=!0,RED.nodes.dirty(!0),RED.view.redraw())},revertableAttributes={},revertableAttributesNames=(["x","y","template","name","info","func","label","tooltip","timeout","repeat"].forEach(function(e){revertableAttributes[e]=defaultRevertHandler}),Object.keys(revertableAttributes));function attrDesc(e){return descMap[e]?" ("+descMap[e]+")":""}function clickBaitDiff(){$("th.revertable").on("click",e=>{e.preventDefault();var t,o=$($(e.target).parent()).data("attr");confirm('Really revert changes to attribute "'+o+'"?')&&(t=revertableAttributes[o])&&t($($(e.target).parent()).data("id"),o,JSON.parse(atob($($(e.target).parent()).data("oldval"))))})}function createDiff(l,c){var f=[],s=[];try{if(Object.keys(c).forEach(function(e){var t;Object.keys(l).indexOf(e)<0&&(t="object"==typeof c[e]?JSON.stringify(c[e]):c[e],f.push(""+e+attrDesc(e)+"MISSING"+escapeHtml(t)+""),s.push(e))}),Object.keys(l).forEach(function(e){var t;Object.keys(c).indexOf(e)<0&&(t="object"==typeof l[e]?JSON.stringify(l[e]):l[e],f.push(""+e+attrDesc(e)+""+escapeHtml(t)+"ADDED"),s.push(e))}),Object.keys(l).forEach(function(i){if(-1{var t=e.added?"green":e.removed?"red":"#040506";(o=document.createElement("pre")).setAttribute("class","dv-pre-elem"),o.style.color=t,o.appendChild(document.createTextNode(e.value)),o.appendChild(document.createElement("br")),r.appendChild(o)});var n=-1"+i+" CAUSED EXCEP"+escapeHtml(l[i])+""+escapeHtml(c[i])+"")}else f.push(""+i+""+escapeHtml(l[i])+""+escapeHtml(c[i])+"")}),0==s.length){let o=null;var e="OBJ",t=Diff.diffJson(c,l);const d=document.createDocumentFragment();t.forEach(e=>{var t=e.added?"green":e.removed?"red":"#040506";(o=document.createElement("pre")).setAttribute("class","dv-pre-elem"),o.style.color=t,o.appendChild(document.createTextNode(e.value)),o.appendChild(document.createElement("br")),d.appendChild(o)});var i,n=document.createElement("tr"),a=(n.setAttribute("class","dv-differ"),document.createElement("th"));return a.appendChild(document.createTextNode(e)),descMap[e]&&((i=document.createElement("i")).style["font-size"]="80%",i.appendChild(document.createTextNode("("+descMap[e]+")")),a.appendChild(i)),n.append(a),(a=document.createElement("td")).setAttribute("colspan","2"),a.append(d),n.append(a),{html:n.outerHTML,icon:"fa-question"}}}catch(e){console.log("Exception",e)}var o=["x","y","w","h","g","wires"];return{html:f.join(""),icon:0==s.filter(e=>o.indexOf(e)<0).length?"fa-eye":"fa-pencil"}}function doPushSubmission(e,t,o){var i=RED.workspaces.active();$.ajax({url:"FlowHubPush",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({flowid:i,flowdata:e||{},flowlabel:RED.nodes.workspace(i).label,cfgnode:t,svgdata:o}),success:function(e){RED.notify("Submission triggered",{type:"warning",id:"FlowHubPush",timeout:2e3}),$("#flowhubpush-view-flow-link").attr("href","https://flowhub.org/f/"+i).show()},error:function(e,t,o){RED.notify("Submission failed: "+t,{type:"error",id:"FlowHubPush",timeout:2e3}),console.log(t,o)}})}function 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)}function iframeRemoveHighlight(){document.getElementById("flowhubdiff-svgimageiframe").contentWindow.postMessage({msg:"removehighlight"},"*")}function iframeHighlightItem(e){iframeRemoveHighlight(),document.getElementById("flowhubdiff-svgimageiframe").contentWindow.postMessage({item:{label:e.label,icon:e.icon,class:e.class,sublabel:e.sublabel,objid:e.objid},msg:"highlightitem"},"*")}function iframeHasBeenLoaded(e){let t=$(e).data("flowid");var o=getFlowDataFromCurrentWorkspace(t);setTimeout(()=>{e.contentWindow.postMessage({nodes:o,msg:"renderlocalflow",flowid:t||RED.workspaces.active()},"*")},345)}function doComparison(e){var t=RED.workspaces.active();if(RED.nodes.workspace(t))RED.notify("Flow Comparison Triggered",{type:"warning",id:"FlowHubDiff",timeout:2e3}),$.ajax({url:"FlowHubDiff",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({flowid:t,flowhub:"submission from ",flowdata:e||{},flowlabel:RED.nodes.workspace(t).label}),success:function(e){var d=[],r={};if("failed"==e.status){RED.notify("This does not seem to be a FlowHub flow id: "+t,{type:"error",timeout:2e3}),$("#flowhubdiff-view-flow-link").hide();try{$("#node-input-flowhubdiff-diffcontainer").html(""),$("#node-input-flowhubdiff-svgcontainer").html(""),$("#node-input-flowhubdiff-target-container-div").treeList("empty")}catch(e){}}else if($("#flowhubdiff-view-flow-link").attr("href","https://flowhub.org/f/"+e.flowid).show(),e.changes.forEach(function(e){var t,o,i,n,a=e.id;"deleted"==e.type?(r[a]={label:e.oldObj.name||e.oldObj.type,icon:"fa fa-trash",class:"",diffcontent:createDiff({},e.oldObj).html,sublabel:e.oldObj.type,selected:!1,checkbox:!1,children:void 0,objid:a},d.push(r[a])):"added"==e.type?(r[a]={objid:a,label:e.newObj.name||e.newObj.type,icon:"fa fa-plus-square",class:"",diffcontent:createDiff(e.newObj,{}).html,sublabel:e.newObj.type,selected:!1,checkbox:!1,children:void 0},d.push(r[a])):"tab"==e.oldObj.type||"group"==e.oldObj.type||"junction"==e.oldObj.type?(n=createDiff(e.newObj,e.oldObj),r[a]={objid:a,label:e.oldObj.name||e.oldObj.type,icon:"fa "+n.icon,class:"",diffcontent:n.html,sublabel:e.type+" - "+e.oldObj.type,selected:!1,checkbox:!1,children:void 0},d.push(r[a])):(t=RED.nodes.node(a))?((o=RED.nodes.getType(t.type))&&(i=("function"==typeof(i=o.label)?i.call(t):i)||""),o&&i||(i=t.type),n=createDiff(e.newObj,e.oldObj),r[t.id]={node:t,objid:a,label:i,icon:"fa "+n.icon,class:"",diffcontent:n.html,sublabel:e.oldObj.type,selected:!1,checkbox:!1,children:void 0},d.push(r[t.id])):console.log("Node ignore, Type: "+e.type,e)}),e.ifurl&&$("#node-input-flowhubdiff-svgcontainer").html(''),0==d.length){RED.notify("No Flow Changes",{type:"warning",timeout:2e3});try{$("#node-input-flowhubdiff-diffcontainer").html(""),$("#node-input-flowhubdiff-target-container-div").treeList("empty")}catch(e){}}else{try{$("#node-input-flowhubdiff-target-container-div").treeList("empty")}catch(e){$("#node-input-flowhubdiff-target-container-div").css({width:"100%",height:"200px"}).treeList({multi:!1}).on("treelistitemmouseover",function(e,t){t.objid&&iframeHighlightItem(t)}).on("treelistitemmouseout",function(e,t){}).on("treelistselect",function(e,t){t.objid&&(RED.view.reveal(t.objid,!0),RED.view.redraw()),t.diffcontent?($("#node-input-flowhubdiff-diffcontainer").html(t.diffcontent),clickBaitDiff()):$("#node-input-flowhubdiff-diffcontainer").html("")}).on("treelistconfirm",function(e,t){var o;t.objid&&(o=t.objid,setTimeout(()=>{var e=RED.nodes.node(o);e&&(RED.view.reveal(e.id),RED.view.select(e.id),RED.editor.edit(e)),o==RED.workspaces.active()&&RED.workspaces.edit()},50))}),$("#node-input-flowhubdiff-target-filter").show();var o=$("#node-input-flowhubdiff-target-filter").searchBox({style:"compact",delay:300,change:function(){var e,t=$(this).val().trim().toLowerCase();""===t?($("#node-input-flowhubdiff-target-container-div").treeList("filter",null),o.searchBox("count","")):(e=$("#node-input-flowhubdiff-target-container-div").treeList("filter",function(e){return-1e.icon==t.icon?e.label.toLowerCase()>t.label.toLowerCase():e.icon>t.icon))}},error:function(e,t,o){$("#flowhubdiff-view-flow-link").hide();try{$("#node-input-flowhubdiff-diffcontainer").html(""),$("#node-input-flowhubdiff-svgcontainer").html(""),$("#node-input-flowhubdiff-target-container-div").treeList("empty")}catch(e){}404==e.status?RED.notify("Node has not yet been deployed, please deploy.","error"):405==e.status?RED.notify("Not Allowed.","error"):500==e.status?RED.notify("Not Allowed - 500.","error"):0==e.status?RED.notify("Not Allowed - 0.","error"):RED.notify("Not Allowed - Unexpected.","error")}});else{RED.notify("Comparing subflows not supported.",{type:"error",id:"FlowHubDiff",timeout:2e3}),$("#flowhubdiff-view-flow-link").hide();try{$("#node-input-flowhubdiff-diffcontainer").html(""),$("#node-input-flowhubdiff-svgcontainer").html(""),$("#node-input-flowhubdiff-target-container-div").treeList("empty")}catch(e){}}}window.iframeHasBeenLoaded=iframeHasBeenLoaded; + function escapeHtml(e){return String(e).replace(/[&<>"'`=\/]/g,function(e){return entityMap[e]})}function loadScript(e,t){var o=document.createElement("script");o.type="text/javascript",o.readyState?o.onreadystatechange=function(){"loaded"!==o.readyState&&"complete"!==o.readyState||(o.onreadystatechange=null,t&&t())}:o.onload=function(){t&&t()},o.src=e,document.getElementsByTagName("head")[0].appendChild(o)}var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},descMap={z:"Flow Tab Id",g:"Group Id",d:"Disabled"},defaultRevertHandler=(e,t,o)=>{e=RED.nodes.node(e);e&&(e[t]=o,e.dirty=!0,RED.nodes.dirty(!0),RED.view.redraw())},revertableAttributes={},revertableAttributesNames=(["x","y","template","name","info","func","label","tooltip","timeout","repeat"].forEach(function(e){revertableAttributes[e]=defaultRevertHandler}),Object.keys(revertableAttributes));function attrDesc(e){return descMap[e]?" ("+descMap[e]+")":""}function clickBaitDiff(){$("th.revertable").on("click",e=>{e.preventDefault();var t,o=$($(e.target).parent()).data("attr");confirm('Really revert changes to attribute "'+o+'"?')&&(t=revertableAttributes[o])&&t($($(e.target).parent()).data("id"),o,JSON.parse(atob($($(e.target).parent()).data("oldval"))))})}function createDiff(l,c){var s=[],f=[];try{if(Object.keys(c).forEach(function(e){var t;Object.keys(l).indexOf(e)<0&&(t="object"==typeof c[e]?JSON.stringify(c[e]):c[e],s.push(""+e+attrDesc(e)+"MISSING"+escapeHtml(t)+""),f.push(e))}),Object.keys(l).forEach(function(e){var t;Object.keys(c).indexOf(e)<0&&(t="object"==typeof l[e]?JSON.stringify(l[e]):l[e],s.push(""+e+attrDesc(e)+""+escapeHtml(t)+"ADDED"),f.push(e))}),Object.keys(l).forEach(function(i){if(-1{var t=e.added?"green":e.removed?"red":"#040506";(o=document.createElement("pre")).setAttribute("class","dv-pre-elem"),o.style.color=t,o.appendChild(document.createTextNode(e.value)),o.appendChild(document.createElement("br")),r.appendChild(o)});var n=-1"+i+" CAUSED EXCEP"+escapeHtml(l[i])+""+escapeHtml(c[i])+"")}else s.push(""+i+""+escapeHtml(l[i])+""+escapeHtml(c[i])+"")}),0==f.length){let o=null;var e="OBJ",t=Diff.diffJson(c,l);const d=document.createDocumentFragment();t.forEach(e=>{var t=e.added?"green":e.removed?"red":"#040506";(o=document.createElement("pre")).setAttribute("class","dv-pre-elem"),o.style.color=t,o.appendChild(document.createTextNode(e.value)),o.appendChild(document.createElement("br")),d.appendChild(o)});var i,n=document.createElement("tr"),a=(n.setAttribute("class","dv-differ"),document.createElement("th"));return a.appendChild(document.createTextNode(e)),descMap[e]&&((i=document.createElement("i")).style["font-size"]="80%",i.appendChild(document.createTextNode("("+descMap[e]+")")),a.appendChild(i)),n.append(a),(a=document.createElement("td")).setAttribute("colspan","2"),a.append(d),n.append(a),{html:n.outerHTML,icon:"fa-question"}}}catch(e){console.log("Exception",e)}var o=["x","y","w","h","g","wires"];return{html:s.join(""),icon:0==f.filter(e=>o.indexOf(e)<0).length?"fa-eye":"fa-pencil"}}function getInstalledNodeDetails(e){$.ajax({url:"nodes",headers:{Accept:"application/json"},success:e,error:()=>{e(["error"])}})}function doPushSubmission(e,t,o,i){var n=RED.workspaces.active();let a=e.map(e=>e.type);i=i.filter(e=>-1{e.contentWindow.postMessage({nodes:o,msg:"renderlocalflow",flowid:t||RED.workspaces.active()},"*")},345)}function doComparison(e){var t=RED.workspaces.active();if(RED.nodes.workspace(t))RED.notify("Flow Comparison Triggered",{type:"warning",id:"FlowHubDiff",timeout:2e3}),$.ajax({url:"FlowHubDiff",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({flowid:t,flowhub:"submission from ",flowdata:e||{},flowlabel:RED.nodes.workspace(t).label}),success:function(e){var d=[],r={};if("failed"==e.status){RED.notify("This does not seem to be a FlowHub flow id: "+t,{type:"error",timeout:2e3}),$("#flowhubdiff-view-flow-link").hide();try{$("#node-input-flowhubdiff-diffcontainer").html(""),$("#node-input-flowhubdiff-svgcontainer").html(""),$("#node-input-flowhubdiff-target-container-div").treeList("empty")}catch(e){}}else if($("#flowhubdiff-view-flow-link").attr("href","https://flowhub.org/f/"+e.flowid).show(),e.changes.forEach(function(e){var t,o,i,n,a=e.id;"deleted"==e.type?(r[a]={label:e.oldObj.name||e.oldObj.type,icon:"fa fa-trash",class:"",diffcontent:createDiff({},e.oldObj).html,sublabel:e.oldObj.type,selected:!1,checkbox:!1,children:void 0,objid:a},d.push(r[a])):"added"==e.type?(r[a]={objid:a,label:e.newObj.name||e.newObj.type,icon:"fa fa-plus-square",class:"",diffcontent:createDiff(e.newObj,{}).html,sublabel:e.newObj.type,selected:!1,checkbox:!1,children:void 0},d.push(r[a])):"tab"==e.oldObj.type||"group"==e.oldObj.type||"junction"==e.oldObj.type?(n=createDiff(e.newObj,e.oldObj),r[a]={objid:a,label:e.oldObj.name||e.oldObj.type,icon:"fa "+n.icon,class:"",diffcontent:n.html,sublabel:e.type+" - "+e.oldObj.type,selected:!1,checkbox:!1,children:void 0},d.push(r[a])):(t=RED.nodes.node(a))?((o=RED.nodes.getType(t.type))&&(i=("function"==typeof(i=o.label)?i.call(t):i)||""),o&&i||(i=t.type),n=createDiff(e.newObj,e.oldObj),r[t.id]={node:t,objid:a,label:i,icon:"fa "+n.icon,class:"",diffcontent:n.html,sublabel:e.oldObj.type,selected:!1,checkbox:!1,children:void 0},d.push(r[t.id])):console.log("Node ignore, Type: "+e.type,e)}),e.ifurl&&$("#node-input-flowhubdiff-svgcontainer").html(''),0==d.length){RED.notify("No Flow Changes",{type:"warning",timeout:2e3});try{$("#node-input-flowhubdiff-diffcontainer").html(""),$("#node-input-flowhubdiff-target-container-div").treeList("empty")}catch(e){}}else{try{$("#node-input-flowhubdiff-target-container-div").treeList("empty")}catch(e){$("#node-input-flowhubdiff-target-container-div").css({width:"100%",height:"200px"}).treeList({multi:!1}).on("treelistitemmouseover",function(e,t){t.objid&&iframeHighlightItem(t)}).on("treelistitemmouseout",function(e,t){}).on("treelistselect",function(e,t){t.objid&&(RED.view.reveal(t.objid,!0),RED.view.redraw()),t.diffcontent?($("#node-input-flowhubdiff-diffcontainer").html(t.diffcontent),clickBaitDiff()):$("#node-input-flowhubdiff-diffcontainer").html("")}).on("treelistconfirm",function(e,t){var o;t.objid&&(o=t.objid,setTimeout(()=>{var e=RED.nodes.node(o);e&&(RED.view.reveal(e.id),RED.view.select(e.id),RED.editor.edit(e)),o==RED.workspaces.active()&&RED.workspaces.edit()},50))}),$("#node-input-flowhubdiff-target-filter").show();var o=$("#node-input-flowhubdiff-target-filter").searchBox({style:"compact",delay:300,change:function(){var e,t=$(this).val().trim().toLowerCase();""===t?($("#node-input-flowhubdiff-target-container-div").treeList("filter",null),o.searchBox("count","")):(e=$("#node-input-flowhubdiff-target-container-div").treeList("filter",function(e){return-1e.icon==t.icon?e.label.toLowerCase()>t.label.toLowerCase():e.icon>t.icon))}},error:function(e,t,o){$("#flowhubdiff-view-flow-link").hide();try{$("#node-input-flowhubdiff-diffcontainer").html(""),$("#node-input-flowhubdiff-svgcontainer").html(""),$("#node-input-flowhubdiff-target-container-div").treeList("empty")}catch(e){}404==e.status?RED.notify("Node has not yet been deployed, please deploy.","error"):405==e.status?RED.notify("Not Allowed.","error"):500==e.status?RED.notify("Not Allowed - 500.","error"):0==e.status?RED.notify("Not Allowed - 0.","error"):RED.notify("Not Allowed - Unexpected.","error")}});else{RED.notify("Comparing subflows not supported.",{type:"error",id:"FlowHubDiff",timeout:2e3}),$("#flowhubdiff-view-flow-link").hide();try{$("#node-input-flowhubdiff-diffcontainer").html(""),$("#node-input-flowhubdiff-svgcontainer").html(""),$("#node-input-flowhubdiff-target-container-div").treeList("empty")}catch(e){}}}window.iframeHasBeenLoaded=iframeHasBeenLoaded; function nr_intro_generate_svg_3_1(r){return e=>{try{handleSvgObject($($("svg[width=8000]")[0]),e)}catch(t){var n="Error Generating SVG: "+JSON.stringify(t);r.notify(n,{type:"error"}),e(''+n+"")}}}function nr_intro_generate_svg_3_0(r){return e=>{try{handleSvgObject($($("svg")[0]),e)}catch(t){var n="Error Generating SVG: "+JSON.stringify(t);r.notify(n,{type:"error"}),e(''+n+"")}}}function handleSvgObject(o,e){var t=o.clone();t.find("foreignObject").remove(),t.find("svg.__screenshot").remove();function a(t,e){for(var n=0;n\r\n',t=t.html(),l=(new DOMParser).parseFromString(n+t+"\r\n","image/svg+xml"),r=e=>(["g","rect","line","path","circle","image","text"].forEach(t=>{$(e.getElementsByTagName(t)).each((t,e)=>{e.setAttribute("class",""),e.setAttribute("id","")})}),e),s=(["g","rect","line","path","circle","image"].forEach(function(t){a(l.getElementsByTagName(t),o.find(t))}),["text"].forEach(function(t){a(l.getElementsByTagName(t),o.find(t));for(var e=l.getElementsByTagName(t),n=o.find(t),r=0;r{var i=n.getAttribute("xlink:href"),o=i.substr(-4,4).toLowerCase(),a={".jpg":"jpeg",jpeg:"jpeg",".png":"png",".svg":"svg+xml"};if(g[i])return n.setAttribute("xlink:href","data:image/"+a[o]+";base64,"+g[i]),s(r-1);switch(o){case".jpg":case"jpeg":case".png":var l=new XMLHttpRequest;l.open("GET",i,!0),l.responseType="arraybuffer";l.onload=function(t){var e=l.response;e&&(e=(t=>{for(var e="",n=new Uint8Array(t),r=n.byteLength,s=0;s{t<0?e((new XMLSerializer).serializeToString(r(l))):i(s.item(t),t,c)};0{var e="Node-RED version ("+n.settings.version+") not supported";n.notify(e,{type:"error"}),t&&t(''+e+"")}} @@ -142,7 +142,9 @@ globalYourConfigNode.pushcomment = $('#node-input-flowhubpush-comment').val(); svgGeneratorFunctionForVersion(RED)( (svgdata) => { - doPushSubmission(getFlowDataFromCurrentWorkspace(), globalYourConfigNode, svgdata) + getInstalledNodeDetails( (nodedetails) => { + doPushSubmission(getFlowDataFromCurrentWorkspace(), globalYourConfigNode, svgdata, nodedetails) + }) }); }); @@ -2077,7 +2079,7 @@ (function() { var globalRefToSvgData; - let obfuscateHelpers={getFlowDataFromCurrentWorkspace:e=>{var e=e||RED.workspaces.active(),o=RED.nodes.groups(e),e=(o=(o=o.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&&o.push(e)}),RED.nodes.workspace(e)||RED.nodes.subflow(e));return o.unshift(e),RED.nodes.createExportableNodeSet(o)},openImportDialog:e=>{RED.clipboard.import();let o=e;setTimeout(()=>{$("#red-ui-clipboard-dialog-import-text").val(JSON.stringify(o)).trigger("paste")},300)}};function obfuscatieCurrentFlow(o){let t=obfuscateHelpers.getFlowDataFromCurrentWorkspace();t=t.filter(e=>"group"!=e.type);let r={},a=[];console.log("CFG",o),t.forEach(e=>{r[e.id]=e,o.name&&(e.name=e.id),o.info&&(e.info=""),o.position&&(e.x=150,e.y=150),!o.javascript||"javascript"!=e.format&&"function"!=e.type||a.push(e)}),0{var o=r[e.id];"function"==o.type?o.func=e.func:"javascript"==o.format&&(o.template=e.template)}),obfuscateHelpers.openImportDialog(t)},error:function(e,o,t){RED.notify("ClientCode Communcation Failure: "+n.id+": "+o,{type:"error",timeout:3e3})}}):obfuscateHelpers.openImportDialog(t)} + 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!("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{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);-1e.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{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)} 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-1e.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} @@ -2141,7 +2143,11 @@ name: $('#node-input-obfuscate-name').is(":checked"), info: $('#node-input-obfuscate-info').is(":checked"), position: $('#node-input-obfuscate-position').is(":checked"), + remove_groups: $('#node-input-obfuscate-remove-groups').is(":checked"), javascript: $('#node-input-obfuscate-javascript').is(":checked"), + remove_junctions: $('#node-input-obfuscate-remove-junctions').is(":checked"), + remove_linknodes: $('#node-input-obfuscate-remove-linknodes').is(":checked"), + remove_icons: $('#node-input-obfuscate-remove-icons').is(":checked"), }) }) @@ -2286,6 +2292,16 @@ + +
+ + +
+
+ +
+ + +
+
+
+ + +
+ +
+ + +
+ +
+ Warning: No guarantee is made that the obfuscated flow still works. This has not be + thoroughly tested or promises to fulfil any purpose - good or bad. +
diff --git a/plugins/plugins.json b/plugins/plugins.json index e539d95..3cd6ad9 100644 --- a/plugins/plugins.json +++ b/plugins/plugins.json @@ -9,7 +9,7 @@ "plugins": [], "runtime": false, "user": false, - "version": "0.4.7" + "version": "0.4.8" }, { "editor": true, @@ -69,7 +69,7 @@ "plugins": [], "runtime": false, "user": false, - "version": "0.6.2" + "version": "0.6.3" }, { "editor": true,