From 53d3cacb29c39a2d64ccec1c854abd37372b8f56 Mon Sep 17 00:00:00 2001 From: Sqaaakoi Date: Tue, 2 Jul 2024 02:06:41 +1200 Subject: [PATCH] ShowHiddenThings: Show guild member list page (settings, sidebar) with/without community mode --- src/plugins/showHiddenThings/index.ts | 50 +++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/src/plugins/showHiddenThings/index.ts b/src/plugins/showHiddenThings/index.ts index 599bcd36d..8aad1c807 100644 --- a/src/plugins/showHiddenThings/index.ts +++ b/src/plugins/showHiddenThings/index.ts @@ -46,14 +46,24 @@ const settings = definePluginSettings({ description: "Disable filters in Server Discovery search that hide NSFW & disallowed servers.", default: true, }, + showMembersPageInSettings: { + type: OptionType.BOOLEAN, + description: "Shows the member page in the settings of non-community servers even if Show Members in Channel List is enabled, and disable the redirect to the sidebar in community servers.", + default: true, + }, + showMembersPageInSidebar: { + type: OptionType.BOOLEAN, + description: "Shows the member page in sidebar of non-community servers regardless of the Show Members in Channel List setting.", + default: true, + }, }); migratePluginSettings("ShowHiddenThings", "ShowTimeouts"); export default definePlugin({ name: "ShowHiddenThings", - tags: ["ShowTimeouts", "ShowInvitesPaused", "ShowModView", "DisableDiscoveryFilters"], + tags: ["ShowTimeouts", "ShowInvitesPaused", "ShowModView", "DisableDiscoveryFilters", "ShowMembersPage"], description: "Displays various hidden & moderator-only things regardless of permissions.", - authors: [Devs.Dolfies], + authors: [Devs.Dolfies, Devs.Sqaaakoi], patches: [ { find: "showCommunicationDisabledStyles", @@ -123,7 +133,41 @@ export default definePlugin({ match: /\i\.\i\.get\(\{url:\i\.\i\.GUILD_DISCOVERY_VALID_TERM,query:\{term:\i\},oldFormErrors:!0\}\);/g, replace: "Promise.resolve({ body: { valid: true } });" } - } + }, + { + find: ".GUILD_SETTINGS_SAFETY_MODERATION_EXPERIENCE_ENABLED", + predicate: () => settings.store.showMembersPageInSettings, + replacement: { + match: /\i\.hasFeature\(\i\.\i\.ENABLED_MODERATION_EXPERIENCE_FOR_NON_COMMUNITY\)/, + replace: "false" + } + }, + // disable redirect to sidebar + { + find: /\i\.isCommunity\(\).{0,300}WindowLaunchIcon/, + predicate: () => settings.store.showMembersPageInSettings, + replacement: { + match: /\i\.isCommunity\(\)/, + replace: "false" + } + }, + { + find: /ENABLED_MODERATION_EXPERIENCE_FOR_NON_COMMUNITY.{0,500}GUILD_MOD_DASH_MEMBER_SAFETY/, + predicate: () => settings.store.showMembersPageInSidebar, + replacement: { + match: /\i\.hasFeature\(\i\.\i\.ENABLED_MODERATION_EXPERIENCE_FOR_NON_COMMUNITY\)/, + replace: "true" + } + }, + // discord, why does this check have to exist? + { + find: 'type:"INITIALIZE_MEMBER_SAFETY_STORE"', + predicate: () => settings.store.showMembersPageInSidebar, + replacement: { + match: /\i\.hasFeature\(\i\.\i\.ENABLED_MODERATION_EXPERIENCE_FOR_NON_COMMUNITY\)/, + replace: "true" + } + }, ], settings, });