operator: add app update checker route
This commit is contained in:
@@ -40,6 +40,7 @@ exports = module.exports = {
|
||||
restart,
|
||||
exec,
|
||||
execWebSocket,
|
||||
checkForUpdates,
|
||||
|
||||
clone,
|
||||
|
||||
@@ -57,6 +58,7 @@ const apps = require('../apps.js'),
|
||||
HttpError = require('connect-lastmile').HttpError,
|
||||
HttpSuccess = require('connect-lastmile').HttpSuccess,
|
||||
safe = require('safetydance'),
|
||||
updateChecker = require('../updatechecker.js'),
|
||||
users = require('../users.js'),
|
||||
WebSocket = require('ws');
|
||||
|
||||
@@ -801,6 +803,8 @@ async function setMounts(req, res, next) {
|
||||
}
|
||||
|
||||
async function listEventlog(req, res, next) {
|
||||
assert.strictEqual(typeof req.app, 'object');
|
||||
|
||||
const page = typeof req.query.page !== 'undefined' ? parseInt(req.query.page) : 1;
|
||||
if (!page || page < 0) return next(new HttpError(400, 'page query param has to be a postive number'));
|
||||
|
||||
@@ -812,3 +816,13 @@ async function listEventlog(req, res, next) {
|
||||
|
||||
next(new HttpSuccess(200, { eventlogs }));
|
||||
}
|
||||
|
||||
async function checkForUpdates(req, res, next) {
|
||||
assert.strictEqual(typeof req.app, 'object');
|
||||
|
||||
// it can take a while sometimes to get all the app updates one by one
|
||||
req.clearTimeout();
|
||||
|
||||
await updateChecker.checkForUpdates({ automatic: false }); // appId argument is ignored for the moment
|
||||
next(new HttpSuccess(200, { update: updateChecker.getUpdateInfo() }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user