|
|
|
@ -7,7 +7,7 @@ import fs, { stat, renameSync, readFileSync, existsSync, lstatSync, readdirSync
|
|
|
|
|
import { AddonInfoMessage, AddonUninstallModal } from '@vizality/components/addon';
|
|
|
|
|
import { removeDirRecursive } from '@vizality/util/file';
|
|
|
|
|
import { log, warn, error } from '@vizality/util/logger';
|
|
|
|
|
import { open as openModal } from '@vizality/modal';
|
|
|
|
|
import { openModalLazy as openModal } from '@vizality/modal';
|
|
|
|
|
import { isArray } from '@vizality/util/array';
|
|
|
|
|
import { Avatars, Events as _Events } from '@vizality/constants';
|
|
|
|
|
import http from 'isomorphic-git/http/node';
|
|
|
|
@ -565,6 +565,13 @@ export default class AddonManager extends Events {
|
|
|
|
|
git = `https://github.com/vizality-community/${addonId}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The addonId supplied might be a GitHub repository URL
|
|
|
|
|
*/
|
|
|
|
|
if (!git) {
|
|
|
|
|
git = addonId
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The URL must end in git to get processed by isomorphic-git below.
|
|
|
|
|
*/
|
|
|
|
@ -635,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)} 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: [
|
|
|
|
|
{
|
|
|
|
@ -920,7 +927,9 @@ export default class AddonManager extends Events {
|
|
|
|
|
if (!addon) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
openModal(() => <AddonUninstallModal addon={addon} type={this.type} />);
|
|
|
|
|
|
|
|
|
|
if (!openModal) return this._error(`Can't find DeprecatedModal module within Discord`)
|
|
|
|
|
openModal(() => ModalArgs => <AddonUninstallModal {...ModalArgs} addon={addon} type={this.type} />);
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return this._error(err);
|
|
|
|
|
}
|
|
|
|
|