Updated one click app auto generated list

This commit is contained in:
Kasra Bigdeli 2019-12-02 22:22:43 -05:00
parent dd939bd4a2
commit d40fb1a793
1 changed files with 20 additions and 1 deletions

View File

@ -16,6 +16,7 @@
.then(function (items) {
const apps = items.filter(v => v.includes('.json'));
const appDetails = [];
for (var i = 0; i < apps.length; i++) {
const contentString = fs.readFileSync(path.join(pathOfApps, apps[i]));
@ -27,12 +28,30 @@
if (captainVersion === "1") {
if (contentString.includes("$$cap_root_domain"))
throw new Error('V1 should not have root domain')
} else {
}
apps[i] = apps[i].replace('.json', '');
if (captainVersion + '' === '2') {
if (!content.displayName) content.displayName = apps[i]
if (!content.description) content.description = ''
if (!content.imageUrl) content.imageUrl = 'https://caprover.com/img/logo.png'
appDetails[i] = {
name: apps[i],
displayName: content.displayName,
description: content.description,
imageUrl: content.imageUrl,
}
}
}
fs.outputJsonSync(pathOfList, {
appList: apps
appList: apps,
appDetails: appDetails
});
})