initial implementation of community packages
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
exports = module.exports = {
|
||||
getAppVersion
|
||||
};
|
||||
|
||||
const assert = require('node:assert'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
community = require('../community.js'),
|
||||
HttpSuccess = require('@cloudron/connect-lastmile').HttpSuccess,
|
||||
safe = require('safetydance');
|
||||
|
||||
async function getAppVersion(req, res, next) {
|
||||
assert.strictEqual(typeof req.query.url, 'string');
|
||||
assert.strictEqual(typeof req.query.version, 'string');
|
||||
|
||||
const [error, result] = await safe(community.getAppVersion(req.query.url, req.query.version));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, result));
|
||||
}
|
||||
Reference in New Issue
Block a user