mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Use module:node name to generate set id
This commit is contained in:
parent
c98b9dfaa3
commit
9bfc6d376b
@ -419,7 +419,18 @@ function loadNodesFromModule(moduleDir,pkg) {
|
|||||||
*/
|
*/
|
||||||
function loadNodeConfig(file,module,name) {
|
function loadNodeConfig(file,module,name) {
|
||||||
var id = crypto.createHash('sha1').update(file).digest("hex");
|
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 info = registry.getNodeInfo(id);
|
var info = registry.getNodeInfo(id);
|
||||||
|
|
||||||
var isEnabled = true;
|
var isEnabled = true;
|
||||||
|
@ -242,7 +242,7 @@ function installModule(module) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
var lookFor404 = new RegExp(" 404 .*"+module+"$","m");
|
var lookFor404 = new RegExp(" 404 .*"+module+"$","m");
|
||||||
if (lookFor404.test(stdout)) {
|
if (lookFor404.test(stdout)) {
|
||||||
util.log("[red] Installation of module "+module+" failed: not found");
|
util.log("[red] Installation of module "+module+" failed: module not found");
|
||||||
var e = new Error();
|
var e = new Error();
|
||||||
e.code = 404;
|
e.code = 404;
|
||||||
reject(e);
|
reject(e);
|
||||||
@ -324,7 +324,10 @@ function start() {
|
|||||||
for (i in missingModules) {
|
for (i in missingModules) {
|
||||||
if (missingModules.hasOwnProperty(i)) {
|
if (missingModules.hasOwnProperty(i)) {
|
||||||
util.log(" - "+i+": "+missingModules[i].join(", "));
|
util.log(" - "+i+": "+missingModules[i].join(", "));
|
||||||
promises.push(installModule(i));
|
installModule(i).otherwise(function(err) {
|
||||||
|
// Error already reported. Need the otherwise handler
|
||||||
|
// to stop the error propagating any further
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user