1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 18:29:27 +02:00

Refactor a little bit controllers

This commit is contained in:
Chocobozzz 2021-05-12 14:51:17 +02:00
parent c00100b607
commit c158a5faab
No known key found for this signature in database
GPG key ID: 583A612D890159BE
14 changed files with 625 additions and 504 deletions

View file

@ -18,6 +18,7 @@ const configRouter = express.Router()
const auditLogger = auditLoggerFactory('config')
configRouter.get('/about', getAbout)
configRouter.get('/',
asyncMiddleware(getConfig)
)
@ -27,12 +28,14 @@ configRouter.get('/custom',
ensureUserHasRight(UserRight.MANAGE_CONFIGURATION),
getCustomConfig
)
configRouter.put('/custom',
authenticate,
ensureUserHasRight(UserRight.MANAGE_CONFIGURATION),
customConfigUpdateValidator,
asyncMiddleware(updateCustomConfig)
)
configRouter.delete('/custom',
authenticate,
ensureUserHasRight(UserRight.MANAGE_CONFIGURATION),
@ -67,13 +70,13 @@ function getAbout (req: express.Request, res: express.Response) {
}
}
return res.json(about).end()
return res.json(about)
}
function getCustomConfig (req: express.Request, res: express.Response) {
const data = customConfig()
return res.json(data).end()
return res.json(data)
}
async function deleteCustomConfig (req: express.Request, res: express.Response) {