|
|
|
@ -9,7 +9,7 @@ import { removeDirRecursive } from '@vizality/util/file';
|
|
|
|
|
import { log, warn, error } from '@vizality/util/logger';
|
|
|
|
|
import { openModalLazy as openModal } from '@vizality/modal';
|
|
|
|
|
import { isArray } from '@vizality/util/array';
|
|
|
|
|
import { Avatars, Events as _Events } from '@vizality/constants';
|
|
|
|
|
import { Avatars, Events as _Events, Protocols } from '@vizality/constants';
|
|
|
|
|
import http from 'isomorphic-git/http/node';
|
|
|
|
|
import { join, resolve, sep, extname } from 'path';
|
|
|
|
|
import { clone } from 'isomorphic-git';
|
|
|
|
@ -642,7 +642,7 @@ export default class AddonManager extends Events {
|
|
|
|
|
vizality.api.notifications.sendToast({
|
|
|
|
|
id: 'addon-installed',
|
|
|
|
|
header: Messages.VIZALITY_ADDON_SUCCESSFULLY_INSTALLED.format({ type: toTitleCase(this.type) }),
|
|
|
|
|
content: <AddonInfoMessage addon={this.get(addonId) || { manifest: { name: addonId }}} message={Messages.VIZALITY_ADDON_SUCCESSFULLY_INSTALLED_DESC.format({ type: toTitleCase(this.type) })} />,
|
|
|
|
|
content: <AddonInfoMessage addon={this.get(addonId) || { manifest: { name: addonId } }} message={Messages.VIZALITY_ADDON_SUCCESSFULLY_INSTALLED_DESC.format({ type: toTitleCase(this.type) })} />,
|
|
|
|
|
icon: toTitleCase(this.type),
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
@ -757,13 +757,13 @@ export default class AddonManager extends Events {
|
|
|
|
|
if (!validExtensions.some(ext => manifest.icon.endsWith(ext))) {
|
|
|
|
|
this._warn(`${toTitleCase(this.type)} icon must be of type .png, .jpg, or .jpeg.`);
|
|
|
|
|
} else {
|
|
|
|
|
return manifest.icon = `vizality://${toPlural(this.type)}/${addonId}/${manifest.icon}`;
|
|
|
|
|
return manifest.icon = `${Protocols[toPlural(this.type).toUpperCase()]}/${addonId}/${manifest.icon}`;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (validExtensions.some(ext => existsSync(resolve(this.dir, addonId, 'assets', `icon${ext}`)))) {
|
|
|
|
|
for (const ext of validExtensions) {
|
|
|
|
|
if (existsSync(resolve(this.dir, addonId, 'assets', `icon${ext}`))) {
|
|
|
|
|
manifest.icon = `vizality://${toPlural(this.type)}/${addonId}/assets/icon${ext}`;
|
|
|
|
|
manifest.icon = `${Protocols[toPlural(this.type).toUpperCase()]}/${addonId}/assets/icon${ext}`;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -805,7 +805,7 @@ export default class AddonManager extends Events {
|
|
|
|
|
if (!validExtensions.some(ext => screenshot.endsWith(ext))) {
|
|
|
|
|
this._warn(`${toTitleCase(this.type)} screenshots must be of type .png, .jpg, .jpeg, .gif, or .webp`);
|
|
|
|
|
} else {
|
|
|
|
|
screenshotUrls.push(`vizality://${toPlural(this.type)}/${addonId}/${screenshot}`);
|
|
|
|
|
screenshotUrls.push(`${Protocols[toPlural(this.type).toUpperCase()]}/${addonId}/${screenshot}`);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
@ -816,7 +816,7 @@ export default class AddonManager extends Events {
|
|
|
|
|
const validExtensions = [ '.png', '.gif', '.jpg', '.jpeg', '.webp' ];
|
|
|
|
|
readdirSync(screenshotsDir)
|
|
|
|
|
.filter(file => validExtensions.indexOf(extname(file).toLowerCase()) !== -1)
|
|
|
|
|
.map(file => previewImages.push(`vizality://${toPlural(this.type)}/${addonId}/screenshots/${file}`));
|
|
|
|
|
.map(file => previewImages.push(`${Protocols[toPlural(this.type).toUpperCase()]}/${addonId}/screenshots/${file}`));
|
|
|
|
|
return manifest.screenshots = previewImages;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|