From b7ff6d1e21ac48dbe235cf4d54243b4d5fd4a2ab Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Thu, 18 Oct 2018 12:10:34 +0200 Subject: [PATCH] Repo Plugins --- Plugins/PluginRepo/PluginRepo.plugin.js | 11 +++++++---- Plugins/ThemeRepo/ThemeRepo.plugin.js | 9 ++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Plugins/PluginRepo/PluginRepo.plugin.js b/Plugins/PluginRepo/PluginRepo.plugin.js index 51e5a44179..e5544dcb1e 100644 --- a/Plugins/PluginRepo/PluginRepo.plugin.js +++ b/Plugins/PluginRepo/PluginRepo.plugin.js @@ -1,4 +1,4 @@ -//META{"name":"PluginRepo"}*// +//META{"name":"PluginRepo"}*// class PluginRepo { initConstructor () { @@ -241,7 +241,7 @@ class PluginRepo { getDescription () {return "Allows you to look at all plugins from the plugin repo and download them on the fly. Repo button is in the plugins settings.";} - getVersion () {return "1.5.3";} + getVersion () {return "1.5.4";} getAuthor () {return "DevilBro";} @@ -704,7 +704,7 @@ class PluginRepo { setTimeout(() => {webview.remove();},10000); if (BDFDB.myData.id == "278543574059057154") { let wrongUrls = []; - for (let url of this.foundPlugins) if (url && !this.loadedPlugins[url]) wrongUrls.push(url); + for (let url of this.foundPlugins) if (url && !this.loadedPlugins[url] && !wrongUrls[url]) wrongUrls.push(url); if (wrongUrls.length > 0) { var bar = BDFDB.createNotificationsBar(`PluginRepo: ${wrongUrls.length} Plugin${wrongUrls.length > 1 ? "s" : ""} could not be loaded.`, {type:"danger",btn:"List"}); $(bar).on("click." + this.getName(), BDFDB.dotCN.noticebutton, (e) => { @@ -727,7 +727,10 @@ class PluginRepo { let url = this.foundPlugins[i].replace(new RegExp("[\\r|\\n|\\t]", "g"), ""); this.foundPlugins[i] = url; request(url, (error, response, body) => { - if (response) { + if (!response) { + if (url && BDFDB.getAllIndexes(this.foundPlugins, url).length < 2) this.foundPlugins.push(url); + } + else { let plugin = {}; let bodycopy = body; if (body.length / body.split("\n").length > 1000) { diff --git a/Plugins/ThemeRepo/ThemeRepo.plugin.js b/Plugins/ThemeRepo/ThemeRepo.plugin.js index 6c74ca5e21..3a433be340 100644 --- a/Plugins/ThemeRepo/ThemeRepo.plugin.js +++ b/Plugins/ThemeRepo/ThemeRepo.plugin.js @@ -296,7 +296,7 @@ class ThemeRepo { getDescription () {return "Allows you to preview all themes from the theme repo and download them on the fly. Repo button is in the theme settings.";} - getVersion () {return "1.5.2";} + getVersion () {return "1.5.4";} getAuthor () {return "DevilBro";} @@ -825,7 +825,7 @@ class ThemeRepo { } if (BDFDB.myData.id == "278543574059057154") { let wrongUrls = []; - for (let url of this.foundThemes) if (url && !this.loadedThemes[url]) wrongUrls.push(url); + for (let url of this.foundThemes) if (url && !this.loadedThemes[url] && !wrongUrls[url]) wrongUrls.push(url); if (wrongUrls.length > 0) { var bar = BDFDB.createNotificationsBar(`ThemeRepo: ${wrongUrls.length} Theme${wrongUrls.length > 1 ? "s" : ""} could not be loaded.`, {type:"danger",btn:"List"}); $(bar).on("click." + this.getName(), BDFDB.dotCN.noticebutton, (e) => { @@ -847,7 +847,10 @@ class ThemeRepo { let url = this.foundThemes[i].replace(new RegExp("[\\r|\\n|\\t]", "g"), ""); this.foundThemes[i] = url; request(url, (error, response, body) => { - if (response) { + if (!response) { + if (url && BDFDB.getAllIndexes(this.foundThemes, url).length < 2) this.foundThemes.push(url); + } + else { let theme = {}; let text = body; if (text.split("*//").length > 1 && text.split("\n").length > 1) {