nginx-proxy-manager/backend/lib/express/user-id-from-me.js
2020-02-19 13:32:33 +10:00

9 lines
243 B
JavaScript

module.exports = (req, res, next) => {
if (req.params.user_id === 'me' && res.locals.access) {
req.params.user_id = res.locals.access.token.get('attrs').id;
} else {
req.params.user_id = parseInt(req.params.user_id, 10);
}
next();
};