Comparing version 1.2.0 to 1.2.1
59
kdbx.js
@@ -64,36 +64,37 @@ const { open: openDb } = require('./utils/databaseHelper.js') | ||
// collect metadata | ||
if (config.dynamicFile) { | ||
fileData = {} | ||
fileData.file = RED.util.evaluateNodeProperty(config.filePath, config.parameterInputType.filePath, node, msg) | ||
if (config.parameterInputType.keyFilePath === 'no input') { | ||
fileData.keyFile = '' | ||
try { | ||
// collect metadata | ||
if (config.dynamicFile) { | ||
fileData = {} | ||
fileData.file = RED.util.evaluateNodeProperty(config.filePath, config.parameterInputType.filePath, node, msg) | ||
if (config.parameterInputType.keyFilePath === 'no input') { | ||
fileData.keyFile = '' | ||
} else { | ||
fileData.keyFile = RED.util.evaluateNodeProperty(config.keyFilePath, config.parameterInputType.keyFilePath, node, msg) | ||
} | ||
if (config.parameterInputType.filePassword === 'no input') { | ||
fileData.password = '' | ||
} else { | ||
fileData.password = RED.util.evaluateNodeProperty(config.filePassword, config.parameterInputType.filePassword, node, msg) | ||
} | ||
} else { | ||
fileData.keyFile = RED.util.evaluateNodeProperty(config.keyFilePath, config.parameterInputType.keyFilePath, node, msg) | ||
// using static config file | ||
const kdbxFile = RED.nodes.getNode(config.kdbxFile) | ||
fileData.file = kdbxFile.filePath || kdbxFile.credentials.filePath // credential option is legacy | ||
fileData.keyFile = kdbxFile.keyFilePath || kdbxFile.credentials.keyFilePath // credential option is legacy | ||
if (kdbxFile.credentials.password) { | ||
fileData.password = kdbxFile.credentials.password | ||
} else if(kdbxFile.typedInputPassword) { | ||
fileData.password = RED.util.evaluateNodeProperty(kdbxFile.typedInputPassword, kdbxFile.typedInputPasswordType, kdbxFile, msg) | ||
} | ||
} | ||
if (config.parameterInputType.filePassword === 'no input') { | ||
fileData.password = '' | ||
} else { | ||
fileData.password = RED.util.evaluateNodeProperty(config.filePassword, config.parameterInputType.filePassword, node, msg) | ||
if (!fileData.file) { | ||
throw new Error('No file stated.') | ||
} | ||
} else { | ||
// using static config file | ||
const kdbxFile = RED.nodes.getNode(config.kdbxFile) | ||
fileData.file = kdbxFile.filePath || kdbxFile.credentials.filePath // credential option is legacy | ||
fileData.keyFile = kdbxFile.keyFilePath || kdbxFile.credentials.keyFilePath // credential option is legacy | ||
if (kdbxFile.credentials.password) { | ||
fileData.password = kdbxFile.credentials.password | ||
} else if(kdbxFile.typedInputPassword) { | ||
fileData.password = RED.util.evaluateNodeProperty(kdbxFile.typedInputPassword, kdbxFile.typedInputPasswordType, kdbxFile, msg) | ||
if (!fileData.file.endsWith('.kdbx')) { | ||
fileData.file = fileData.file + '.kdbx' | ||
} | ||
} | ||
if (!fileData.file) { | ||
return handleError('No file stated.') | ||
} | ||
if (!fileData.file.endsWith('.kdbx')) { | ||
fileData.file = fileData.file + '.kdbx' | ||
} | ||
try { | ||
// check if database is locally stored in contextFlow (by open Task) else it will be opened for a one use operation | ||
@@ -100,0 +101,0 @@ const parameters = createParameters(RED, msg, config) |
{ | ||
"name": "kdbx-red", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Node-Red nodes to work with keepass files.", | ||
@@ -5,0 +5,0 @@ "author": "Sebastian Meier", |
440363
25