repo plugins
This commit is contained in:
parent
e481f64574
commit
580b92ef61
|
@ -2,7 +2,7 @@
|
||||||
* @name PluginRepo
|
* @name PluginRepo
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 2.2.5
|
* @version 2.2.6
|
||||||
* @description Allows you to download all Plugins from BD's Website within Discord
|
* @description Allows you to download all Plugins from BD's Website within Discord
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "PluginRepo",
|
"name": "PluginRepo",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "2.2.5",
|
"version": "2.2.6",
|
||||||
"description": "Allows you to download all Plugins from BD's Website within Discord"
|
"description": "Allows you to download all Plugins from BD's Website within Discord"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -84,19 +84,16 @@ module.exports = (_ => {
|
||||||
};
|
};
|
||||||
const buttonData = {
|
const buttonData = {
|
||||||
INSTALLED: {
|
INSTALLED: {
|
||||||
colorClass: "GREEN",
|
|
||||||
backgroundColor: "var(--bdfdb-green)",
|
backgroundColor: "var(--bdfdb-green)",
|
||||||
icon: "CHECKMARK",
|
icon: "CHECKMARK",
|
||||||
text: "USER_SETTINGS_VOICE_INSTALLED_LABEL"
|
text: "USER_SETTINGS_VOICE_INSTALLED_LABEL"
|
||||||
},
|
},
|
||||||
OUTDATED: {
|
OUTDATED: {
|
||||||
colorClass: "RED",
|
|
||||||
backgroundColor: "var(--bdfdb-red)",
|
backgroundColor: "var(--bdfdb-red)",
|
||||||
icon: "CLOSE",
|
icon: "CLOSE",
|
||||||
text: "outdated"
|
text: "outdated"
|
||||||
},
|
},
|
||||||
DOWNLOADABLE: {
|
DOWNLOADABLE: {
|
||||||
colorClass: "BRAND",
|
|
||||||
backgroundColor: "var(--bdfdb-blurple)",
|
backgroundColor: "var(--bdfdb-blurple)",
|
||||||
icon: "DOWNLOAD",
|
icon: "DOWNLOAD",
|
||||||
text: "download"
|
text: "download"
|
||||||
|
@ -440,6 +437,7 @@ module.exports = (_ => {
|
||||||
BDFDB.ReactUtils.createElement(RepoCardDownloadButtonComponent, {
|
BDFDB.ReactUtils.createElement(RepoCardDownloadButtonComponent, {
|
||||||
...buttonData[(Object.entries(pluginStates).find(n => n[1] == this.props.data.state) || [])[0]],
|
...buttonData[(Object.entries(pluginStates).find(n => n[1] == this.props.data.state) || [])[0]],
|
||||||
installed: this.props.data.state == pluginStates.INSTALLED,
|
installed: this.props.data.state == pluginStates.INSTALLED,
|
||||||
|
outdated: this.props.data.state == pluginStates.OUTDATED,
|
||||||
onDownload: _ => {
|
onDownload: _ => {
|
||||||
BDFDB.LibraryRequires.request(this.props.data.rawSourceUrl, (error, response, body) => {
|
BDFDB.LibraryRequires.request(this.props.data.rawSourceUrl, (error, response, body) => {
|
||||||
if (error) BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("download_fail", `Plugin "${this.props.data.name}"`), {type: "danger"});
|
if (error) BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("download_fail", `Plugin "${this.props.data.name}"`), {type: "danger"});
|
||||||
|
@ -483,30 +481,37 @@ module.exports = (_ => {
|
||||||
|
|
||||||
const RepoCardDownloadButtonComponent = class PluginCardDownloadButton extends BdApi.React.Component {
|
const RepoCardDownloadButtonComponent = class PluginCardDownloadButton extends BdApi.React.Component {
|
||||||
render() {
|
render() {
|
||||||
|
const backgroundColor = this.props.doDelete ? buttonData.OUTDATED.backgroundColor : this.props.doUpdate ? buttonData.INSTALLED.backgroundColor : this.props.backgroundColor;
|
||||||
return BDFDB.ReactUtils.createElement("button", {
|
return BDFDB.ReactUtils.createElement("button", {
|
||||||
className: BDFDB.disCN.discoverycardbutton,
|
className: BDFDB.disCN.discoverycardbutton,
|
||||||
style: {backgroundColor: this.props.delete ? BDFDB.DiscordConstants.Colors.STATUS_RED : (BDFDB.DiscordConstants.Colors[this.props.backgroundColor] || this.props.backgroundColor)},
|
style: {backgroundColor: BDFDB.DiscordConstants.Colors[backgroundColor] || backgroundColor},
|
||||||
children: [
|
children: [
|
||||||
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
||||||
className: BDFDB.disCN.discoverycardstaticon,
|
className: BDFDB.disCN.discoverycardstaticon,
|
||||||
width: 16,
|
width: 16,
|
||||||
height: 16,
|
height: 16,
|
||||||
name: this.props.delete ? BDFDB.LibraryComponents.SvgIcon.Names.TRASH : BDFDB.LibraryComponents.SvgIcon.Names[this.props.icon]
|
name: this.props.doDelete ? BDFDB.LibraryComponents.SvgIcon.Names.TRASH : this.props.doUpdate ? BDFDB.LibraryComponents.SvgIcon.Names.DOWNLOAD : BDFDB.LibraryComponents.SvgIcon.Names[this.props.icon]
|
||||||
}),
|
}),
|
||||||
this.props.delete ? BDFDB.LanguageUtils.LanguageStrings.APPLICATION_CONTEXT_MENU_UNINSTALL : (BDFDB.LanguageUtils.LibraryStringsCheck[this.props.text] ? BDFDB.LanguageUtils.LibraryStrings[this.props.text] : BDFDB.LanguageUtils.LanguageStrings[this.props.text])
|
this.props.doDelete ? BDFDB.LanguageUtils.LanguageStrings.APPLICATION_CONTEXT_MENU_UNINSTALL : this.props.doUpdate ? BDFDB.LanguageUtils.LanguageStrings.GAME_ACTION_BUTTON_UPDATE : (BDFDB.LanguageUtils.LibraryStringsCheck[this.props.text] ? BDFDB.LanguageUtils.LibraryStrings[this.props.text] : BDFDB.LanguageUtils.LanguageStrings[this.props.text])
|
||||||
],
|
],
|
||||||
onClick: _ => {
|
onClick: _ => {
|
||||||
if (this.props.delete) typeof this.props.onDelete == "function" && this.props.onDelete();
|
if (this.props.doDelete) typeof this.props.onDelete == "function" && this.props.onDelete();
|
||||||
else typeof this.props.onDelete == "function" && this.props.onDownload();
|
else typeof this.props.onDownload == "function" && this.props.onDownload();
|
||||||
},
|
},
|
||||||
onMouseEnter: this.props.installed && (_ => {
|
onMouseEnter: this.props.installed ? (_ => {
|
||||||
this.props.delete = true;
|
this.props.doDelete = true;
|
||||||
BDFDB.ReactUtils.forceUpdate(this);
|
BDFDB.ReactUtils.forceUpdate(this);
|
||||||
}),
|
}) : this.props.outdated ? (_ => {
|
||||||
onMouseLeave: this.props.installed && (_ => {
|
this.props.doUpdate = true;
|
||||||
this.props.delete = false;
|
|
||||||
BDFDB.ReactUtils.forceUpdate(this);
|
BDFDB.ReactUtils.forceUpdate(this);
|
||||||
})
|
}) : (_ => {}),
|
||||||
|
onMouseLeave: this.props.installed ? (_ => {
|
||||||
|
this.props.doDelete = false;
|
||||||
|
BDFDB.ReactUtils.forceUpdate(this);
|
||||||
|
}) : this.props.outdated ? (_ => {
|
||||||
|
this.props.doUpdate = false;
|
||||||
|
BDFDB.ReactUtils.forceUpdate(this);
|
||||||
|
}) : (_ => {})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @name ThemeRepo
|
* @name ThemeRepo
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 2.2.5
|
* @version 2.2.6
|
||||||
* @description Allows you to download all Themes from BD's Website within Discord
|
* @description Allows you to download all Themes from BD's Website within Discord
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "ThemeRepo",
|
"name": "ThemeRepo",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "2.2.5",
|
"version": "2.2.6",
|
||||||
"description": "Allows you to download all Themes from BD's Website within Discord"
|
"description": "Allows you to download all Themes from BD's Website within Discord"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -85,19 +85,16 @@ module.exports = (_ => {
|
||||||
};
|
};
|
||||||
const buttonData = {
|
const buttonData = {
|
||||||
INSTALLED: {
|
INSTALLED: {
|
||||||
colorClass: "GREEN",
|
|
||||||
backgroundColor: "var(--bdfdb-green)",
|
backgroundColor: "var(--bdfdb-green)",
|
||||||
icon: "CHECKMARK",
|
icon: "CHECKMARK",
|
||||||
text: "USER_SETTINGS_VOICE_INSTALLED_LABEL"
|
text: "USER_SETTINGS_VOICE_INSTALLED_LABEL"
|
||||||
},
|
},
|
||||||
OUTDATED: {
|
OUTDATED: {
|
||||||
colorClass: "RED",
|
|
||||||
backgroundColor: "var(--bdfdb-red)",
|
backgroundColor: "var(--bdfdb-red)",
|
||||||
icon: "CLOSE",
|
icon: "CLOSE",
|
||||||
text: "outdated"
|
text: "outdated"
|
||||||
},
|
},
|
||||||
DOWNLOADABLE: {
|
DOWNLOADABLE: {
|
||||||
colorClass: "BRAND",
|
|
||||||
backgroundColor: "var(--bdfdb-blurple)",
|
backgroundColor: "var(--bdfdb-blurple)",
|
||||||
icon: "DOWNLOAD",
|
icon: "DOWNLOAD",
|
||||||
text: "download"
|
text: "download"
|
||||||
|
@ -869,6 +866,7 @@ module.exports = (_ => {
|
||||||
BDFDB.ReactUtils.createElement(RepoCardDownloadButtonComponent, {
|
BDFDB.ReactUtils.createElement(RepoCardDownloadButtonComponent, {
|
||||||
...buttonData[(Object.entries(themeStates).find(n => n[1] == this.props.data.state) || [])[0]],
|
...buttonData[(Object.entries(themeStates).find(n => n[1] == this.props.data.state) || [])[0]],
|
||||||
installed: this.props.data.state == themeStates.INSTALLED,
|
installed: this.props.data.state == themeStates.INSTALLED,
|
||||||
|
outdated: this.props.data.state == themeStates.OUTDATED,
|
||||||
onDownload: _ => {
|
onDownload: _ => {
|
||||||
list && BDFDB.LibraryRequires.request(this.props.data.rawSourceUrl, (error, response, body) => {
|
list && BDFDB.LibraryRequires.request(this.props.data.rawSourceUrl, (error, response, body) => {
|
||||||
if (error) BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("download_fail", `Theme "${this.props.data.name}"`), {type: "danger"});
|
if (error) BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("download_fail", `Theme "${this.props.data.name}"`), {type: "danger"});
|
||||||
|
@ -902,30 +900,37 @@ module.exports = (_ => {
|
||||||
|
|
||||||
const RepoCardDownloadButtonComponent = class ThemeCardDownloadButton extends BdApi.React.Component {
|
const RepoCardDownloadButtonComponent = class ThemeCardDownloadButton extends BdApi.React.Component {
|
||||||
render() {
|
render() {
|
||||||
|
const backgroundColor = this.props.doDelete ? buttonData.OUTDATED.backgroundColor : this.props.doUpdate ? buttonData.INSTALLED.backgroundColor : this.props.backgroundColor;
|
||||||
return BDFDB.ReactUtils.createElement("button", {
|
return BDFDB.ReactUtils.createElement("button", {
|
||||||
className: BDFDB.disCN.discoverycardbutton,
|
className: BDFDB.disCN.discoverycardbutton,
|
||||||
style: {backgroundColor: this.props.delete ? BDFDB.DiscordConstants.Colors.STATUS_RED : (BDFDB.DiscordConstants.Colors[this.props.backgroundColor] || this.props.backgroundColor)},
|
style: {backgroundColor: BDFDB.DiscordConstants.Colors[backgroundColor] || backgroundColor},
|
||||||
children: [
|
children: [
|
||||||
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
||||||
className: BDFDB.disCN.discoverycardstaticon,
|
className: BDFDB.disCN.discoverycardstaticon,
|
||||||
width: 16,
|
width: 16,
|
||||||
height: 16,
|
height: 16,
|
||||||
name: this.props.delete ? BDFDB.LibraryComponents.SvgIcon.Names.TRASH : BDFDB.LibraryComponents.SvgIcon.Names[this.props.icon]
|
name: this.props.doDelete ? BDFDB.LibraryComponents.SvgIcon.Names.TRASH : this.props.doUpdate ? BDFDB.LibraryComponents.SvgIcon.Names.DOWNLOAD : BDFDB.LibraryComponents.SvgIcon.Names[this.props.icon]
|
||||||
}),
|
}),
|
||||||
this.props.delete ? BDFDB.LanguageUtils.LanguageStrings.APPLICATION_CONTEXT_MENU_UNINSTALL : (BDFDB.LanguageUtils.LibraryStringsCheck[this.props.text] ? BDFDB.LanguageUtils.LibraryStrings[this.props.text] : BDFDB.LanguageUtils.LanguageStrings[this.props.text])
|
this.props.doDelete ? BDFDB.LanguageUtils.LanguageStrings.APPLICATION_CONTEXT_MENU_UNINSTALL : this.props.doUpdate ? BDFDB.LanguageUtils.LanguageStrings.GAME_ACTION_BUTTON_UPDATE : (BDFDB.LanguageUtils.LibraryStringsCheck[this.props.text] ? BDFDB.LanguageUtils.LibraryStrings[this.props.text] : BDFDB.LanguageUtils.LanguageStrings[this.props.text])
|
||||||
],
|
],
|
||||||
onClick: _ => {
|
onClick: _ => {
|
||||||
if (this.props.delete) typeof this.props.onDelete == "function" && this.props.onDelete();
|
if (this.props.doDelete) typeof this.props.onDelete == "function" && this.props.onDelete();
|
||||||
else typeof this.props.onDelete == "function" && this.props.onDownload();
|
else typeof this.props.onDownload == "function" && this.props.onDownload();
|
||||||
},
|
},
|
||||||
onMouseEnter: this.props.installed && (_ => {
|
onMouseEnter: this.props.installed ? (_ => {
|
||||||
this.props.delete = true;
|
this.props.doDelete = true;
|
||||||
BDFDB.ReactUtils.forceUpdate(this);
|
BDFDB.ReactUtils.forceUpdate(this);
|
||||||
}),
|
}) : this.props.outdated ? (_ => {
|
||||||
onMouseLeave: this.props.installed && (_ => {
|
this.props.doUpdate = true;
|
||||||
this.props.delete = false;
|
|
||||||
BDFDB.ReactUtils.forceUpdate(this);
|
BDFDB.ReactUtils.forceUpdate(this);
|
||||||
})
|
}) : (_ => {}),
|
||||||
|
onMouseLeave: this.props.installed ? (_ => {
|
||||||
|
this.props.doDelete = false;
|
||||||
|
BDFDB.ReactUtils.forceUpdate(this);
|
||||||
|
}) : this.props.outdated ? (_ => {
|
||||||
|
this.props.doUpdate = false;
|
||||||
|
BDFDB.ReactUtils.forceUpdate(this);
|
||||||
|
}) : (_ => {})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue