feat(ShowHiddenThings): Remove Discovery banned/NSFW filters (#2453)

This commit is contained in:
dolfies 2024-05-13 01:09:19 -04:00 committed by GitHub
parent f6765818d2
commit 59ee9c501d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 2 deletions

View file

@ -1,6 +1,6 @@
# ShowHiddenThings # ShowHiddenThings
Displays various moderator-only elements regardless of permissions. Displays various hidden & moderator-only things regardless of permissions.
## Features ## Features
@ -15,3 +15,5 @@ Displays various moderator-only elements regardless of permissions.
![](https://github.com/Vendicated/Vencord/assets/47677887/3dac95dd-841c-4c15-ad87-2db7bd1e4dab) ![](https://github.com/Vendicated/Vencord/assets/47677887/3dac95dd-841c-4c15-ad87-2db7bd1e4dab)
- Disable filters in Server Discovery search that hide servers that don't meet discovery criteria - Disable filters in Server Discovery search that hide servers that don't meet discovery criteria
- Disable filters in Server Discovery search that hide NSFW & disallowed servers

View file

@ -41,13 +41,18 @@ const settings = definePluginSettings({
description: "Disable filters in Server Discovery search that hide servers that don't meet discovery criteria.", description: "Disable filters in Server Discovery search that hide servers that don't meet discovery criteria.",
default: true, default: true,
}, },
disableDisallowedDiscoveryFilters: {
type: OptionType.BOOLEAN,
description: "Disable filters in Server Discovery search that hide NSFW & disallowed servers.",
default: true,
},
}); });
migratePluginSettings("ShowHiddenThings", "ShowTimeouts"); migratePluginSettings("ShowHiddenThings", "ShowTimeouts");
export default definePlugin({ export default definePlugin({
name: "ShowHiddenThings", name: "ShowHiddenThings",
tags: ["ShowTimeouts", "ShowInvitesPaused", "ShowModView", "DisableDiscoveryFilters"], tags: ["ShowTimeouts", "ShowInvitesPaused", "ShowModView", "DisableDiscoveryFilters"],
description: "Displays various moderator-only elements regardless of permissions.", description: "Displays various hidden & moderator-only things regardless of permissions.",
authors: [Devs.Dolfies], authors: [Devs.Dolfies],
patches: [ patches: [
{ {
@ -81,6 +86,23 @@ export default definePlugin({
match: /filters:\i\.join\(" AND "\),facets:\[/, match: /filters:\i\.join\(" AND "\),facets:\[/,
replace: "facets:[" replace: "facets:["
} }
},
{
find: "DiscoveryBannedSearchWords.includes",
predicate: () => settings.store.disableDisallowedDiscoveryFilters,
replacement: {
match: /(?<=function\(\){)(?=.{0,130}DiscoveryBannedSearchWords\.includes)/,
replace: "return false;"
}
},
{
find: "Endpoints.GUILD_DISCOVERY_VALID_TERM",
predicate: () => settings.store.disableDisallowedDiscoveryFilters,
all: true,
replacement: {
match: /\i\.HTTP\.get\(\{url:\i\.Endpoints\.GUILD_DISCOVERY_VALID_TERM,query:\{term:\i\},oldFormErrors:!0\}\);/g,
replace: "Promise.resolve({ body: { valid: true } });"
}
} }
], ],
settings, settings,