Skip to content

Commit

Permalink
package update
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit Riessen committed Apr 1, 2024
1 parent 14824ce commit 13f2ac1
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 170 deletions.
28 changes: 11 additions & 17 deletions nodes/nodes.html
Original file line number Diff line number Diff line change
Expand Up @@ -14516,7 +14516,7 @@ <h3>Description</h3>
<script type="text/javascript">
(function(){

function flowHubPullUpdateFlows(e=null,o=null){$.get({url:"https://api.flowhub.org/v1/flows?cb="+(new Date).getTime(),headers:{"X-FHB-TOKEN":o}}).done(t=>{if("failed"==t.status)return RED.notify(t.msg,{type:"error",id:"FlowHubPull",timeout:4e3});let i=[],n={},l=[];Object.keys(t.data).forEach(function(e){var o=t.data[e].name.match(/^(\[.+\])/);o?n[o[0]]?n[o[0]].push(t.data[e]):n[o[0]]=[t.data[e]]:l.push(t.data[e])}),Object.keys(n).sort((e,o)=>e<o?-1:1).forEach(e=>{var o=n[e].map(e=>({label:e.name,icon:"fa "+(RED.nodes.workspace(e.id)?"fa-check-circle-o":""),flowid:e.id,sublabel:e.id,selected:$("#node-input-flowhubpull-flowid").val()==e.id,checkbox:!1,children:void 0}));i.push({label:e,icon:"",flowid:"",sublabel:"",selected:!1,checkbox:!1,children:o.sort((e,o)=>e.label<o.label?-1:1)})}),l.sort((e,o)=>e.name<o.name?-1:1).forEach(e=>{i.push({label:e.name,icon:"fa "+(RED.nodes.workspace(e.id)?"fa-check-circle-o":""),flowid:e.id,sublabel:e.id,selected:$("#node-input-flowhubpull-flowid").val()==e.id,checkbox:!1,children:void 0})}),e&&e(i)}).fail(e=>{var o="",o="rejected"==e.state()?"<p>Failed to retrieve FlowHub catalogue, request blocked.</p><p>AdBlocker or uBlock might have prevented request.</p><p>Please check browser console for more details.</p>":"<p>Failed to retrieve FlowHub catalogue.</p><p>Check browser console for more details.</p>";console.warn("Error loading https://api.flowhub.org/v1/flows:",e),RED.notify(o,{type:"error",id:"FlowHubPull",timeout:4e3})})}function obtainConfigNode(){let o=[];return RED.nodes.eachConfig(function(e){"FlowHubCfg"===e.type&&o.push(e)}),o[0]}function tokenToUrl(e){e=e.substring(4);var o="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_".split("");let t=Object.fromEntries(o.map((e,o)=>[e,o])),i=Object.fromEntries(o.map((e,o)=>[o,e]));return e.replaceAll(/./gi,(e,o)=>i[(t[e]+o+1)%64])}function obtainFhbToken(e,i){$.ajax({url:"FlowHubToken",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({cfgnode:e}),success:function(e){i(e.token)},error:function(e,o,t){i("")}})}function doFlowImport(t,e){$.get({url:"https://api.flowhub.org/v1/flows/"+$("#node-input-flowhubpull-flowid").val()+"?cb="+(new Date).getTime()+"&v="+$("#node-input-flowhubpull-flowrevision").val(),headers:{"X-FHB-TOKEN":e}},function(o,e){if(!Array.isArray(o))return RED.notify("Access Denied.",{type:"error",timeout:3e3});RED.clipboard.import(),setTimeout(()=>{var e=o;t&&(e=o.filter(function(e){return"tab"!=e.type})),$("#red-ui-clipboard-dialog-import-text").val(JSON.stringify(e)).trigger("paste")},300)})}function doFlowImportForPullNode(t,e){$.get({url:"https://api.flowhub.org/v1/flows/"+$("#node-input-flowid").val()+"?cb="+(new Date).getTime()+"&v="+$("#node-input-flowrevision").val(),headers:{"X-FHB-TOKEN":e}},function(o,e){if(!Array.isArray(o))return RED.notify("Access Denied.",{type:"error",timeout:3e3});RED.clipboard.import(),setTimeout(()=>{var e=o;t&&(e=o.filter(function(e){return"tab"!=e.type})),$("#red-ui-clipboard-dialog-import-text").val(JSON.stringify(e)).trigger("paste")},300)})}function checkForDuplication(e){$.get({url:"https://api.flowhub.org/v1/flows/"+$("#node-input-flowhubpull-flowid").val()+"?cb="+(new Date).getTime()+"&v="+$("#node-input-flowhubpull-flowrevision").val(),headers:{"X-FHB-TOKEN":e}},function(e,o){let t=[];if(!Array.isArray(e))return RED.notify("Access Denied.","warning");if(e.forEach((e,o)=>{"tab"==e.type?RED.nodes.workspace(e.id)&&t.push(e):"junction"==e.type?RED.nodes.junction(e.id)&&t.push(e):"group"==e.type?RED.nodes.group(e.id)&&t.push(e):"subflow"==e.type?RED.nodes.subflow(e.id)&&t.push(e):RED.nodes.node(e.id)&&t.push(e)}),0==t.length){RED.notify("Found no duplication.","success");try{$("#node-input-flowhubpull-sb-duplication-container-div").treeList("empty")}catch(e){}}else{RED.notify("Found "+t.length+" items of duplication","warning");try{$("#node-input-flowhubpull-sb-duplication-container-div").treeList("empty")}catch(e){$("#node-input-flowhubpull-sb-duplication-container-div").css({width:"100%",height:"calc(100%)"}).treeList({multi:!1}).on("treelistitemmouseover",function(e,o){}).on("treelistitemmouseout",function(e,o){}).on("treelistselect",function(e,o){o.node&&(RED.workspaces.show(o.node.z,!1,!1,!0),RED.view.reveal(o.node.id,!0),RED.view.redraw())}).on("treelistconfirm",function(e,o){var t;o.node&&(t=o.node.id,setTimeout(()=>{var e=RED.nodes.node(t);e&&(RED.view.reveal(e.id),RED.view.select(e.id),RED.editor.edit(e)),t==RED.workspaces.active()&&RED.workspaces.edit()},50))})}t=t.map(e=>({node:e,label:e.id,sublabel:e.type,selected:!1,checkbox:!1})),$("#node-input-flowhubpull-sb-duplication-container-div").treeList("data",t)}})}
function flowHubPullUpdateFlows(e=null,o=null){$.get({url:"https://api.flowhub.org/v1/flows?cb="+(new Date).getTime(),headers:{"X-FHB-TOKEN":o}}).done(t=>{if("failed"==t.status)return RED.notify(t.msg,{type:"error",id:"FlowHubPull",timeout:4e3});let i=[],r={},n=[];Object.keys(t.data).forEach(function(e){var o=t.data[e].name.match(/^(\[.+\])/);o?r[o[0]]?r[o[0]].push(t.data[e]):r[o[0]]=[t.data[e]]:n.push(t.data[e])}),Object.keys(r).sort((e,o)=>e<o?-1:1).forEach(e=>{var o=r[e].map(e=>({label:e.name,icon:"fa "+(RED.nodes.workspace(e.id)?"fa-check-circle-o":""),flowid:e.id,sublabel:e.id,selected:$("#node-input-flowhubpull-flowid").val()==e.id,checkbox:!1,children:void 0}));i.push({label:e,icon:"",flowid:"",sublabel:"",selected:!1,checkbox:!1,children:o.sort((e,o)=>e.label<o.label?-1:1)})}),n.sort((e,o)=>e.name<o.name?-1:1).forEach(e=>{i.push({label:e.name,icon:"fa "+(RED.nodes.workspace(e.id)?"fa-check-circle-o":""),flowid:e.id,sublabel:e.id,selected:$("#node-input-flowhubpull-flowid").val()==e.id,checkbox:!1,children:void 0})}),e&&e(i)}).fail(e=>{var o="",o="rejected"==e.state()?"<p>Failed to retrieve FlowHub catalogue, request blocked.</p><p>AdBlocker or uBlock might have prevented request.</p><p>Please check browser console for more details.</p>":"<p>Failed to retrieve FlowHub catalogue.</p><p>Check browser console for more details.</p>";console.warn("Error loading https://api.flowhub.org/v1/flows:",e),RED.notify(o,{type:"error",id:"FlowHubPull",timeout:4e3})})}function obtainConfigNode(){let o=[];return RED.nodes.eachConfig(function(e){"FlowHubCfg"===e.type&&o.push(e)}),o[0]}function tokenToUrl(e){e=e.substring(4);var o="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_".split("");let t=Object.fromEntries(o.map((e,o)=>[e,o])),i=Object.fromEntries(o.map((e,o)=>[o,e]));return e.replaceAll(/./gi,(e,o)=>i[(t[e]+o+1)%64])}function obtainFhbToken(e,i){$.ajax({url:"FlowHubToken",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({cfgnode:e}),success:function(e){i(e.token)},error:function(e,o,t){i("")}})}function doFlowImportForSidebar(i,e){RED.notify("Pull triggered",{type:"warning",timeout:3e3}),$.get({url:"https://api.flowhub.org/v3/flows/"+$("#node-input-flowhubpull-flowid").val().trim()+"?cb="+(new Date).getTime()+"&v="+$("#node-input-flowhubpull-flowrevision").val().trim(),headers:{"X-FHB-TOKEN":e}},function(o,e){try{if(!o||!o.flowdata||!Array.isArray(JSON.parse(o.flowdata)))return RED.notify("Access denied or revision not found.",{type:"error",timeout:3e3})}catch(e){return RED.notify("Access Denied, parse error.",{type:"error",timeout:3e3})}var t=ensureYourConfigNodeExists();t.flowrevisions||={},t.flowrevisions[o.flowid]=o.revision,RED.clipboard.import(),setTimeout(()=>{var e=JSON.parse(o.flowdata);i&&(e=e.filter(function(e){return"tab"!=e.type})),$("#red-ui-clipboard-dialog-import-text").val(JSON.stringify(e)).trigger("paste")},300)})}function doFlowImportForPullNode(e,o){$.get({url:"https://api.flowhub.org/v3/flows/"+$("#node-input-flowid").val().trim()+"?cb="+(new Date).getTime()+"&v="+$("#node-input-flowrevision").val().trim(),headers:{"X-FHB-TOKEN":o}},function(o,e){try{if(!o||!o.flowdata||!Array.isArray(JSON.parse(o.flowdata)))return RED.notify("Access denied or revision not found.",{type:"error",timeout:3e3})}catch(e){return RED.notify("Access Denied, parse error.",{type:"error",timeout:3e3})}var t=(()=>{let o=void 0;return RED.nodes.eachConfig(function(e){"FlowHubCfg"===e.type&&(o=e)}),o})();t&&(t.flowrevisions||={},t.flowrevisions[o.flowid]=o.revision,RED.nodes.dirty(!0)),RED.clipboard.import(),setTimeout(()=>{var e=JSON.parse(o.flowdata);$("#red-ui-clipboard-dialog-import-text").val(JSON.stringify(e)).trigger("paste")},300)})}function checkForDuplication(e){$.get({url:"https://api.flowhub.org/v1/flows/"+$("#node-input-flowhubpull-flowid").val()+"?cb="+(new Date).getTime()+"&v="+$("#node-input-flowhubpull-flowrevision").val(),headers:{"X-FHB-TOKEN":e}},function(e,o){let t=[];if(!Array.isArray(e))return RED.notify("Access denied or revision not found.","error");if(e.forEach((e,o)=>{"tab"==e.type?RED.nodes.workspace(e.id)&&t.push(e):"junction"==e.type?RED.nodes.junction(e.id)&&t.push(e):"group"==e.type?RED.nodes.group(e.id)&&t.push(e):"subflow"==e.type?RED.nodes.subflow(e.id)&&t.push(e):RED.nodes.node(e.id)&&t.push(e)}),0==t.length){RED.notify("Found no duplication.","success");try{$("#node-input-flowhubpull-sb-duplication-container-div").treeList("empty")}catch(e){}}else{RED.notify("Found "+t.length+" items of duplication","warning");try{$("#node-input-flowhubpull-sb-duplication-container-div").treeList("empty")}catch(e){$("#node-input-flowhubpull-sb-duplication-container-div").css({width:"100%",height:"calc(100%)"}).treeList({multi:!1}).on("treelistitemmouseover",function(e,o){}).on("treelistitemmouseout",function(e,o){}).on("treelistselect",function(e,o){o.node&&(RED.workspaces.show(o.node.z,!1,!1,!0),RED.view.reveal(o.node.id,!0),RED.view.redraw())}).on("treelistconfirm",function(e,o){var t;o.node&&(t=o.node.id,setTimeout(()=>{var e=RED.nodes.node(t);e&&(RED.view.reveal(e.id),RED.view.select(e.id),RED.editor.edit(e)),t==RED.workspaces.active()&&RED.workspaces.edit()},50))})}t=t.map(e=>({node:e,label:e.id,sublabel:e.type,selected:!1,checkbox:!1})),$("#node-input-flowhubpull-sb-duplication-container-div").treeList("data",t)}})}

RED.nodes.registerType('FlowHubPull',{
color: '#44eeff',
Expand Down Expand Up @@ -14713,9 +14713,10 @@ <h3>Description</h3>
<input type="text" id="node-input-flowname" style="display: none;">

<a id="flowhubpull-view-flow-link" style="color: blue; display: none; margin-left: 80px;"
target="_blank" href="">View Flow <i class="fa fa-external-link"></i></a>
target="_blank" href="">Webiliser <i class="fa fa-external-link"></i></a>
</div>

<!--
<div class="form-row">
<label>
<span>Import to:</span>
Expand All @@ -14727,7 +14728,7 @@ <h3>Description</h3>
<a id="flowhubpull-dialog-import-opt-new" class="red-ui-button toggle" href="#" data-i18n="clipboard.import.newFlow">new flow</a>
</span>
</div>

-->
<div class="form-row node-input-target-row">
<button id="node-input-refresh-list-but"
class="red-ui-button"><i class="fa fa-refresh"></i> Refresh Flow List</button>
Expand All @@ -14742,13 +14743,6 @@ <h3>Description</h3>
<div id="node-input-flowhubpull-target-container-div"></div>
</div>

<div class="form-row">
All flows are licensed under a copyleft <a style="color: blue;" target="_blank" href="https://raw.githubusercontent.com/gorenje/flows.flowhub.org/main/LICENSE">license <i class="fa fa-external-link"></i></a>,<br>
hereby permission is given to use any flow for any purpose <br>
<b>other than</b> for evil. No guarantee of purpose fulfillment<br>
is made nor warrenty for failure - all risk is carried by the user.
</div>

<div class="form-row">
<label for="node-input-flowrevision"><i class="fa fa-tag"></i> Revision</label>
<input type="text" id="node-input-flowrevision" placeholder="Revision"/>
Expand All @@ -14762,6 +14756,7 @@ <h3>Description</h3>
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name">Name</span></label>
<input type="text" id="node-input-name" placeholder="Name"/>
</div>

</script>


Expand All @@ -14779,20 +14774,18 @@ <h3>Description</h3>
category: 'config',
hasUsers: false,
defaults: {
apiToken: { value: "FLOWHUB_API_TOKEN" },
apiTokenType: { value: "env" },
apiToken: { value: "" },
apiTokenType: { value: "" },
fullname: { value: "" },
email: { value: "" },
flowid: { value: "" },
flowrevision: { value: "" },
notab: { value: false },
pushcomment: { value: "" },
pushnewflows: { value: false },
tokens: { value: [{
name: "FlowHub Token",
type: "env",
val: "FLOWHUB_API_TOKEN"
}]}
forcepush: { value: false },
tokens: { value: [] },
flowrevisions: { value: {} }
},
label: 'FlowHubCfg',
});
Expand Down Expand Up @@ -16630,6 +16623,7 @@ <h3>Description</h3>
defaults: {
name: {value:""},
filename: { value: ""},
dirname: { value: "" },
format: {value:"handlebars"},
syntax: {value:"mustache"},
template: {value:""},
Expand Down
32 changes: 16 additions & 16 deletions nodes/nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@
"FlowHubPull"
],
"user": false,
"version": "0.6.4"
"version": "0.7.1"
},
{
"enabled": true,
Expand All @@ -912,7 +912,7 @@
"FlowHubCfg"
],
"user": false,
"version": "0.6.4"
"version": "0.7.1"
},
{
"enabled": true,
Expand Down Expand Up @@ -1343,7 +1343,7 @@
"NodeDevOps"
],
"user": false,
"version": "0.3.6"
"version": "0.3.9"
},
{
"enabled": true,
Expand All @@ -1355,7 +1355,7 @@
"NodeFactory"
],
"user": false,
"version": "0.3.6"
"version": "0.3.9"
},
{
"enabled": true,
Expand All @@ -1367,7 +1367,7 @@
"PkgFile"
],
"user": false,
"version": "0.3.6"
"version": "0.3.9"
},
{
"enabled": true,
Expand All @@ -1379,7 +1379,7 @@
"NpmTarBall"
],
"user": false,
"version": "0.3.6"
"version": "0.3.9"
},
{
"enabled": true,
Expand All @@ -1391,7 +1391,7 @@
"NodeRedInstall"
],
"user": false,
"version": "0.3.6"
"version": "0.3.9"
},
{
"enabled": true,
Expand All @@ -1403,7 +1403,7 @@
"NpmPublish"
],
"user": false,
"version": "0.3.6"
"version": "0.3.9"
},
{
"enabled": true,
Expand All @@ -1415,7 +1415,7 @@
"OTPGenerate"
],
"user": false,
"version": "0.3.6"
"version": "0.3.9"
},
{
"enabled": true,
Expand All @@ -1427,7 +1427,7 @@
"NodeFactorySidebarCfg"
],
"user": false,
"version": "0.3.6"
"version": "0.3.9"
},
{
"enabled": true,
Expand All @@ -1439,7 +1439,7 @@
"Seeker"
],
"user": false,
"version": "0.7.4"
"version": "0.7.5"
},
{
"enabled": true,
Expand All @@ -1451,7 +1451,7 @@
"Sink"
],
"user": false,
"version": "0.7.4"
"version": "0.7.5"
},
{
"enabled": true,
Expand All @@ -1463,7 +1463,7 @@
"ClientCode"
],
"user": false,
"version": "0.7.4"
"version": "0.7.5"
},
{
"enabled": true,
Expand All @@ -1475,7 +1475,7 @@
"GetFlows"
],
"user": false,
"version": "0.7.4"
"version": "0.7.5"
},
{
"enabled": true,
Expand All @@ -1487,7 +1487,7 @@
"SendFlow"
],
"user": false,
"version": "0.7.4"
"version": "0.7.5"
},
{
"enabled": true,
Expand All @@ -1499,7 +1499,7 @@
"InstallPackage"
],
"user": false,
"version": "0.7.4"
"version": "0.7.5"
},
{
"enabled": true,
Expand Down
Loading

0 comments on commit 13f2ac1

Please sign in to comment.