Browse Source

Add JWT middleware to system status endpoints (#115)

disable-cors
Luke Childs 3 years ago
committed by GitHub
parent
commit
34f7eba1aa
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      routes/v1/system.js

14
routes/v1/system.js

@ -63,6 +63,8 @@ router.get('/get-update', auth.jwt, safeHandler(async (req, res) => {
return res.status(constants.STATUS_CODES.OK).json(update);
}));
// This doesn't require a JWT because we want the user to be able to query
// the update process during the Umbrel restart which will log them out.
router.get('/update-status', safeHandler(async (req, res) => {
const update = await systemLogic.getUpdateStatus();
@ -75,7 +77,7 @@ router.post('/update', auth.jwt, safeHandler(async (req, res) => {
return res.status(constants.STATUS_CODES.OK).json(status);
}));
router.get('/backup-status', safeHandler(async (req, res) => {
router.get('/backup-status', auth.jwt, safeHandler(async (req, res) => {
const backup = await systemLogic.getBackupStatus();
return res.status(constants.STATUS_CODES.OK).json(backup);
@ -105,31 +107,31 @@ router.post('/reboot', auth.jwt, safeHandler(async (req, res) => {
return res.status(constants.STATUS_CODES.OK).json(result);
}));
router.get('/storage', safeHandler(async (req, res) => {
router.get('/storage', auth.jwt, safeHandler(async (req, res) => {
const update = await diskLogic.readSystemStatusFile('storage');
return res.status(constants.STATUS_CODES.OK).json(update);
}));
router.get('/memory', safeHandler(async (req, res) => {
router.get('/memory', auth.jwt, safeHandler(async (req, res) => {
const update = await diskLogic.readSystemStatusFile('memory');
return res.status(constants.STATUS_CODES.OK).json(update);
}));
router.get('/temperature', safeHandler(async (req, res) => {
router.get('/temperature', auth.jwt, safeHandler(async (req, res) => {
const update = await diskLogic.readSystemStatusFile('temperature');
return res.status(constants.STATUS_CODES.OK).json(update);
}));
router.get('/uptime', safeHandler(async (req, res) => {
router.get('/uptime', auth.jwt, safeHandler(async (req, res) => {
const update = await diskLogic.readSystemStatusFile('uptime');
return res.status(constants.STATUS_CODES.OK).json(update);
}));
router.get('/is-umbrel-os', safeHandler(async (req, res) => {
router.get('/is-umbrel-os', auth.jwt, safeHandler(async (req, res) => {
return res.status(constants.STATUS_CODES.OK).json(constants.IS_UMBREL_OS);
}));

Loading…
Cancel
Save