mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fix reauthentication of remote repositories
This commit is contained in:
@@ -512,6 +512,23 @@ module.exports = {
|
||||
});
|
||||
});
|
||||
|
||||
// Update a remote
|
||||
app.put("/:id/remotes/:remoteName", needsPermission("projects.write"), function(req,res) {
|
||||
var projectName = req.params.id;
|
||||
var remoteName = req.params.remoteName;
|
||||
runtime.storage.projects.updateRemote(req.user, projectName, remoteName, req.body).then(function(data) {
|
||||
res.status(204).end();
|
||||
})
|
||||
.catch(function(err) {
|
||||
if (err.code) {
|
||||
res.status(400).json({error:err.code, message: err.message});
|
||||
} else {
|
||||
res.status(400).json({error:"unexpected_error", message:err.toString()});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
return app;
|
||||
}
|
||||
}
|
||||
|
@@ -63,12 +63,15 @@ module.exports = {
|
||||
// console.log('username:', username);
|
||||
runtime.storage.sshkeys.getSSHKey(username, req.params.id)
|
||||
.then(function(data) {
|
||||
res.json({
|
||||
publickey: data
|
||||
});
|
||||
if (data) {
|
||||
res.json({
|
||||
publickey: data
|
||||
});
|
||||
} else {
|
||||
res.status(404).end();
|
||||
}
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.log(err.stack);
|
||||
if (err.code) {
|
||||
res.status(400).json({error:err.code, message: err.message});
|
||||
} else {
|
||||
@@ -90,7 +93,6 @@ module.exports = {
|
||||
});
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.log(err.stack);
|
||||
if (err.code) {
|
||||
res.status(400).json({error:err.code, message: err.message});
|
||||
} else {
|
||||
@@ -107,11 +109,10 @@ module.exports = {
|
||||
app.delete("/:id", needsPermission("settings.write"), function(req,res) {
|
||||
var username = getUsername(req.user);
|
||||
runtime.storage.sshkeys.deleteSSHKey(username, req.params.id)
|
||||
.then(function(ret) {
|
||||
.then(function() {
|
||||
res.status(204).end();
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.log(err.stack);
|
||||
if (err.code) {
|
||||
res.status(400).json({error:err.code, message: err.message});
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user