allow installing using version

This commit is contained in:
Girish Ramakrishnan 2016-06-07 16:04:15 -07:00
parent eac6c8deab
commit e33e78be82

View File

@ -163,12 +163,21 @@ Cloudron.prototype.setCredentials = function (password, accessToken) {
};
};
Cloudron.prototype.installApp = function (location, manifest, portBindings) {
Cloudron.prototype.installApp = function (location, manifestOrAppstoreId, portBindings) {
portBindings = portBindings || null; // null binds nothing
var data = {
manifest: typeof manifestOrAppstoreId === 'object' ? manifestOrAppstoreId : null,
appStoreId: typeof manifestOrAppstoreId === 'string' ? manifestOrAppstoreId : null,
location: location,
accessRestriction: null,
oauthProxy: false,
portBindings: portBindings
};
var res = request.post(this._origin + '/api/v1/apps/install')
.query({ access_token: this._credentials.accessToken })
.send({ manifest: manifest, appStoreId: '', location: location, accessRestriction: null, oauthProxy: false, portBindings: portBindings })
.send(data)
.end();
common.verifyResponse2xx(res, 'Cannot install app');
debug('App installed at %s'.green, location);