This commit is contained in:
Mirco Wittrien 2022-02-16 15:54:37 +01:00
parent 8346cf91ae
commit 6a3e61b5b1
3 changed files with 65 additions and 63 deletions

View File

@ -251,7 +251,7 @@
"SearchBar": {"props": ["SearchIcon"], "path": "default.prototype"},
"SearchResults": {"class": "searchresultswrap"},
"SearchResultsInner": {"strings": ["SEARCH_HIDE_BLOCKED_MESSAGES", "totalResults", "SEARCH_PAGE_SIZE"]},
"SettingsView": {"lazyLoaded": true},
"SettingsView": {"lazyLoaded": true, "exported": true},
"StandardSidebarView": {"class": "settingswindowstandardsidebarview"},
"ThreadCard": {"strings": ["threadId", "gotoThread", "container"]},
"ThreadSidebar": {"strings": ["channelId", "collectThreadMetadata", "SIDEBAR"]},

View File

@ -2,7 +2,7 @@
* @name PluginRepo
* @author DevilBro
* @authorId 278543574059057154
* @version 2.2.6
* @version 2.2.8
* @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.2.6",
"version": "2.2.8",
"description": "Allows you to download all Plugins from BD's Website within Discord"
}
};
@ -78,7 +78,7 @@ module.exports = (_ => {
INSTALLED: {
backgroundColor: "var(--bdfdb-green)",
icon: "CHECKMARK",
text: "USER_SETTINGS_VOICE_INSTALLED_LABEL"
text: "installed"
},
OUTDATED: {
backgroundColor: "var(--bdfdb-red)",
@ -653,41 +653,17 @@ module.exports = (_ => {
}
onStart () {
BDFDB.PatchUtils.patch(this, (BDFDB.ModuleUtils.findByName("SettingsView") || {}).prototype, "getPredicateSections", {after: e => {
if (BDFDB.ArrayUtils.is(e.returnValue) && e.returnValue.findIndex(n => n.section && (n.section.toLowerCase() == "changelog" || n.section == BDFDB.DiscordConstants.UserSettingsSections.CHANGE_LOG || n.section.toLowerCase() == "logout" || n.section == BDFDB.DiscordConstants.UserSettingsSections.LOGOUT))) {
e.returnValue = e.returnValue.filter(n => n.section != "pluginrepo");
let index = e.returnValue.indexOf(e.returnValue.find(n => n.section == "themes") || e.returnValue.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.DEVELOPER_OPTIONS) || e.returnValue.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.HYPESQUAD_ONLINE));
if (index > -1) {
e.returnValue.splice(index + 1, 0, {
section: "pluginrepo",
label: "Plugin Repo",
element: _ => {
let options = Object.assign({}, this.settings.filters);
options.updated = options.updated && !showOnlyOutdated;
options.outdated = options.outdated || showOnlyOutdated;
options.downloadable = options.downloadable && !showOnlyOutdated;
options.sortKey = forcedSort || Object.keys(sortKeys)[0];
options.orderKey = forcedOrder || Object.keys(orderKeys)[0];
return BDFDB.ReactUtils.createElement(RepoListComponent, options, true);
}
});
if (!e.returnValue.find(n => n.section == "plugins")) e.returnValue.splice(index + 1, 0, {section: "DIVIDER"});
}
}
}});
onStart () {
this.forceUpdateAll();
this.loadPlugins();
updateInterval = BDFDB.TimeUtils.interval(_ => {this.checkForNewPlugins();}, 1000*60*30);
updateInterval = BDFDB.TimeUtils.interval(_ => this.checkForNewPlugins(), 1000*60*30);
}
onStop () {
BDFDB.TimeUtils.clear(updateInterval);
BDFDB.TimeUtils.clear(loading && loading.timeout);
BDFDB.TimeUtils.clear(loading.timeout);
this.forceUpdateAll();
@ -723,6 +699,31 @@ module.exports = (_ => {
processSettingsView (e) {
if (e.node) searchString = "";
else {
if (!BDFDB.PatchUtils.isPatched(this, e.component, "getPredicateSections")) BDFDB.PatchUtils.patch(this, e.component, "getPredicateSections", {after: e2 => {
if (BDFDB.ArrayUtils.is(e2.returnValue) && e2.returnValue.findIndex(n => n.section && (n.section.toLowerCase() == "changelog" || n.section == BDFDB.DiscordConstants.UserSettingsSections.CHANGE_LOG || n.section.toLowerCase() == "logout" || n.section == BDFDB.DiscordConstants.UserSettingsSections.LOGOUT))) {
e2.returnValue = e2.returnValue.filter(n => n.section != "pluginrepo");
let index = e2.returnValue.indexOf(e2.returnValue.find(n => n.section == "themes") || e2.returnValue.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.DEVELOPER_OPTIONS) || e2.returnValue.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.HYPESQUAD_ONLINE));
if (index > -1) {
e2.returnValue.splice(index + 1, 0, {
section: "pluginrepo",
label: "Plugin Repo",
element: _ => {
let options = Object.assign({}, this.settings.filters);
options.updated = options.updated && !showOnlyOutdated;
options.outdated = options.outdated || showOnlyOutdated;
options.downloadable = options.downloadable && !showOnlyOutdated;
options.sortKey = forcedSort || Object.keys(sortKeys)[0];
options.orderKey = forcedOrder || Object.keys(orderKeys)[0];
return BDFDB.ReactUtils.createElement(RepoListComponent, options, true);
}
});
if (!e2.returnValue.find(n => n.section == "plugins")) e2.returnValue.splice(index + 1, 0, {section: "DIVIDER"});
}
}
}});
}
}
processStandardSidebarView (e) {

View File

@ -2,7 +2,7 @@
* @name ThemeRepo
* @author DevilBro
* @authorId 278543574059057154
* @version 2.2.7
* @version 2.2.8
* @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.7",
"version": "2.2.8",
"description": "Allows you to download all Themes from BD's Website within Discord"
}
};
@ -79,7 +79,7 @@ module.exports = (_ => {
INSTALLED: {
backgroundColor: "var(--bdfdb-green)",
icon: "CHECKMARK",
text: "USER_SETTINGS_VOICE_INSTALLED_LABEL"
text: "installed"
},
OUTDATED: {
backgroundColor: "var(--bdfdb-red)",
@ -1163,43 +1163,16 @@ module.exports = (_ => {
}
onStart () {
BDFDB.PatchUtils.patch(this, (BDFDB.ModuleUtils.findByName("SettingsView") || {}).prototype, "getPredicateSections", {after: e => {
if (BDFDB.ArrayUtils.is(e.returnValue) && e.returnValue.findIndex(n => n.section && (n.section.toLowerCase() == "changelog" || n.section == BDFDB.DiscordConstants.UserSettingsSections.CHANGE_LOG || n.section.toLowerCase() == "logout" || n.section == BDFDB.DiscordConstants.UserSettingsSections.LOGOUT))) {
e.returnValue = e.returnValue.filter(n => n.section != "themerepo");
let index = e.returnValue.indexOf(e.returnValue.find(n => n.section == "pluginrepo") || e.returnValue.find(n => n.section == "themes") || e.returnValue.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.DEVELOPER_OPTIONS) || e.returnValue.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.HYPESQUAD_ONLINE));
if (index > -1) {
e.returnValue.splice(index + 1, 0, {
section: "themerepo",
label: "Theme Repo",
element: _ => {
let options = Object.assign({}, this.settings.filters);
options.updated = options.updated && !showOnlyOutdated;
options.outdated = options.outdated || showOnlyOutdated;
options.downloadable = options.downloadable && !showOnlyOutdated;
options.sortKey = forcedSort || Object.keys(sortKeys)[0];
options.orderKey = forcedOrder || Object.keys(orderKeys)[0];
options.useLightMode = BDFDB.DiscordUtils.getTheme() == BDFDB.disCN.themelight;
options.useThemeFixer = false;
options.useCustomCSS = false;
return BDFDB.ReactUtils.createElement(RepoListComponent, options);
}
});
if (!e.returnValue.find(n => n.section == "plugins" || n.section == "pluginrepo")) e.returnValue.splice(index + 1, 0, {section: "DIVIDER"});
}
}
}});
this.forceUpdateAll();
this.loadThemes();
updateInterval = BDFDB.TimeUtils.interval(_ => {this.checkForNewThemes();}, 1000*60*30);
updateInterval = BDFDB.TimeUtils.interval(_ => this.checkForNewThemes(), 1000*60*30);
}
onStop () {
BDFDB.TimeUtils.clear(updateInterval);
BDFDB.TimeUtils.clear(loading && loading.timeout);
BDFDB.TimeUtils.clear(loading.timeout);
this.forceUpdateAll();
@ -1235,6 +1208,34 @@ module.exports = (_ => {
processSettingsView (e) {
if (e.node) searchString = "";
else {
if (!BDFDB.PatchUtils.isPatched(this, e.component, "getPredicateSections")) BDFDB.PatchUtils.patch(this, e.component, "getPredicateSections", {after: e2 => {
if (BDFDB.ArrayUtils.is(e2.returnValue) && e2.returnValue.findIndex(n => n.section && (n.section.toLowerCase() == "changelog" || n.section == BDFDB.DiscordConstants.UserSettingsSections.CHANGE_LOG || n.section.toLowerCase() == "logout" || n.section == BDFDB.DiscordConstants.UserSettingsSections.LOGOUT))) {
e2.returnValue = e2.returnValue.filter(n => n.section != "themerepo");
let index = e2.returnValue.indexOf(e2.returnValue.find(n => n.section == "pluginrepo") || e2.returnValue.find(n => n.section == "themes") || e2.returnValue.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.DEVELOPER_OPTIONS) || e2.returnValue.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.HYPESQUAD_ONLINE));
if (index > -1) {
e2.returnValue.splice(index + 1, 0, {
section: "themerepo",
label: "Theme Repo",
element: _ => {
let options = Object.assign({}, this.settings.filters);
options.updated = options.updated && !showOnlyOutdated;
options.outdated = options.outdated || showOnlyOutdated;
options.downloadable = options.downloadable && !showOnlyOutdated;
options.sortKey = forcedSort || Object.keys(sortKeys)[0];
options.orderKey = forcedOrder || Object.keys(orderKeys)[0];
options.useLightMode = BDFDB.DiscordUtils.getTheme() == BDFDB.disCN.themelight;
options.useThemeFixer = false;
options.useCustomCSS = false;
return BDFDB.ReactUtils.createElement(RepoListComponent, options);
}
});
if (!e2.returnValue.find(n => n.section == "plugins" || n.section == "pluginrepo")) e2.returnValue.splice(index + 1, 0, {section: "DIVIDER"});
}
}
}});
}
}
processStandardSidebarView (e) {