From 3772108eb19317d041c67e1dca2744b10ca7c87c Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Fri, 24 Nov 2023 11:33:58 +0100 Subject: [PATCH] stuff --- Plugins/PluginRepo/PluginRepo.plugin.js | 41 ++++++++++++++------- Plugins/ThemeRepo/ThemeRepo.plugin.js | 42 +++++++++++++++------- Themes/BasicBackground/BasicBackground.css | 7 ++++ Themes/DiscordRecolor/DiscordRecolor.css | 7 ++++ 4 files changed, 73 insertions(+), 24 deletions(-) diff --git a/Plugins/PluginRepo/PluginRepo.plugin.js b/Plugins/PluginRepo/PluginRepo.plugin.js index 4a42a2e88f..e843b57c84 100644 --- a/Plugins/PluginRepo/PluginRepo.plugin.js +++ b/Plugins/PluginRepo/PluginRepo.plugin.js @@ -2,7 +2,7 @@ * @name PluginRepo * @author DevilBro * @authorId 278543574059057154 - * @version 2.5.4 + * @version 2.5.5 * @description Allows you to download all Plugins from BD's Website within Discord * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -65,7 +65,7 @@ module.exports = (_ => { var list; - var loading, cachedPlugins, grabbedPlugins, updateInterval; + var loading, cachedPlugins, grabbedPlugins, updateInterval, errorState; var searchString, searchTimeout, forcedSort, forcedOrder, showOnlyOutdated; var favorites = []; @@ -99,8 +99,8 @@ module.exports = (_ => { NAME: "Name", AUTHORNAME: "Author", VERSION: "Version", - DESCRIPTION: "Description", - RELEASEDATE: "Release Date", + DESCRIPTION: "Description", + RELEASEDATE: "Release Date", STATE: "Update State", DOWNLOADS: "Downloads", LIKES: "Likes", @@ -138,10 +138,10 @@ module.exports = (_ => { state: state }); }).filter(n => n); - 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.downloadable) plugins = plugins.filter(plugin => plugin.state != pluginStates.DOWNLOADABLE); - if (searchString) { + 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.downloadable) plugins = plugins.filter(plugin => plugin.state != pluginStates.DOWNLOADABLE); + if (searchString) { let usedSearchString = searchString.toUpperCase(); let spacelessUsedSearchString = usedSearchString.replace(/\s/g, ""); 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"; 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", { className: BDFDB.disCN._repo, @@ -282,7 +292,7 @@ module.exports = (_ => { 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, children: entries.map(plugin => BDFDB.ReactUtils.createElement(RepoCardComponent, { data: plugin @@ -295,7 +305,7 @@ module.exports = (_ => { render: false, children: [ 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, { type: "Switch", plugin: _this, @@ -817,8 +827,15 @@ module.exports = (_ => { for (let i = 0; i <= 20; i++) checkPlugin(); } 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"}); - else if (response && response.statusCode == 404) BDFDB.NotificationUtils.toast("Failed to fetch Plugin Store from the Website Api due to Connection Issue", {type: "danger"}); + let status = {}; + 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); } diff --git a/Plugins/ThemeRepo/ThemeRepo.plugin.js b/Plugins/ThemeRepo/ThemeRepo.plugin.js index b60b80e8bd..3b710642bc 100644 --- a/Plugins/ThemeRepo/ThemeRepo.plugin.js +++ b/Plugins/ThemeRepo/ThemeRepo.plugin.js @@ -2,7 +2,7 @@ * @name ThemeRepo * @author DevilBro * @authorId 278543574059057154 - * @version 2.5.4s + * @version 2.5.5 * @description Allows you to download all Themes from BD's Website within Discord * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -65,7 +65,7 @@ module.exports = (_ => { var list; - var loading, cachedThemes, grabbedThemes, generatorThemes, updateInterval; + var loading, cachedThemes, grabbedThemes, generatorThemes, updateInterval, errorState; var searchString, searchTimeout, forcedSort, forcedOrder, showOnlyOutdated; var updateGeneratorTimeout, forceRerenderGenerator, nativeCSS, nativeCSSvars; @@ -100,8 +100,8 @@ module.exports = (_ => { NAME: "Name", AUTHORNAME: "Author", VERSION: "Version", - DESCRIPTION: "Description", - RELEASEDATE: "Release Date", + DESCRIPTION: "Description", + RELEASEDATE: "Release Date", STATE: "Update State", DOWNLOADS: "Downloads", LIKES: "Likes", @@ -139,10 +139,10 @@ module.exports = (_ => { state: state }); }).filter(n => n); - 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.downloadable) themes = themes.filter(theme => theme.state != themeStates.DOWNLOADABLE); - if (searchString) { + 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.downloadable) themes = themes.filter(theme => theme.state != themeStates.DOWNLOADABLE); + if (searchString) { let usedSearchString = searchString.toUpperCase(); let spacelessUsedSearchString = usedSearchString.replace(/\s/g, ""); 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 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(_ => { forceRerenderGenerator = false; BDFDB.ReactUtils.forceUpdate(this); @@ -320,7 +331,7 @@ module.exports = (_ => { 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, children: entries.map(theme => BDFDB.ReactUtils.createElement(RepoCardComponent, { data: theme @@ -447,7 +458,7 @@ module.exports = (_ => { render: false, children: [ 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, { type: "Switch", plugin: _this, @@ -1000,8 +1011,15 @@ module.exports = (_ => { for (let i = 0; i <= 20; i++) checkTheme(); } 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"}); - else if (response && response.statusCode == 404) BDFDB.NotificationUtils.toast("Failed to fetch Theme Store from the Website Api due to Connection Issue", {type: "danger"}); + let status = {}; + 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); } diff --git a/Themes/BasicBackground/BasicBackground.css b/Themes/BasicBackground/BasicBackground.css index 58dc59860a..f6bf6f67fd 100644 --- a/Themes/BasicBackground/BasicBackground.css +++ b/Themes/BasicBackground/BasicBackground.css @@ -6126,6 +6126,13 @@ input.input_d266e7:hover:not(:focus) { .image__98a59 { 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")'] { background-image: url(https://discord.com/assets/24aa06be5457e66bdd64.svg) !important; } diff --git a/Themes/DiscordRecolor/DiscordRecolor.css b/Themes/DiscordRecolor/DiscordRecolor.css index 67d9bfb792..8156bf528b 100644 --- a/Themes/DiscordRecolor/DiscordRecolor.css +++ b/Themes/DiscordRecolor/DiscordRecolor.css @@ -937,6 +937,13 @@ html .iconBadge__2abac { .image__98a59 { 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")'] { background-image: url(https://discord.com/assets/24aa06be5457e66bdd64.svg) !important; }