This commit is contained in:
Mirco Wittrien 2023-11-24 11:33:58 +01:00
parent c864ad7430
commit 3772108eb1
4 changed files with 73 additions and 24 deletions

View File

@ -2,7 +2,7 @@
* @name PluginRepo * @name PluginRepo
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 2.5.4 * @version 2.5.5
* @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
@ -65,7 +65,7 @@ module.exports = (_ => {
var list; var list;
var loading, cachedPlugins, grabbedPlugins, updateInterval; var loading, cachedPlugins, grabbedPlugins, updateInterval, errorState;
var searchString, searchTimeout, forcedSort, forcedOrder, showOnlyOutdated; var searchString, searchTimeout, forcedSort, forcedOrder, showOnlyOutdated;
var favorites = []; var favorites = [];
@ -99,8 +99,8 @@ module.exports = (_ => {
NAME: "Name", NAME: "Name",
AUTHORNAME: "Author", AUTHORNAME: "Author",
VERSION: "Version", VERSION: "Version",
DESCRIPTION: "Description", DESCRIPTION: "Description",
RELEASEDATE: "Release Date", RELEASEDATE: "Release Date",
STATE: "Update State", STATE: "Update State",
DOWNLOADS: "Downloads", DOWNLOADS: "Downloads",
LIKES: "Likes", LIKES: "Likes",
@ -138,10 +138,10 @@ module.exports = (_ => {
state: state state: state
}); });
}).filter(n => n); }).filter(n => n);
if (!this.props.updated) plugins = plugins.filter(plugin => plugin.state != pluginStates.INSTALLED); if (!this.props.updated) plugins = plugins.filter(plugin => plugin.state != pluginStates.INSTALLED);
if (!this.props.outdated) plugins = plugins.filter(plugin => plugin.state != pluginStates.OUTDATED); if (!this.props.outdated) plugins = plugins.filter(plugin => plugin.state != pluginStates.OUTDATED);
if (!this.props.downloadable) plugins = plugins.filter(plugin => plugin.state != pluginStates.DOWNLOADABLE); if (!this.props.downloadable) plugins = plugins.filter(plugin => plugin.state != pluginStates.DOWNLOADABLE);
if (searchString) { if (searchString) {
let usedSearchString = searchString.toUpperCase(); let usedSearchString = searchString.toUpperCase();
let spacelessUsedSearchString = usedSearchString.replace(/\s/g, ""); let spacelessUsedSearchString = usedSearchString.replace(/\s/g, "");
plugins = plugins.filter(plugin => plugin.search.indexOf(usedSearchString) > -1 || plugin.search.indexOf(spacelessUsedSearchString) > -1); plugins = plugins.filter(plugin => plugin.search.indexOf(usedSearchString) > -1 || plugin.search.indexOf(spacelessUsedSearchString) > -1);
@ -156,6 +156,16 @@ module.exports = (_ => {
if (!this.props.tab) this.props.tab = "Plugins"; if (!this.props.tab) this.props.tab = "Plugins";
const entries = (!loading.is && grabbedPlugins.length ? this.filterPlugins() : []); const entries = (!loading.is && grabbedPlugins.length ? this.filterPlugins() : []);
const emptyState = errorState ? {
lightSrc: "/assets/d6dfb89ab06b62044dbb.svg",
darkSrc: "/assets/8eeb59bba0a61cbffc41.svg",
text: "Could not load Plugin Store due to an Issue with the BD Website"
} : !entries.length && !this.props.updated && !this.props.outdated && !this.props.downloadable ? {
text: `You disabled all Filter Options in the "${BDFDB.LanguageUtils.LanguageStrings.SETTINGS}" Tab`
} : !entries.length && searchString ? {
lightSrc: "/assets/75081bdaad2d359c1469.svg",
darkSrc: "/assets/45cd76fed34c8e398cc8.svg"
} : !entries.length ? {} : null;
return BDFDB.ReactUtils.createElement("div", { return BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN._repo, className: BDFDB.disCN._repo,
@ -282,7 +292,7 @@ module.exports = (_ => {
children: `${BDFDB.LanguageUtils.LibraryStringsFormat("loading", "Plugin Repo")} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}` children: `${BDFDB.LanguageUtils.LibraryStringsFormat("loading", "Plugin Repo")} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}`
}) })
] ]
}) : BDFDB.ReactUtils.createElement("div", { }) : emptyState ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.EmptyStateImage, emptyState) : BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.discoverycards, className: BDFDB.disCN.discoverycards,
children: entries.map(plugin => BDFDB.ReactUtils.createElement(RepoCardComponent, { children: entries.map(plugin => BDFDB.ReactUtils.createElement(RepoCardComponent, {
data: plugin data: plugin
@ -295,7 +305,7 @@ module.exports = (_ => {
render: false, render: false,
children: [ children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
title: "Show following Plugins", title: "Shows following Plugins",
children: Object.keys(_this.defaults.filters).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, { children: Object.keys(_this.defaults.filters).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch", type: "Switch",
plugin: _this, plugin: _this,
@ -817,8 +827,15 @@ module.exports = (_ => {
for (let i = 0; i <= 20; i++) checkPlugin(); for (let i = 0; i <= 20; i++) checkPlugin();
} }
catch (err) {BDFDB.NotificationUtils.toast("Failed to load Plugin Store", {type: "danger"});} catch (err) {BDFDB.NotificationUtils.toast("Failed to load Plugin Store", {type: "danger"});}
if (response && response.statusCode == 403) BDFDB.NotificationUtils.toast("Failed to fetch Plugin Store from the Website Api due to DDoS Protection", {type: "danger"}); let status = {};
else if (response && response.statusCode == 404) BDFDB.NotificationUtils.toast("Failed to fetch Plugin Store from the Website Api due to Connection Issue", {type: "danger"}); if (response && response.statusCode == 403) status = {code: response.statusCode, reason: " due to DDoS Protection"};
else if (response && response.statusCode == 404) status = {code: response.statusCode, reason: " due to DDoS Protection"};
else if (response && response.statusCode == 502) status = {code: response.statusCode, reason: ", because the API is down"};
if (status.code) {
BDFDB.NotificationUtils.toast("Failed to fetch Plugin Store from the Website API" + status.reason, {type: "danger"});
errorState = status.code;
}
else errorState = null;
}), 10000); }), 10000);
} }

View File

@ -2,7 +2,7 @@
* @name ThemeRepo * @name ThemeRepo
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 2.5.4s * @version 2.5.5
* @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
@ -65,7 +65,7 @@ module.exports = (_ => {
var list; var list;
var loading, cachedThemes, grabbedThemes, generatorThemes, updateInterval; var loading, cachedThemes, grabbedThemes, generatorThemes, updateInterval, errorState;
var searchString, searchTimeout, forcedSort, forcedOrder, showOnlyOutdated; var searchString, searchTimeout, forcedSort, forcedOrder, showOnlyOutdated;
var updateGeneratorTimeout, forceRerenderGenerator, nativeCSS, nativeCSSvars; var updateGeneratorTimeout, forceRerenderGenerator, nativeCSS, nativeCSSvars;
@ -100,8 +100,8 @@ module.exports = (_ => {
NAME: "Name", NAME: "Name",
AUTHORNAME: "Author", AUTHORNAME: "Author",
VERSION: "Version", VERSION: "Version",
DESCRIPTION: "Description", DESCRIPTION: "Description",
RELEASEDATE: "Release Date", RELEASEDATE: "Release Date",
STATE: "Update State", STATE: "Update State",
DOWNLOADS: "Downloads", DOWNLOADS: "Downloads",
LIKES: "Likes", LIKES: "Likes",
@ -139,10 +139,10 @@ module.exports = (_ => {
state: state state: state
}); });
}).filter(n => n); }).filter(n => n);
if (!this.props.updated) themes = themes.filter(theme => theme.state != themeStates.INSTALLED); if (!this.props.updated) themes = themes.filter(theme => theme.state != themeStates.INSTALLED);
if (!this.props.outdated) themes = themes.filter(theme => theme.state != themeStates.OUTDATED); if (!this.props.outdated) themes = themes.filter(theme => theme.state != themeStates.OUTDATED);
if (!this.props.downloadable) themes = themes.filter(theme => theme.state != themeStates.DOWNLOADABLE); if (!this.props.downloadable) themes = themes.filter(theme => theme.state != themeStates.DOWNLOADABLE);
if (searchString) { if (searchString) {
let usedSearchString = searchString.toUpperCase(); let usedSearchString = searchString.toUpperCase();
let spacelessUsedSearchString = usedSearchString.replace(/\s/g, ""); let spacelessUsedSearchString = usedSearchString.replace(/\s/g, "");
themes = themes.filter(theme => theme.search.indexOf(usedSearchString) > -1 || theme.search.indexOf(spacelessUsedSearchString) > -1); themes = themes.filter(theme => theme.search.indexOf(usedSearchString) > -1 || theme.search.indexOf(spacelessUsedSearchString) > -1);
@ -190,6 +190,17 @@ module.exports = (_ => {
const entries = (!loading.is && grabbedThemes.length ? this.filterThemes() : []); const entries = (!loading.is && grabbedThemes.length ? this.filterThemes() : []);
const emptyState = errorState ? {
lightSrc: "/assets/d6dfb89ab06b62044dbb.svg",
darkSrc: "/assets/8eeb59bba0a61cbffc41.svg",
text: "Could not load Theme Store due to an Issue with the BD Website"
} : !entries.length && !this.props.updated && !this.props.outdated && !this.props.downloadable ? {
text: `You disabled all Filter Options in the "${BDFDB.LanguageUtils.LanguageStrings.SETTINGS}" Tab`
} : !entries.length && searchString ? {
lightSrc: "/assets/75081bdaad2d359c1469.svg",
darkSrc: "/assets/45cd76fed34c8e398cc8.svg"
} : !entries.length ? {} : null;
if (forceRerenderGenerator && this.props.tab == "Generator") BDFDB.TimeUtils.timeout(_ => { if (forceRerenderGenerator && this.props.tab == "Generator") BDFDB.TimeUtils.timeout(_ => {
forceRerenderGenerator = false; forceRerenderGenerator = false;
BDFDB.ReactUtils.forceUpdate(this); BDFDB.ReactUtils.forceUpdate(this);
@ -320,7 +331,7 @@ module.exports = (_ => {
children: `${BDFDB.LanguageUtils.LibraryStringsFormat("loading", "Theme Repo")} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}` children: `${BDFDB.LanguageUtils.LibraryStringsFormat("loading", "Theme Repo")} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}`
}) })
] ]
}) : BDFDB.ReactUtils.createElement("div", { }) : emptyState ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.EmptyStateImage, emptyState) : BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.discoverycards, className: BDFDB.disCN.discoverycards,
children: entries.map(theme => BDFDB.ReactUtils.createElement(RepoCardComponent, { children: entries.map(theme => BDFDB.ReactUtils.createElement(RepoCardComponent, {
data: theme data: theme
@ -447,7 +458,7 @@ module.exports = (_ => {
render: false, render: false,
children: [ children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
title: "Show following Themes", title: "Shows following Themes",
children: Object.keys(_this.defaults.filters).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, { children: Object.keys(_this.defaults.filters).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch", type: "Switch",
plugin: _this, plugin: _this,
@ -1000,8 +1011,15 @@ module.exports = (_ => {
for (let i = 0; i <= 20; i++) checkTheme(); for (let i = 0; i <= 20; i++) checkTheme();
} }
catch (err) {BDFDB.NotificationUtils.toast("Failed to load Theme Store", {type: "danger"});} catch (err) {BDFDB.NotificationUtils.toast("Failed to load Theme Store", {type: "danger"});}
if (response && response.statusCode == 403) BDFDB.NotificationUtils.toast("Failed to fetch Theme Store from the Website Api due to DDoS Protection", {type: "danger"}); let status = {};
else if (response && response.statusCode == 404) BDFDB.NotificationUtils.toast("Failed to fetch Theme Store from the Website Api due to Connection Issue", {type: "danger"}); if (response && response.statusCode == 403) status = {code: response.statusCode, reason: " due to DDoS Protection"};
else if (response && response.statusCode == 404) status = {code: response.statusCode, reason: " due to DDoS Protection"};
else if (response && response.statusCode == 502) status = {code: response.statusCode, reason: ", because the API is down"};
if (status.code) {
BDFDB.NotificationUtils.toast("Failed to fetch Theme Store from the Website API" + status.reason, {type: "danger"});
errorState = status.code;
}
else errorState = null;
}), 10000); }), 10000);
} }

View File

@ -6126,6 +6126,13 @@ input.input_d266e7:hover:not(:focus) {
.image__98a59 { .image__98a59 {
opacity: .5; opacity: .5;
} }
.image__98a59[style*='url("/assets/d6dfb89ab06b62044dbb.svg")'] {
background-image: url(https://discord.com/assets/8eeb59bba0a61cbffc41.svg) !important;
}
.image__98a59[style*='url("/assets/75081bdaad2d359c1469.svg")'] {
background-image: url(https://discord.com/assets/45cd76fed34c8e398cc8.svg) !important;
}
.image__98a59[style*='url("/assets/0629e34902ae58f8e4ca.svg")'] { .image__98a59[style*='url("/assets/0629e34902ae58f8e4ca.svg")'] {
background-image: url(https://discord.com/assets/24aa06be5457e66bdd64.svg) !important; background-image: url(https://discord.com/assets/24aa06be5457e66bdd64.svg) !important;
} }

View File

@ -937,6 +937,13 @@ html .iconBadge__2abac {
.image__98a59 { .image__98a59 {
opacity: .5; opacity: .5;
} }
.image__98a59[style*='url("/assets/d6dfb89ab06b62044dbb.svg")'] {
background-image: url(https://discord.com/assets/8eeb59bba0a61cbffc41.svg) !important;
}
.image__98a59[style*='url("/assets/75081bdaad2d359c1469.svg")'] {
background-image: url(https://discord.com/assets/45cd76fed34c8e398cc8.svg) !important;
}
.image__98a59[style*='url("/assets/0629e34902ae58f8e4ca.svg")'] { .image__98a59[style*='url("/assets/0629e34902ae58f8e4ca.svg")'] {
background-image: url(https://discord.com/assets/24aa06be5457e66bdd64.svg) !important; background-image: url(https://discord.com/assets/24aa06be5457e66bdd64.svg) !important;
} }