Recv/lib/api/admin/status.js

30 lines
515 B
JavaScript
Raw Normal View History

const asyncHandler = require('express-async-handler');
const disk = require('diskusage');
module.exports = (repository, router) =>
{
router.get('/whoami', (req, res) =>
{
res.send({
userId: req.user.id,
username: req.user.username,
auth: req.user.auth
});
});
router.get('/diskspace', (req, res) =>
{
disk.check(config.fileUpload.path, (err, info) =>
{
if (err)
{
res.sendStatus(500);
return;
}
res.send(info);
});
});
}