community: download iconUrl
also rename existing db field appStoreIcon to packageIcon
This commit is contained in:
@@ -18,6 +18,7 @@ const apps = require('./apps.js'),
|
||||
backupSites = require('./backupsites.js'),
|
||||
backuptask = require('./backuptask.js'),
|
||||
BoxError = require('./boxerror.js'),
|
||||
community = require('./community.js'),
|
||||
constants = require('./constants.js'),
|
||||
debug = require('debug')('box:apptask'),
|
||||
df = require('./df.js'),
|
||||
@@ -207,12 +208,16 @@ async function verifyManifest(manifest) {
|
||||
async function downloadIcon(app) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
|
||||
if (!app.appStoreId) return; // nothing to download if we dont have an appStoreId
|
||||
let packageIcon = null;
|
||||
if (app.versionsUrl && app.manifest.iconUrl) {
|
||||
debug(`downloadIcon: Downloading community icon ${app.manifest.iconUrl}`);
|
||||
packageIcon = await community.downloadIcon(app.manifest);
|
||||
} else if (app.appStoreId) {
|
||||
debug(`downloadIcon: Downloading icon of ${app.appStoreId}@${app.manifest.version}`);
|
||||
packageIcon = await appstore.downloadIcon(app.appStoreId, app.manifest.version);
|
||||
}
|
||||
|
||||
debug(`downloadIcon: Downloading icon of ${app.appStoreId}@${app.manifest.version}`);
|
||||
|
||||
const appStoreIcon = await appstore.downloadIcon(app.appStoreId, app.manifest.version);
|
||||
await updateApp(app, { appStoreIcon });
|
||||
await updateApp(app, { packageIcon });
|
||||
}
|
||||
|
||||
async function downloadImage(manifest) {
|
||||
|
||||
Reference in New Issue
Block a user