mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Compare commits
16 Commits
move-locat
...
Add-pfxp12
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56a7729964 | ||
|
|
8272d4e1e4 | ||
|
|
6bac244c28 | ||
|
|
936f024e33 | ||
|
|
fbf2c7b570 | ||
|
|
bb01f26f06 | ||
|
|
acf5427810 | ||
|
|
8dee431b3f | ||
|
|
883cee9c59 | ||
|
|
ef19457bda | ||
|
|
1cbc4fd9da | ||
|
|
5a1c18de24 | ||
|
|
e4e3e0be7b | ||
|
|
71440be009 | ||
|
|
214fbc0e47 | ||
|
|
c3d4421592 |
@@ -92,7 +92,6 @@
|
||||
"ctrl-+": "core:zoom-in",
|
||||
"ctrl--": "core:zoom-out",
|
||||
"ctrl-0": "core:zoom-reset"
|
||||
|
||||
},
|
||||
"red-ui-editor-stack": {
|
||||
"ctrl-enter": "core:confirm-edit-tray",
|
||||
|
||||
@@ -3013,7 +3013,12 @@ RED.nodes = (function() {
|
||||
});
|
||||
RED.events.on('deploy', function () {
|
||||
allNodes.clearState()
|
||||
})
|
||||
});
|
||||
RED.actions.add("core:trigger-selected-nodes-action", function () {
|
||||
const selectedNodes = RED.view.selection().nodes || [];
|
||||
// Triggers the button action of the selected nodes
|
||||
selectedNodes.forEach((node) => RED.view.clickNodeButton(node));
|
||||
});
|
||||
},
|
||||
registry:registry,
|
||||
setNodeList: registry.setNodeList,
|
||||
|
||||
@@ -15,26 +15,35 @@
|
||||
**/
|
||||
RED.palette.editor = (function() {
|
||||
|
||||
var disabled = false;
|
||||
let catalogues = []
|
||||
const loadedCatalogs = []
|
||||
var editorTabs;
|
||||
let filterInput;
|
||||
let searchInput;
|
||||
let nodeList;
|
||||
let packageList;
|
||||
let fullList = []
|
||||
|
||||
// Loaded modules
|
||||
let loadedList = [];
|
||||
let filteredList = [];
|
||||
let loadedIndex = {};
|
||||
|
||||
var typesInUse = {};
|
||||
var nodeEntries = {};
|
||||
var eventTimers = {};
|
||||
var activeFilter = "";
|
||||
// Module list
|
||||
let fullList = [];
|
||||
let filteredList = [];
|
||||
|
||||
var semverre = /^(\d+)(\.(\d+))?(\.(\d+))?(-([0-9A-Za-z-]+))?(\.([0-9A-Za-z-.]+))?$/;
|
||||
var NUMBERS_ONLY = /^\d+$/;
|
||||
// Modules installed
|
||||
let nodeEntries = {};
|
||||
|
||||
// EditableList
|
||||
let nodeList;
|
||||
let packageList;
|
||||
|
||||
// Nodes tab - filter
|
||||
let activeFilter = "";
|
||||
// Nodes tab - search input
|
||||
let filterInput;
|
||||
// Install tab - search input
|
||||
let searchInput;
|
||||
|
||||
const typesInUse = {};
|
||||
|
||||
const semverre = /^(\d+)(\.(\d+))?(\.(\d+))?(-([0-9A-Za-z-]+))?(\.([0-9A-Za-z-.]+))?$/;
|
||||
const NUMBERS_ONLY = /^\d+$/;
|
||||
|
||||
function SemVerPart(part) {
|
||||
this.number = 0;
|
||||
@@ -196,6 +205,7 @@ RED.palette.editor = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
const eventTimers = {};
|
||||
function refreshNodeModule(module) {
|
||||
if (!eventTimers.hasOwnProperty(module)) {
|
||||
eventTimers[module] = setTimeout(function() {
|
||||
@@ -272,7 +282,6 @@ RED.palette.editor = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _refreshNodeModule(module) {
|
||||
if (!nodeEntries.hasOwnProperty(module)) {
|
||||
nodeEntries[module] = {info:RED.nodes.registry.getModule(module)};
|
||||
@@ -422,16 +431,10 @@ RED.palette.editor = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var catalogueCount;
|
||||
var catalogueLoadStatus = [];
|
||||
var catalogueLoadStart;
|
||||
|
||||
var activeSort = sortModulesRelevance;
|
||||
let activeSort = sortModulesRelevance;
|
||||
|
||||
function refreshCatalogues (done) {
|
||||
catalogueLoadStatus = [];
|
||||
catalogueCount = catalogues.length;
|
||||
const catalogueCount = catalogues.length;
|
||||
loadedList = []
|
||||
loadedIndex = {}
|
||||
loadedCatalogs.length = 0
|
||||
@@ -441,7 +444,7 @@ RED.palette.editor = (function() {
|
||||
$.getJSON(url, {_: new Date().getTime()},function(v) {
|
||||
loadedCatalogs.push({ index: index, url: url, name: v.name, updated_at: v.updated_at, modules_count: (v.modules || []).length })
|
||||
handleCatalogResponse({ url: url, name: v.name},index,v);
|
||||
}).fail(function(jqxhr, textStatus, error) {
|
||||
}).fail(function(_jqxhr, _textStatus, error) {
|
||||
console.warn("Error loading catalog",url,":",error);
|
||||
}).always(function() {
|
||||
handled++;
|
||||
@@ -494,7 +497,7 @@ RED.palette.editor = (function() {
|
||||
|
||||
$(".red-ui-palette-module-shade-status").text(RED._('palette.editor.loading'));
|
||||
$("#red-ui-palette-module-install-shade").show();
|
||||
catalogueLoadStart = Date.now()
|
||||
const catalogueLoadStart = Date.now()
|
||||
refreshCatalogues(function () {
|
||||
refreshNodeModuleList();
|
||||
updateCatalogFilter(loadedCatalogs)
|
||||
@@ -609,36 +612,42 @@ RED.palette.editor = (function() {
|
||||
return -1 * (A.info.timestamp-B.info.timestamp);
|
||||
}
|
||||
|
||||
var installAllowList = ['*'];
|
||||
var installDenyList = [];
|
||||
var updateAllowed = true;
|
||||
var updateAllowList = ['*'];
|
||||
var updateDenyList = [];
|
||||
let installAllowList = ['*'];
|
||||
let installDenyList = [];
|
||||
let updateAllowed = true;
|
||||
let updateAllowList = ['*'];
|
||||
let updateDenyList = [];
|
||||
|
||||
let editorTabs;
|
||||
let settingsPane;
|
||||
|
||||
function init() {
|
||||
catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json']
|
||||
if (RED.settings.get('externalModules.palette.allowInstall', true) === false) {
|
||||
return;
|
||||
}
|
||||
var settingsAllowList = RED.settings.get("externalModules.palette.allowList")
|
||||
var settingsDenyList = RED.settings.get("externalModules.palette.denyList")
|
||||
|
||||
const settingsAllowList = RED.settings.get("externalModules.palette.allowList")
|
||||
const settingsDenyList = RED.settings.get("externalModules.palette.denyList")
|
||||
const settingsUpdateAllowList = RED.settings.get("externalModules.palette.allowUpdateList")
|
||||
const settingsUpdateDenyList = RED.settings.get("externalModules.palette.denyUpdateList")
|
||||
|
||||
if (settingsAllowList || settingsDenyList) {
|
||||
installAllowList = settingsAllowList;
|
||||
installDenyList = settingsDenyList
|
||||
installDenyList = settingsDenyList;
|
||||
}
|
||||
installAllowList = RED.utils.parseModuleList(installAllowList);
|
||||
installDenyList = RED.utils.parseModuleList(installDenyList);
|
||||
|
||||
var settingsUpdateAllowList = RED.settings.get("externalModules.palette.allowUpdateList")
|
||||
var settingsUpdateDenyList = RED.settings.get("externalModules.palette.denyUpdateList")
|
||||
if (settingsUpdateAllowList || settingsUpdateDenyList) {
|
||||
updateAllowList = settingsUpdateAllowList;
|
||||
updateDenyList = settingsUpdateDenyList;
|
||||
}
|
||||
|
||||
installAllowList = RED.utils.parseModuleList(installAllowList);
|
||||
installDenyList = RED.utils.parseModuleList(installDenyList);
|
||||
|
||||
updateAllowed = RED.settings.get("externalModules.palette.allowUpdate", true);
|
||||
updateAllowList = RED.utils.parseModuleList(updateAllowList);
|
||||
updateDenyList = RED.utils.parseModuleList(updateDenyList);
|
||||
updateAllowed = RED.settings.get("externalModules.palette.allowUpdate",true);
|
||||
|
||||
catalogues = RED.settings.theme('palette.catalogues') || ['https://catalogue.nodered.org/catalogue.json']
|
||||
|
||||
createSettingsPane();
|
||||
|
||||
@@ -659,7 +668,7 @@ RED.palette.editor = (function() {
|
||||
|
||||
// Add the update status to the status bar
|
||||
addUpdateInfoToStatusBar();
|
||||
|
||||
// Load catalogues
|
||||
refreshCatalogues()
|
||||
|
||||
RED.actions.add("core:manage-palette",function() {
|
||||
@@ -768,8 +777,6 @@ RED.palette.editor = (function() {
|
||||
});
|
||||
}
|
||||
|
||||
var settingsPane;
|
||||
|
||||
function getSettingsPane() {
|
||||
initInstallTab();
|
||||
editorTabs.activateTab('nodes');
|
||||
|
||||
@@ -26,6 +26,26 @@
|
||||
@include disable-selection;
|
||||
@include component-border;
|
||||
transition: width 0.2s ease-in-out;
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
top: 0px;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
width: 7px;
|
||||
height: 100%;
|
||||
z-index: 4;
|
||||
position: absolute;
|
||||
-webkit-mask-image: url(images/grip.svg);
|
||||
mask-image: url(images/grip.svg);
|
||||
-webkit-mask-size: auto;
|
||||
mask-size: auto;
|
||||
-webkit-mask-position: 50% 50%;
|
||||
mask-position: 50% 50%;
|
||||
-webkit-mask-repeat: no-repeat;
|
||||
mask-repeat: no-repeat;
|
||||
background-color: var(--red-ui-grip-color);
|
||||
}
|
||||
}
|
||||
|
||||
.red-ui-palette-closed {
|
||||
|
||||
@@ -20,6 +20,13 @@
|
||||
<label for="node-config-input-uselocalfiles" style="width: 70%;"><span data-i18n="tls.label.use-local-files"></label>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label style="width: 120px;" for="node-config-input-certType"><i class="fa fa-bars"></i> <span data-i18n="tls.label.certtype"></label>
|
||||
<select id="node-config-input-certType">
|
||||
<option value="files" data-i18n="tls.label.files"></option>
|
||||
<option value="pfx" data-i18n="tls.label.pfx"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-row" id="node-tls-conf-cer">
|
||||
<label style="width: 120px;"><i class="fa fa-file-text-o"></i> <span data-i18n="tls.label.cert"></span></label>
|
||||
<span class="tls-config-input-data">
|
||||
<label class="red-ui-button" for="node-config-input-certfile"><i class="fa fa-upload"></i> <span data-i18n="tls.label.upload"></span></label>
|
||||
@@ -31,7 +38,7 @@
|
||||
<input type="hidden" id="node-config-input-certdata">
|
||||
<input class="hide tls-config-input-path" style="width: calc(100% - 170px);" type="text" id="node-config-input-cert" data-i18n="[placeholder]tls.placeholder.cert">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-row" id="node-tls-conf-key">
|
||||
<label style="width: 120px;" for="node-config-input-key"><i class="fa fa-file-text-o"></i> <span data-i18n="tls.label.key"></span></label>
|
||||
<span class="tls-config-input-data">
|
||||
<label class="red-ui-button" for="node-config-input-keyfile"><i class="fa fa-upload"></i> <span data-i18n="tls.label.upload"></span></label>
|
||||
@@ -43,11 +50,23 @@
|
||||
<input type="hidden" id="node-config-input-keydata">
|
||||
<input class="hide tls-config-input-path" style="width: calc(100% - 170px);" type="text" id="node-config-input-key" data-i18n="[placeholder]tls.placeholder.key">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label style="width: 100px; margin-left: 20px;" for="node-config-input-passphrase"> <span data-i18n="tls.label.passphrase"></span></label>
|
||||
<input type="password" style="width: calc(100% - 170px);" id="node-config-input-passphrase" data-i18n="[placeholder]tls.placeholder.passphrase">
|
||||
<div class="form-row" id="node-tls-conf-p12">
|
||||
<label style="width: 120px;" for="node-config-input-p12"><i class="fa fa-file-text-o"></i> <span data-i18n="tls.label.p12"></span></label>
|
||||
<span class="tls-config-input-data">
|
||||
<label class="red-ui-button" for="node-config-input-p12file"><i class="fa fa-upload"></i> <span data-i18n="tls.label.upload"></span></label>
|
||||
<input class="hide" type="file" id="node-config-input-p12file">
|
||||
<span id="tls-config-p12name" style="width: calc(100% - 280px); overflow: hidden; line-height:34px; height:34px; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle;"> </span>
|
||||
<button type="button" class="red-ui-button red-ui-button-small" id="tls-config-button-p12-clear" style="margin-left: 10px"><i class="fa fa-times"></i></button>
|
||||
</span>
|
||||
<input type="hidden" id="node-config-input-p12name">
|
||||
<input type="hidden" id="node-config-input-p12data">
|
||||
<input class="hide tls-config-input-path" style="width: calc(100% - 170px);" type="text" id="node-config-input-p12" data-i18n="[placeholder]tls.placeholder.p12">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label style="width: 120px;" for="node-config-input-passphrase"><i class="fa fa-key"></i> <span data-i18n="tls.label.passphrase"></span></label>
|
||||
<input type="password" style="width: calc(100% - 170px);" id="node-config-input-passphrase" data-i18n="[placeholder]tls.placeholder.passphrase">
|
||||
</div>
|
||||
<div class="form-row" id="node-tls-conf-ca">
|
||||
<label style="width: 120px;" for="node-config-input-ca"><i class="fa fa-file-text-o"></i> <span data-i18n="tls.label.ca"></span></label>
|
||||
<span class="tls-config-input-data">
|
||||
<label class="red-ui-button" for="node-config-input-cafile"><i class="fa fa-upload"></i> <span data-i18n="tls.label.upload"></span></label>
|
||||
@@ -83,6 +102,7 @@
|
||||
category: 'config',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
certType: {value:"files"},
|
||||
cert: {value:"", validate: function(v,opt) {
|
||||
var currentKey = $("#node-config-input-key").val();
|
||||
if (currentKey === undefined) {
|
||||
@@ -103,6 +123,8 @@
|
||||
}
|
||||
return RED._("node-red:tls.error.invalid-key");
|
||||
}},
|
||||
p12: {value:""},
|
||||
p12name: {value:""},
|
||||
ca: {value:""},
|
||||
certname: {value:""},
|
||||
keyname: {value:""},
|
||||
@@ -115,6 +137,7 @@
|
||||
certdata: {type:"text"},
|
||||
keydata: {type:"text"},
|
||||
cadata: {type:"text"},
|
||||
p12data: {type:"text"},
|
||||
passphrase: {type:"password"}
|
||||
},
|
||||
label: function() {
|
||||
@@ -124,6 +147,21 @@
|
||||
return this.name?"node_label_italic":"";
|
||||
},
|
||||
oneditprepare: function() {
|
||||
$("#node-config-input-certType").on('change',function() {
|
||||
if ($("#node-config-input-certType").val() === "pfx") {
|
||||
$("#node-tls-conf-cer").hide();
|
||||
$("#node-tls-conf-key").hide();
|
||||
$("#node-tls-conf-ca").hide();
|
||||
$("#node-tls-conf-p12").show();
|
||||
}
|
||||
else {
|
||||
$("#node-tls-conf-cer").show();
|
||||
$("#node-tls-conf-key").show();
|
||||
$("#node-tls-conf-ca").show();
|
||||
$("#node-tls-conf-p12").hide();
|
||||
}
|
||||
});
|
||||
|
||||
function updateFileUpload() {
|
||||
if ($("#node-config-input-uselocalfiles").is(':checked')) {
|
||||
$(".tls-config-input-path").show();
|
||||
@@ -145,9 +183,19 @@
|
||||
reader.onload = function(event) {
|
||||
$("#tls-config-"+property+"name").text(filename);
|
||||
$(filenameInputId).val(filename);
|
||||
$(dataInputId).val(event.target.result);
|
||||
if (property === "p12") {
|
||||
$(dataInputId).val(btoa(String.fromCharCode(...new Uint8Array(event.target.result))))
|
||||
}
|
||||
else {
|
||||
$(dataInputId).val(event.target.result);
|
||||
}
|
||||
}
|
||||
if (property === "p12") {
|
||||
reader.readAsArrayBuffer(file);
|
||||
}
|
||||
else {
|
||||
reader.readAsText(file,"UTF-8");
|
||||
}
|
||||
reader.readAsText(file,"UTF-8");
|
||||
}
|
||||
$("#node-config-input-certfile" ).on("change", function() {
|
||||
saveFile("cert", this.files[0]);
|
||||
@@ -158,6 +206,9 @@
|
||||
$("#node-config-input-cafile" ).on("change", function() {
|
||||
saveFile("ca", this.files[0]);
|
||||
});
|
||||
$("#node-config-input-p12file" ).on("change", function() {
|
||||
saveFile("p12", this.files[0]);
|
||||
});
|
||||
|
||||
function clearNameData(prop) {
|
||||
$("#tls-config-"+prop+"name").text("");
|
||||
@@ -173,6 +224,9 @@
|
||||
$("#tls-config-button-ca-clear").on("click", function() {
|
||||
clearNameData("ca");
|
||||
});
|
||||
$("#tls-config-button-p12-clear").on("click", function() {
|
||||
clearNameData("p12");
|
||||
});
|
||||
|
||||
if (RED.settings.tlsConfigDisableLocalFiles) {
|
||||
$("#node-config-row-uselocalfiles").hide();
|
||||
@@ -180,12 +234,13 @@
|
||||
$("#node-config-row-uselocalfiles").show();
|
||||
}
|
||||
// in case paths were set from old TLS config
|
||||
if(this.cert || this.key || this.ca) {
|
||||
if (this.cert || this.key || this.ca || this.p12) {
|
||||
$("#node-config-input-uselocalfiles").prop('checked',true);
|
||||
}
|
||||
$("#tls-config-certname").text(this.certname);
|
||||
$("#tls-config-keyname").text(this.keyname);
|
||||
$("#tls-config-caname").text(this.caname);
|
||||
$("#tls-config-p12name").text(this.p12name);
|
||||
updateFileUpload();
|
||||
},
|
||||
oneditsave: function() {
|
||||
@@ -193,10 +248,13 @@
|
||||
clearNameData("ca");
|
||||
clearNameData("cert");
|
||||
clearNameData("key");
|
||||
} else {
|
||||
clearNameData("p12");
|
||||
}
|
||||
else {
|
||||
$("#node-config-input-ca").val("");
|
||||
$("#node-config-input-cert").val("");
|
||||
$("#node-config-input-key").val("");
|
||||
$("#node-config-input-p12").val("");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -22,15 +22,27 @@ module.exports = function(RED) {
|
||||
RED.nodes.createNode(this,n);
|
||||
this.valid = true;
|
||||
this.verifyservercert = n.verifyservercert;
|
||||
var certPath = n.cert.trim();
|
||||
var keyPath = n.key.trim();
|
||||
var caPath = n.ca.trim();
|
||||
var certPath, keyPath, caPath, p12Path;
|
||||
if (n.cert) { certPath = n.cert.trim(); }
|
||||
if (n.key) { keyPath = n.key.trim(); }
|
||||
if (n.ca) { caPath = n.ca.trim(); }
|
||||
if (n.p12) { p12Path = n.p12.trim(); }
|
||||
this.certType = n.certType || "files";
|
||||
this.servername = (n.servername||"").trim();
|
||||
this.alpnprotocol = (n.alpnprotocol||"").trim();
|
||||
|
||||
if ((certPath.length > 0) || (keyPath.length > 0) || (caPath.length > 0)) {
|
||||
|
||||
if ( (certPath.length > 0) !== (keyPath.length > 0)) {
|
||||
if (this.certType === "pfx" && p12Path && p12Path.length > 0) {
|
||||
try {
|
||||
this.pfx = fs.readFileSync(p12Path);
|
||||
}
|
||||
catch(err) {
|
||||
this.valid = false;
|
||||
this.error(err.toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ((certPath && certPath.length > 0) || (keyPath && keyPath.length > 0) || (caPath && caPath.length > 0)) {
|
||||
if ( (certPath && certPath.length > 0) !== (keyPath && keyPath.length > 0)) {
|
||||
this.valid = false;
|
||||
this.error(RED._("tls.error.missing-file"));
|
||||
return;
|
||||
@@ -46,18 +58,21 @@ module.exports = function(RED) {
|
||||
if (caPath) {
|
||||
this.ca = fs.readFileSync(caPath);
|
||||
}
|
||||
} catch(err) {
|
||||
}
|
||||
catch(err) {
|
||||
this.valid = false;
|
||||
this.error(err.toString());
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (this.credentials) {
|
||||
var certData = this.credentials.certdata || "";
|
||||
var keyData = this.credentials.keydata || "";
|
||||
var caData = this.credentials.cadata || "";
|
||||
var p12Data = this.credentials.p12data || "";
|
||||
|
||||
if ((certData.length > 0) !== (keyData.length > 0)) {
|
||||
if ((certData.length > 0) !== (keyData.length > 0) && p12Data.length === 0) {
|
||||
this.valid = false;
|
||||
this.error(RED._("tls.error.missing-file"));
|
||||
return;
|
||||
@@ -72,6 +87,9 @@ module.exports = function(RED) {
|
||||
if (caData) {
|
||||
this.ca = caData;
|
||||
}
|
||||
if (p12Data) {
|
||||
this.pfx = Buffer.from(p12Data, 'base64');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,6 +98,7 @@ module.exports = function(RED) {
|
||||
certdata: {type:"text"},
|
||||
keydata: {type:"text"},
|
||||
cadata: {type:"text"},
|
||||
p12data: {type:"text"},
|
||||
passphrase: {type:"password"}
|
||||
},
|
||||
settings: {
|
||||
@@ -92,14 +111,21 @@ module.exports = function(RED) {
|
||||
|
||||
TLSConfig.prototype.addTLSOptions = function(opts) {
|
||||
if (this.valid) {
|
||||
if (this.key) {
|
||||
opts.key = this.key;
|
||||
if (this.certType === "files") {
|
||||
if (this.key) {
|
||||
opts.key = this.key;
|
||||
}
|
||||
if (this.cert) {
|
||||
opts.cert = this.cert;
|
||||
}
|
||||
if (this.ca) {
|
||||
opts.ca = this.ca;
|
||||
}
|
||||
}
|
||||
if (this.cert) {
|
||||
opts.cert = this.cert;
|
||||
}
|
||||
if (this.ca) {
|
||||
opts.ca = this.ca;
|
||||
else {
|
||||
if (this.pfx) {
|
||||
opts.pfx = this.pfx;
|
||||
}
|
||||
}
|
||||
if (this.credentials && this.credentials.passphrase) {
|
||||
opts.passphrase = this.credentials.passphrase;
|
||||
|
||||
@@ -204,19 +204,25 @@
|
||||
"ca": "CA Certificate",
|
||||
"verify-server-cert": "Verify server certificate",
|
||||
"servername": "Server Name",
|
||||
"alpnprotocol": "ALPN Protocol"
|
||||
"alpnprotocol": "ALPN Protocol",
|
||||
"certtype": "Cert Type",
|
||||
"files": "Individual files",
|
||||
"p12": "pfx or p12",
|
||||
"pfx": "pfx or p12 file"
|
||||
},
|
||||
"placeholder": {
|
||||
"cert": "path to certificate (PEM format)",
|
||||
"key": "path to private key (PEM format)",
|
||||
"p12": "path to .pfx or .p12 (PKCS12 format)",
|
||||
"ca": "path to CA certificate (PEM format)",
|
||||
"passphrase": "private key passphrase (optional)",
|
||||
"passphrase": "password or passphrase (optional)",
|
||||
"servername": "for use with SNI",
|
||||
"alpnprotocol": "for use with ALPN"
|
||||
},
|
||||
"error": {
|
||||
"missing-file": "No certificate/key file provided",
|
||||
"invalid-cert": "Certificate not specified",
|
||||
"invalid-p12": "pfx/p12 not specified",
|
||||
"invalid-key": "Private key not specified"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -85,10 +85,7 @@ function init(_settings, _runtime) {
|
||||
var ffBase = fspath.basename(flowsFullPath,ffExt);
|
||||
|
||||
flowsFileBackup = getBackupFilename(flowsFullPath);
|
||||
credentialsFile = fspath.join(settings.userDir,ffBase+"_cred"+ffExt); // if creds file exists in "old" location userdir then use it
|
||||
if (!fs.existsSync(credentialsFile)) { // if not then locate it next to flows file in flows dir
|
||||
credentialsFile = fspath.join(fspath.dirname(flowsFullPath), ffBase+"_cred"+ffExt);
|
||||
}
|
||||
credentialsFile = fspath.join(settings.userDir,ffBase+"_cred"+ffExt);
|
||||
credentialsFileBackup = getBackupFilename(credentialsFile)
|
||||
|
||||
var setupProjectsPromise;
|
||||
|
||||
@@ -211,7 +211,7 @@ describe('HTTP Request Node', function() {
|
||||
} else {
|
||||
hash = crypto.createHash('md5');
|
||||
}
|
||||
|
||||
|
||||
var hex = hash.update(value).digest('hex');
|
||||
if (algorithm === 'SHA-512-256') {
|
||||
hex = hex.slice(0, 64);
|
||||
@@ -1802,10 +1802,37 @@ describe('HTTP Request Node', function() {
|
||||
})
|
||||
});
|
||||
|
||||
it('should use pfx tls file', function(done) {
|
||||
var flow = [
|
||||
{id:"n1",type:"http request",wires:[["n2"]],method:"GET",ret:"txt",url:getSslTestURLWithoutProtocol('/text'),tls:"n3"},
|
||||
{id:"n2", type:"helper"},
|
||||
{id:"n3", type:"tls-config", p12:"test/resources/ssl/test.pfx", verifyservercert:false}];
|
||||
var testNodes = [httpRequestNode, tlsNode];
|
||||
helper.load(testNodes, flow, function() {
|
||||
var n3 = helper.getNode("n3");
|
||||
var n2 = helper.getNode("n2");
|
||||
var n1 = helper.getNode("n1");
|
||||
n2.on("input", function(msg) {
|
||||
try {
|
||||
msg.should.have.property('payload','hello');
|
||||
msg.should.have.property('statusCode',200);
|
||||
msg.should.have.property('headers');
|
||||
msg.headers.should.have.property('content-length',''+('hello'.length));
|
||||
msg.headers.should.have.property('content-type').which.startWith('text/html');
|
||||
msg.should.have.property('responseUrl').which.startWith('https://');
|
||||
done();
|
||||
} catch(err) {
|
||||
done(err);
|
||||
}
|
||||
});
|
||||
n1.receive({payload:"foo"});
|
||||
});
|
||||
});
|
||||
|
||||
it('should use env var http_proxy', function(done) {
|
||||
const url = getTestURL('/postInspect')
|
||||
const proxyUrl = "http://localhost:" + testProxyPort
|
||||
|
||||
|
||||
const flow = [
|
||||
{ id: "n1", type: "http request", wires: [["n2"]], method: "POST", ret: "obj", url: url },
|
||||
{ id: "n2", type: "helper" },
|
||||
@@ -1830,7 +1857,7 @@ describe('HTTP Request Node', function() {
|
||||
it('should use env var https_proxy', function(done) {
|
||||
const url = getSslTestURL('/postInspect')
|
||||
const proxyUrl = "http://localhost:" + testProxyPort
|
||||
|
||||
|
||||
const flow = [
|
||||
{ id: "n1", type: "http request", wires: [["n2"]], method: "POST", ret: "obj", url: url },
|
||||
{ id: "n2", type: "helper" },
|
||||
@@ -1855,7 +1882,7 @@ describe('HTTP Request Node', function() {
|
||||
it('should not use env var http*_proxy when no_proxy is set', function(done) {
|
||||
const url = getSslTestURL('/postInspect')
|
||||
const proxyUrl = "http://localhost:" + testProxyPort
|
||||
|
||||
|
||||
const flow = [
|
||||
{ id: "n1", type: "http request", wires: [["n2"]], method: "POST", ret: "obj", url: url },
|
||||
{ id: "n2", type: "helper" },
|
||||
|
||||
BIN
test/resources/ssl/test.pfx
Normal file
BIN
test/resources/ssl/test.pfx
Normal file
Binary file not shown.
Reference in New Issue
Block a user