system: return uptime and reboot required

This commit is contained in:
Girish Ramakrishnan
2023-12-04 00:46:12 +01:00
parent 72083f59cd
commit eb64bd296a
4 changed files with 16 additions and 10 deletions

View File

@@ -2,7 +2,7 @@
exports = module.exports = {
reboot,
isRebootRequired,
getInfo,
getDisks,
getDiskUsage,
updateDiskUsage,
@@ -30,11 +30,11 @@ async function reboot(req, res, next) {
await safe(system.reboot());
}
async function isRebootRequired(req, res, next) {
const [error, rebootRequired] = await safe(system.isRebootRequired());
async function getInfo(req, res, next) {
const [error, info] = await safe(system.getInfo());
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, { rebootRequired }));
next(new HttpSuccess(200, { info }));
}
async function getDisks(req, res, next) {