mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-18 18:16:26 +00:00
404 hosts section and other fixes
This commit is contained in:
@ -104,7 +104,7 @@ router
|
||||
})
|
||||
.then(data => {
|
||||
return internalDeadHost.get(res.locals.access, {
|
||||
id: data.host_id,
|
||||
id: parseInt(data.host_id, 10),
|
||||
expand: data.expand
|
||||
});
|
||||
})
|
||||
@ -123,7 +123,7 @@ router
|
||||
.put((req, res, next) => {
|
||||
apiValidator({$ref: 'endpoints/dead-hosts#/links/2/schema'}, req.body)
|
||||
.then(payload => {
|
||||
payload.id = req.params.host_id;
|
||||
payload.id = parseInt(req.params.host_id, 10);
|
||||
return internalDeadHost.update(res.locals.access, payload);
|
||||
})
|
||||
.then(result => {
|
||||
@ -139,7 +139,7 @@ router
|
||||
* Update and existing dead-host
|
||||
*/
|
||||
.delete((req, res, next) => {
|
||||
internalDeadHost.delete(res.locals.access, {id: req.params.host_id})
|
||||
internalDeadHost.delete(res.locals.access, {id: parseInt(req.params.host_id, 10)})
|
||||
.then(result => {
|
||||
res.status(200)
|
||||
.send(result);
|
||||
@ -147,4 +147,38 @@ router
|
||||
.catch(next);
|
||||
});
|
||||
|
||||
/**
|
||||
* Specific dead-host Certificates
|
||||
*
|
||||
* /api/nginx/dead-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/dead-hosts/123/certificates
|
||||
*
|
||||
* Upload certifications
|
||||
*/
|
||||
.post((req, res, next) => {
|
||||
if (!req.files) {
|
||||
res.status(400)
|
||||
.send({error: 'No files were uploaded'});
|
||||
} else {
|
||||
internalDeadHost.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;
|
||||
|
@ -94,17 +94,17 @@ router
|
||||
stream_id: {
|
||||
$ref: 'definitions#/definitions/id'
|
||||
},
|
||||
expand: {
|
||||
expand: {
|
||||
$ref: 'definitions#/definitions/expand'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
stream_id: req.params.stream_id,
|
||||
expand: (typeof req.query.expand === 'string' ? req.query.expand.split(',') : null)
|
||||
expand: (typeof req.query.expand === 'string' ? req.query.expand.split(',') : null)
|
||||
})
|
||||
.then(data => {
|
||||
return internalStream.get(res.locals.access, {
|
||||
id: data.stream_id,
|
||||
id: parseInt(data.stream_id, 10),
|
||||
expand: data.expand
|
||||
});
|
||||
})
|
||||
@ -123,7 +123,7 @@ router
|
||||
.put((req, res, next) => {
|
||||
apiValidator({$ref: 'endpoints/streams#/links/2/schema'}, req.body)
|
||||
.then(payload => {
|
||||
payload.id = req.params.stream_id;
|
||||
payload.id = parseInt(req.params.stream_id, 10);
|
||||
return internalStream.update(res.locals.access, payload);
|
||||
})
|
||||
.then(result => {
|
||||
@ -139,7 +139,7 @@ router
|
||||
* Update and existing stream
|
||||
*/
|
||||
.delete((req, res, next) => {
|
||||
internalStream.delete(res.locals.access, {id: req.params.stream_id})
|
||||
internalStream.delete(res.locals.access, {id: parseInt(req.params.stream_id, 10)})
|
||||
.then(result => {
|
||||
res.status(200)
|
||||
.send(result);
|
||||
|
Reference in New Issue
Block a user