2023-09-05 17:42:35 +00:00
|
|
|
/*
|
|
|
|
* Vencord, a modification for Discord's desktop app
|
|
|
|
* Copyright (c) 2023 Vendicated and contributors
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2024-04-22 23:46:11 +00:00
|
|
|
import { definePluginSettings, migratePluginSettings } from "@api/Settings";
|
2023-09-05 17:42:35 +00:00
|
|
|
import { Devs } from "@utils/constants";
|
2024-04-22 23:46:11 +00:00
|
|
|
import definePlugin, { OptionType } from "@utils/types";
|
2023-09-05 17:42:35 +00:00
|
|
|
|
2024-04-22 23:46:11 +00:00
|
|
|
const settings = definePluginSettings({
|
|
|
|
showTimeouts: {
|
|
|
|
type: OptionType.BOOLEAN,
|
|
|
|
description: "Show member timeout icons in chat.",
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
showInvitesPaused: {
|
|
|
|
type: OptionType.BOOLEAN,
|
|
|
|
description: "Show the invites paused tooltip in the server list.",
|
|
|
|
default: true,
|
|
|
|
},
|
2024-05-08 01:50:26 +00:00
|
|
|
showModView: {
|
|
|
|
type: OptionType.BOOLEAN,
|
|
|
|
description: "Show the member mod view context menu item in all servers.",
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
disableDiscoveryFilters: {
|
|
|
|
type: OptionType.BOOLEAN,
|
|
|
|
description: "Disable filters in Server Discovery search that hide servers that don't meet discovery criteria.",
|
|
|
|
default: true,
|
|
|
|
},
|
2024-05-13 05:09:19 +00:00
|
|
|
disableDisallowedDiscoveryFilters: {
|
|
|
|
type: OptionType.BOOLEAN,
|
|
|
|
description: "Disable filters in Server Discovery search that hide NSFW & disallowed servers.",
|
|
|
|
default: true,
|
|
|
|
},
|
2024-04-22 23:46:11 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
migratePluginSettings("ShowHiddenThings", "ShowTimeouts");
|
2023-09-05 17:42:35 +00:00
|
|
|
export default definePlugin({
|
2024-04-22 23:46:11 +00:00
|
|
|
name: "ShowHiddenThings",
|
2024-05-08 01:50:26 +00:00
|
|
|
tags: ["ShowTimeouts", "ShowInvitesPaused", "ShowModView", "DisableDiscoveryFilters"],
|
2024-05-13 05:09:19 +00:00
|
|
|
description: "Displays various hidden & moderator-only things regardless of permissions.",
|
2023-09-05 17:42:35 +00:00
|
|
|
authors: [Devs.Dolfies],
|
|
|
|
patches: [
|
|
|
|
{
|
|
|
|
find: "showCommunicationDisabledStyles",
|
2024-04-22 23:46:11 +00:00
|
|
|
predicate: () => settings.store.showTimeouts,
|
2023-09-05 17:42:35 +00:00
|
|
|
replacement: {
|
|
|
|
match: /&&\i\.\i\.canManageUser\(\i\.\i\.MODERATE_MEMBERS,\i\.author,\i\)/,
|
|
|
|
replace: "",
|
|
|
|
},
|
|
|
|
},
|
2024-04-22 23:46:11 +00:00
|
|
|
{
|
|
|
|
find: "useShouldShowInvitesDisabledNotif:",
|
|
|
|
predicate: () => settings.store.showInvitesPaused,
|
|
|
|
replacement: {
|
|
|
|
match: /\i\.\i\.can\(\i\.Permissions.MANAGE_GUILD,\i\)/,
|
|
|
|
replace: "true",
|
|
|
|
},
|
2024-05-08 01:50:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
find: "canAccessGuildMemberModViewWithExperiment:",
|
|
|
|
predicate: () => settings.store.showModView,
|
|
|
|
replacement: {
|
|
|
|
match: /return \i\.hasAny\(\i\.computePermissions\(\{user:\i,context:\i,checkElevated:!1\}\),\i\.MemberSafetyPagePermissions\)/,
|
|
|
|
replace: "return true",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2024-05-21 00:28:06 +00:00
|
|
|
find: "prod_discoverable_guilds",
|
2024-05-08 01:50:26 +00:00
|
|
|
predicate: () => settings.store.disableDiscoveryFilters,
|
|
|
|
replacement: {
|
2024-05-21 00:28:06 +00:00
|
|
|
match: /\{"auto_removed:.*?\}/,
|
|
|
|
replace: "{}"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: "MINIMUM_MEMBER_COUNT:",
|
|
|
|
predicate: () => settings.store.disableDiscoveryFilters,
|
|
|
|
replacement: {
|
|
|
|
match: /MINIMUM_MEMBER_COUNT:function\(\)\{return \i}/,
|
|
|
|
replace: "MINIMUM_MEMBER_COUNT:() => \">0\""
|
2024-05-08 01:50:26 +00:00
|
|
|
}
|
2024-05-13 05:09:19 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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 } });"
|
|
|
|
}
|
2024-04-22 23:46:11 +00:00
|
|
|
}
|
2023-09-05 17:42:35 +00:00
|
|
|
],
|
2024-04-22 23:46:11 +00:00
|
|
|
settings,
|
2023-09-05 17:42:35 +00:00
|
|
|
});
|