SSL certificate upload support
This commit is contained in:
@ -147,4 +147,38 @@ router
|
||||
.catch(next);
|
||||
});
|
||||
|
||||
/**
|
||||
* Specific proxy-host Certificates
|
||||
*
|
||||
* /api/nginx/proxy-hosts/123/certificates
|
||||
*/
|
||||
router
|
||||
.route('/:host_id/certificates')
|
||||
.options((req, res) => {
|
||||
res.sendStatus(204);
|
||||
})
|
||||
.all(jwtdecode()) // preferred so it doesn't apply to nonexistent routes
|
||||
|
||||
/**
|
||||
* POST /api/nginx/proxy-hosts/123/certificates
|
||||
*
|
||||
* Upload certifications
|
||||
*/
|
||||
.post((req, res, next) => {
|
||||
if (!req.files) {
|
||||
res.status(400)
|
||||
.send({error: 'No files were uploaded'});
|
||||
} else {
|
||||
internalProxyHost.setCerts(res.locals.access, {
|
||||
id: parseInt(req.params.host_id, 10),
|
||||
files: req.files
|
||||
})
|
||||
.then(result => {
|
||||
res.status(200)
|
||||
.send(result);
|
||||
})
|
||||
.catch(next);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
Reference in New Issue
Block a user