move appstore urls into appstore.js
This commit is contained in:
@@ -13,6 +13,7 @@ exports = module.exports = {
|
||||
};
|
||||
|
||||
const apps = require('./apps.js'),
|
||||
appstore = require('./appstore.js'),
|
||||
assert = require('assert'),
|
||||
AuditSource = require('./auditsource.js'),
|
||||
backuptask = require('./backuptask.js'),
|
||||
@@ -35,9 +36,7 @@ const apps = require('./apps.js'),
|
||||
reverseProxy = require('./reverseproxy.js'),
|
||||
safe = require('safetydance'),
|
||||
services = require('./services.js'),
|
||||
settings = require('./settings.js'),
|
||||
shell = require('./shell.js'),
|
||||
superagent = require('superagent'),
|
||||
_ = require('underscore');
|
||||
|
||||
const MV_VOLUME_CMD = path.join(__dirname, 'scripts/mvvolume.sh'),
|
||||
@@ -206,19 +205,8 @@ async function downloadIcon(app) {
|
||||
|
||||
debug(`downloadIcon: Downloading icon of ${app.appStoreId}@${app.manifest.version}`);
|
||||
|
||||
const iconUrl = settings.apiServerOrigin() + '/api/v1/apps/' + app.appStoreId + '/versions/' + app.manifest.version + '/icon';
|
||||
|
||||
await promiseRetry({ times: 10, interval: 5000, debug }, async function () {
|
||||
const [networkError, response] = await safe(superagent.get(iconUrl)
|
||||
.buffer(true)
|
||||
.timeout(30 * 1000)
|
||||
.ok(() => true));
|
||||
|
||||
if (networkError) throw new BoxError(BoxError.NETWORK_ERROR, `Network error downloading icon : ${networkError.message}`);
|
||||
if (response.status !== 200) return; // ignore error. this can also happen for apps installed with cloudron-cli
|
||||
|
||||
await updateApp(app, { appStoreIcon: response.body });
|
||||
});
|
||||
const appStoreIcon = await appstore.downloadIcon(app.appStoreId, app.manifest.version);
|
||||
await updateApp(app, { appStoreIcon });
|
||||
}
|
||||
|
||||
async function waitForDnsPropagation(app) {
|
||||
|
||||
Reference in New Issue
Block a user