From fbb3a78274a9842eb8135383722596f9172e572a Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Tue, 7 Jun 2022 08:06:07 +0200 Subject: [PATCH] Update ThemeRepo.plugin.js --- Plugins/ThemeRepo/ThemeRepo.plugin.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Plugins/ThemeRepo/ThemeRepo.plugin.js b/Plugins/ThemeRepo/ThemeRepo.plugin.js index aca1d81931..3da18056cb 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.2.9 + * @version 2.3.0 * @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.2.9", + "version": "2.3.0", "description": "Allows you to download all Themes from BD's Website within Discord" } }; @@ -129,7 +129,7 @@ module.exports = (_ => { filterThemes() { let themes = grabbedThemes.map(theme => { const installedTheme = _this.getInstalledTheme(theme); - const state = installedTheme ? (theme.version && BDFDB.NumberUtils.compareVersions(theme.version, _this.getString(installedTheme.version)) ? themeStates.OUTDATED : themeStates.INSTALLED) : themeStates.DOWNLOADABLE; + const state = installedTheme ? (theme.version && _this.compareVersions(theme.version, _this.getString(installedTheme.version)) ? themeStates.OUTDATED : themeStates.INSTALLED) : themeStates.DOWNLOADABLE; return Object.assign(theme, { search: [theme.name, theme.version, theme.authorname, theme.description, theme.tags].flat(10).filter(n => typeof n == "string").join(" ").toUpperCase(), description: theme.description || "No Description found", @@ -1384,7 +1384,7 @@ module.exports = (_ => { if (version) theme.version = version; if (theme.version) { const installedTheme = this.getInstalledTheme(theme); - if (installedTheme && BDFDB.NumberUtils.compareVersions(version, this.getString(installedTheme.version))) outdatedEntries++; + if (installedTheme && this.compareVersions(version, this.getString(installedTheme.version))) outdatedEntries++; } let text = body.trim(); let hasMETAline = text.replace(/\s/g, "").indexOf("//META{"), newMeta = ""; @@ -1469,6 +1469,10 @@ module.exports = (_ => { } return string; } + + compareVersion (v1, v2) { + return v1 == v2 || BDFDB.NumberUtils.compareVersions(v1, v2); + } getInstalledTheme (theme) { if (!theme || typeof theme.authorname != "string") return;