1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

loadNodeConfig assumed to always be called with module and name parameters

This commit is contained in:
Anna Thomas 2014-11-19 13:54:00 +00:00
parent 71bd5cd9e9
commit 9552055b08

View File

@ -475,18 +475,13 @@ function loadNodesFromModule(moduleDir,pkg) {
* }
*/
function loadNodeConfig(file,module,name) {
var id = crypto.createHash('sha1').update(file).digest("hex");
if (module && name) {
var newid = crypto.createHash('sha1').update(module+":"+name).digest("hex");
var existingInfo = registry.getNodeInfo(id);
if (existingInfo) {
// For a brief period, id for modules were calculated incorrectly.
// To prevent false-duplicates, this removes the old id entry
registry.removeNode(id);
registry.saveNodeList();
}
id = newid;
var id = crypto.createHash('sha1').update(module+":"+name).digest("hex");
var existingInfo = registry.getNodeInfo(id);
if (existingInfo) {
// For a brief period, id for modules were calculated incorrectly.
// To prevent false-duplicates, this removes the old id entry
registry.removeNode(id);
registry.saveNodeList();
}
var info = registry.getNodeInfo(id);
@ -507,12 +502,8 @@ function loadNodeConfig(file,module,name) {
loaded:false
};
if (module) {
node.name = module+":"+name;
node.module = module;
} else {
node.name = path.basename(file);
}
node.name = module+":"+name;
node.module = module;
try {
var content = fs.readFileSync(node.template,'utf8');