move updater routes and settings under /api/v1/updater
This commit is contained in:
@@ -13,9 +13,6 @@ exports = module.exports = {
|
||||
getDiskUsage,
|
||||
updateDiskUsage,
|
||||
getMemory,
|
||||
getUpdateInfo,
|
||||
update,
|
||||
checkForUpdates,
|
||||
getLogs,
|
||||
getLogStream,
|
||||
updateDashboardDomain,
|
||||
@@ -44,9 +41,7 @@ const assert = require('assert'),
|
||||
system = require('../system.js'),
|
||||
tokens = require('../tokens.js'),
|
||||
translation = require('../translation.js'),
|
||||
updater = require('../updater.js'),
|
||||
users = require('../users.js'),
|
||||
updateChecker = require('../updatechecker.js');
|
||||
users = require('../users.js');
|
||||
|
||||
async function login(req, res, next) {
|
||||
assert.strictEqual(typeof req.user, 'object');
|
||||
@@ -195,30 +190,6 @@ async function getMemory(req, res, next) {
|
||||
next(new HttpSuccess(200, result));
|
||||
}
|
||||
|
||||
async function update(req, res, next) {
|
||||
if ('skipBackup' in req.body && typeof req.body.skipBackup !== 'boolean') return next(new HttpError(400, 'skipBackup must be a boolean'));
|
||||
|
||||
// this only initiates the update, progress can be checked via the progress route
|
||||
const [error, taskId] = await safe(updater.updateToLatest(req.body, AuditSource.fromRequest(req)));
|
||||
if (error && error.reason === BoxError.NOT_FOUND) return next(new HttpError(422, error.message));
|
||||
if (error && error.reason === BoxError.BAD_STATE) return next(new HttpError(409, error.message));
|
||||
if (error) return next(new HttpError(500, error));
|
||||
|
||||
next(new HttpSuccess(202, { taskId }));
|
||||
}
|
||||
|
||||
function getUpdateInfo(req, res, next) {
|
||||
next(new HttpSuccess(200, { update: updateChecker.getUpdateInfo() }));
|
||||
}
|
||||
|
||||
async function checkForUpdates(req, res, next) {
|
||||
// it can take a while sometimes to get all the app updates one by one
|
||||
req.clearTimeout();
|
||||
|
||||
await updateChecker.checkForUpdates({ automatic: false });
|
||||
next(new HttpSuccess(200, { update: updateChecker.getUpdateInfo() }));
|
||||
}
|
||||
|
||||
async function getLogs(req, res, next) {
|
||||
assert.strictEqual(typeof req.params.unit, 'string');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user