mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Refuse to update a non-local node module
This commit is contained in:
parent
8d34f87667
commit
a69683183f
@ -548,12 +548,20 @@ RED.palette.editor = (function() {
|
||||
$("#palette-module-install-confirm").data('module',entry.name);
|
||||
$("#palette-module-install-confirm").data('version',loadedIndex[entry.name].version);
|
||||
$("#palette-module-install-confirm").data('shade',shade);
|
||||
$("#palette-module-install-confirm-body").html(RED._("palette.editor.confirm.update.body"));
|
||||
|
||||
$("#palette-module-install-confirm-body").html(entry.local?
|
||||
RED._("palette.editor.confirm.update.body"):
|
||||
RED._("palette.editor.confirm.cannotUpdate.body")
|
||||
);
|
||||
$(".palette-module-install-confirm-button-install").hide();
|
||||
$(".palette-module-install-confirm-button-remove").hide();
|
||||
if (entry.local) {
|
||||
$(".palette-module-install-confirm-button-update").show();
|
||||
} else {
|
||||
$(".palette-module-install-confirm-button-update").hide();
|
||||
}
|
||||
$("#palette-module-install-confirm")
|
||||
.dialog('option', 'title', RED._("palette.editor.confirm.update.title"))
|
||||
.dialog('option', 'title',RED._("palette.editor.confirm.update.title"))
|
||||
.dialog('open');
|
||||
})
|
||||
|
||||
|
@ -314,6 +314,9 @@
|
||||
"body":"Updating the node will require a restart of Node-RED to complete the update. This must be done manually.",
|
||||
"title": "Update nodes"
|
||||
},
|
||||
"cannotUpdate": {
|
||||
"body":"An update for this node is available, but it is not installed in a location that the palette manager can update.<br/><br/>Please refer to the documentation for how to update this node."
|
||||
},
|
||||
"button": {
|
||||
"review": "Open node information",
|
||||
"install": "Install",
|
||||
|
@ -57,6 +57,11 @@ module.exports = {
|
||||
res.status(400).json({error:"module_already_loaded", message:"Module already loaded"});
|
||||
return;
|
||||
}
|
||||
if (!module.local) {
|
||||
log.audit({event: "nodes.install",module:node.module, version:node.version, error:"module_not_local"},req);
|
||||
res.status(400).json({error:"module_not_local", message:"Module not locally installed"});
|
||||
return;
|
||||
}
|
||||
isUpgrade = true;
|
||||
}
|
||||
promise = redNodes.installModule(node.module,node.version);
|
||||
|
Loading…
Reference in New Issue
Block a user