repo plugins
This commit is contained in:
parent
6c733e3f3a
commit
a0b29b41d7
|
@ -2,7 +2,7 @@
|
|||
* @name PluginRepo
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 2.3.3
|
||||
* @version 2.3.4
|
||||
* @description Allows you to download all Plugins from BD's Website within Discord
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "PluginRepo",
|
||||
"author": "DevilBro",
|
||||
"version": "2.3.3",
|
||||
"version": "2.3.4",
|
||||
"description": "Allows you to download all Plugins from BD's Website within Discord"
|
||||
}
|
||||
};
|
||||
|
@ -213,8 +213,8 @@ module.exports = (_ => {
|
|||
plugin: _this,
|
||||
keys: ["general", key],
|
||||
label: _this.defaults.general[key].description,
|
||||
note: key == "rnmStart" && !automaticLoading && "Automatic Loading has to be enabled",
|
||||
disabled: key == "rnmStart" && !automaticLoading,
|
||||
note: _this.defaults.general[key].autoload && !automaticLoading && "Automatic Loading has to be enabled",
|
||||
disabled: _this.defaults.general[key].autoload && !automaticLoading,
|
||||
value: _this.settings.general[key],
|
||||
onChange: value => {
|
||||
_this.settings.general[key] = value;
|
||||
|
@ -443,6 +443,7 @@ module.exports = (_ => {
|
|||
if (this.props.downloading) return;
|
||||
this.props.downloading = true;
|
||||
let loadingToast = BDFDB.NotificationUtils.toast(`${BDFDB.LanguageUtils.LibraryStringsFormat("loading", this.props.data.name)} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}`, {timeout: 0, ellipsis: true});
|
||||
let autoloadKey = this.props.data.state == pluginStates.OUTDATED ? "startUpdated" : "startDownloaded";
|
||||
BDFDB.LibraryRequires.request(this.props.data.rawSourceUrl, (error, response, body) => {
|
||||
if (error) {
|
||||
delete this.props.downloading;
|
||||
|
@ -456,7 +457,7 @@ module.exports = (_ => {
|
|||
if (error2) BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("save_fail", `Plugin "${this.props.data.name}"`), {type: "danger"});
|
||||
else {
|
||||
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("save_success", `Plugin "${this.props.data.name}"`), {type: "success"});
|
||||
if (_this.settings.general.rnmStart) BDFDB.TimeUtils.timeout(_ => {
|
||||
if (_this.settings.general[autoloadKey]) BDFDB.TimeUtils.timeout(_ => {
|
||||
if (this.props.data.state == pluginStates.INSTALLED && BDFDB.BDUtils.isPluginEnabled(this.props.data.name) == false) {
|
||||
BDFDB.BDUtils.enablePlugin(this.props.data.name, false);
|
||||
BDFDB.LogUtils.log(BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_started", this.props.data.name), _this);
|
||||
|
@ -511,7 +512,7 @@ module.exports = (_ => {
|
|||
],
|
||||
onClick: _ => {
|
||||
if (this.props.doDelete) typeof this.props.onDelete == "function" && this.props.onDelete();
|
||||
else typeof this.props.onDownload == "function" && this.props.onDownload();
|
||||
else if (!this.props.installed) typeof this.props.onDownload == "function" && this.props.onDownload();
|
||||
},
|
||||
onMouseEnter: this.props.installed ? (_ => {
|
||||
this.props.doDelete = true;
|
||||
|
@ -653,9 +654,10 @@ module.exports = (_ => {
|
|||
|
||||
this.defaults = {
|
||||
general: {
|
||||
notifyOutdated: {value: true, description: "Get a Notification when one of your Plugins is outdated"},
|
||||
notifyNewEntries: {value: true, description: "Get a Notification when there are new Entries in the Repo"},
|
||||
rnmStart: {value: true, description: "Start Plugin after Download"}
|
||||
notifyOutdated: {value: true, autoload: false, description: "Get a Notification when one of your Plugins is outdated"},
|
||||
notifyNewEntries: {value: true, autoload: false, description: "Get a Notification when there are new Entries in the Repo"},
|
||||
startDownloaded: {value: false, autoload: true, description: "Start new Plugins after Download"},
|
||||
startUpdated: {value: false, autoload: true, description: "Start updated Plugins after Download"}
|
||||
},
|
||||
filters: {
|
||||
updated: {value: true, description: "Updated"},
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @name ThemeRepo
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 2.3.3
|
||||
* @version 2.3.4
|
||||
* @description Allows you to download all Themes from BD's Website within Discord
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "ThemeRepo",
|
||||
"author": "DevilBro",
|
||||
"version": "2.3.3",
|
||||
"version": "2.3.4",
|
||||
"description": "Allows you to download all Themes from BD's Website within Discord"
|
||||
}
|
||||
};
|
||||
|
@ -337,7 +337,7 @@ module.exports = (_ => {
|
|||
break;
|
||||
}
|
||||
}
|
||||
createThemeFile(name, filename, body) {
|
||||
createThemeFile(name, filename, body, autoloadKey) {
|
||||
return new Promise(callback => BDFDB.LibraryRequires.fs.writeFile(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getThemesFolder(), filename), body, error => {
|
||||
if (error) {
|
||||
callback(true);
|
||||
|
@ -345,7 +345,7 @@ module.exports = (_ => {
|
|||
}
|
||||
else {
|
||||
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("save_success", `Theme "${name}"`), {type: "success"});
|
||||
if (_this.settings.general.rnmStart) BDFDB.TimeUtils.timeout(_ => {
|
||||
if (_this.settings.general[autoloadKey]) BDFDB.TimeUtils.timeout(_ => {
|
||||
if (BDFDB.BDUtils.isThemeEnabled(name) == false) {
|
||||
BDFDB.BDUtils.enableTheme(name, false);
|
||||
BDFDB.LogUtils.log(BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_started", name), _this);
|
||||
|
@ -463,11 +463,11 @@ module.exports = (_ => {
|
|||
children: "Download",
|
||||
onClick: _ => {
|
||||
if (this.props.currentGeneratorIsNative) {
|
||||
this.createThemeFile("Discord", "Discord.theme.css", `/**\n * @name Discord\n * @description Allow you to easily customize Discord's native Look \n * @author DevilBro\n * @version 1.0.0\n * @authorId 278543574059057154\n * @invite Jx3TjNS\n * @donate https://www.paypal.me/MircoWittrien\n * @patreon https://www.patreon.com/MircoWittrien\n */\n\n` + this.generateTheme(nativeCSSvars));
|
||||
this.createThemeFile("Discord", "Discord.theme.css", `/**\n * @name Discord\n * @description Allow you to easily customize Discord's native Look \n * @author DevilBro\n * @version 1.0.0\n * @authorId 278543574059057154\n * @invite Jx3TjNS\n * @donate https://www.paypal.me/MircoWittrien\n * @patreon https://www.patreon.com/MircoWittrien\n */\n\n` + this.generateTheme(nativeCSSvars), "startDownloaded");
|
||||
}
|
||||
else {
|
||||
let generatorTheme = generatorThemes.find(t => t.id == this.props.currentGenerator);
|
||||
if (generatorTheme) this.createThemeFile(generatorTheme.name, generatorTheme.name + ".theme.css", this.generateTheme(generatorTheme.fullCSS));
|
||||
if (generatorTheme) this.createThemeFile(generatorTheme.name, generatorTheme.name + ".theme.css", this.generateTheme(generatorTheme.fullCSS), "startDownloaded");
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
@ -564,8 +564,8 @@ module.exports = (_ => {
|
|||
plugin: _this,
|
||||
keys: ["general", key],
|
||||
label: _this.defaults.general[key].description,
|
||||
note: key == "rnmStart" && !automaticLoading && "Automatic Loading has to be enabled",
|
||||
disabled: key == "rnmStart" && !automaticLoading,
|
||||
note: _this.defaults.general[key].autoload && !automaticLoading && "Automatic Loading has to be enabled",
|
||||
disabled: _this.defaults.general[key].autoload && !automaticLoading,
|
||||
value: _this.settings.general[key],
|
||||
onChange: value => {
|
||||
_this.settings.general[key] = value;
|
||||
|
@ -626,7 +626,7 @@ module.exports = (_ => {
|
|||
children: "Download",
|
||||
onClick: _ => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/ThemeRepo/_res/ThemeFixer.css", (error, response, body) => {
|
||||
this.createThemeFile("ThemeFixer", "ThemeFixer.theme.css", `/**\n * @name ThemeFixer\n * @description ThemeFixerCSS for transparent themes\n * @author DevilBro\n * @version 1.0.3\n * @authorId 278543574059057154\n * @invite Jx3TjNS\n * @donate https://www.paypal.me/MircoWittrien\n * @patreon https://www.patreon.com/MircoWittrien\n */\n\n` + this.createFixerCSS(body));
|
||||
this.createThemeFile("ThemeFixer", "ThemeFixer.theme.css", `/**\n * @name ThemeFixer\n * @description ThemeFixerCSS for transparent themes\n * @author DevilBro\n * @version 1.0.3\n * @authorId 278543574059057154\n * @invite Jx3TjNS\n * @donate https://www.paypal.me/MircoWittrien\n * @patreon https://www.patreon.com/MircoWittrien\n */\n\n` + this.createFixerCSS(body), "startDownloaded");
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
@ -877,13 +877,14 @@ module.exports = (_ => {
|
|||
if (!list || this.props.downloading) return;
|
||||
this.props.downloading = true;
|
||||
let loadingToast = BDFDB.NotificationUtils.toast(`${BDFDB.LanguageUtils.LibraryStringsFormat("loading", this.props.data.name)} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}`, {timeout: 0, ellipsis: true});
|
||||
let autoloadKey = this.props.data.state == pluginStates.OUTDATED ? "startUpdated" : "startDownloaded";
|
||||
BDFDB.LibraryRequires.request(this.props.data.rawSourceUrl, (error, response, body) => {
|
||||
if (error) {
|
||||
delete this.props.downloading;
|
||||
loadingToast.close();
|
||||
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("download_fail", `Theme "${this.props.data.name}"`), {type: "danger"});
|
||||
}
|
||||
else list.createThemeFile(this.props.data.name, this.props.data.rawSourceUrl.split("/").pop(), body).then(error2 => {
|
||||
else list.createThemeFile(this.props.data.name, this.props.data.rawSourceUrl.split("/").pop(), body, autoloadKey).then(error2 => {
|
||||
delete this.props.downloading;
|
||||
loadingToast.close();
|
||||
if (!error2) {
|
||||
|
@ -935,7 +936,7 @@ module.exports = (_ => {
|
|||
],
|
||||
onClick: _ => {
|
||||
if (this.props.doDelete) typeof this.props.onDelete == "function" && this.props.onDelete();
|
||||
else typeof this.props.onDownload == "function" && this.props.onDownload();
|
||||
else if (!this.props.installed) typeof this.props.onDownload == "function" && this.props.onDownload();
|
||||
},
|
||||
onMouseEnter: this.props.installed ? (_ => {
|
||||
this.props.doDelete = true;
|
||||
|
@ -1078,9 +1079,10 @@ module.exports = (_ => {
|
|||
|
||||
this.defaults = {
|
||||
general: {
|
||||
notifyOutdated: {value: true, description: "Get a Notification when one of your Themes is outdated"},
|
||||
notifyNewEntries: {value: true, description: "Get a Notification when there are new Entries in the Repo"},
|
||||
rnmStart: {value: true, description: "Start Theme after Download"}
|
||||
notifyOutdated: {value: true, autoload: false, description: "Get a Notification when one of your Themes is outdated"},
|
||||
notifyNewEntries: {value: true, autoload: false, description: "Get a Notification when there are new Entries in the Repo"},
|
||||
startDownloaded: {value: false, autoload: true, description: "Start new Themes after Download"},
|
||||
startUpdated: {value: false, autoload: true, description: "Start updated Themes after Download"}
|
||||
},
|
||||
filters: {
|
||||
updated: {value: true, description: "Updated"},
|
||||
|
|
Loading…
Reference in New Issue