From 49b0a38c37c58856048958666c133e99035656a8 Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Fri, 20 Sep 2024 15:42:00 -0300
Subject: [PATCH 1/8] UserVoiceShow: Show in messages
---
src/plugins/crashHandler/index.ts | 2 +-
src/plugins/keepCurrentChannel/index.ts | 14 +++++-------
src/plugins/userVoiceShow/components.tsx | 27 ++++++++++++++----------
src/plugins/userVoiceShow/index.tsx | 19 +++++++++++++----
src/plugins/userVoiceShow/style.css | 14 ++++++------
src/webpack/common/types/utils.d.ts | 7 +++++-
src/webpack/common/utils.ts | 4 ++++
7 files changed, 53 insertions(+), 34 deletions(-)
diff --git a/src/plugins/crashHandler/index.ts b/src/plugins/crashHandler/index.ts
index ab881e60cc7..221b115f618 100644
--- a/src/plugins/crashHandler/index.ts
+++ b/src/plugins/crashHandler/index.ts
@@ -175,7 +175,7 @@ export default definePlugin({
}
if (settings.store.attemptToNavigateToHome) {
try {
- NavigationRouter.transitionTo("/channels/@me");
+ NavigationRouter.transitionToGuild("@me");
} catch (err) {
CrashHandlerLogger.debug("Failed to navigate to home", err);
}
diff --git a/src/plugins/keepCurrentChannel/index.ts b/src/plugins/keepCurrentChannel/index.ts
index b226c34e3ee..1e0e742dc85 100644
--- a/src/plugins/keepCurrentChannel/index.ts
+++ b/src/plugins/keepCurrentChannel/index.ts
@@ -19,7 +19,7 @@
import * as DataStore from "@api/DataStore";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
-import { ChannelStore, NavigationRouter, SelectedChannelStore, SelectedGuildStore } from "@webpack/common";
+import { ChannelRouter, SelectedChannelStore, SelectedGuildStore } from "@webpack/common";
export interface LogoutEvent {
type: "LOGOUT";
@@ -40,11 +40,6 @@ interface PreviousChannel {
let isSwitchingAccount = false;
let previousCache: PreviousChannel | undefined;
-function attemptToNavigateToChannel(guildId: string | null, channelId: string) {
- if (!ChannelStore.hasChannel(channelId)) return;
- NavigationRouter.transitionTo(`/channels/${guildId ?? "@me"}/${channelId}`);
-}
-
export default definePlugin({
name: "KeepCurrentChannel",
description: "Attempt to navigate to the channel you were in before switching accounts or loading Discord.",
@@ -59,8 +54,9 @@ export default definePlugin({
if (!isSwitchingAccount) return;
isSwitchingAccount = false;
- if (previousCache?.channelId)
- attemptToNavigateToChannel(previousCache.guildId, previousCache.channelId);
+ if (previousCache?.channelId) {
+ ChannelRouter.transitionToChannel(previousCache.channelId);
+ }
},
async CHANNEL_SELECT({ guildId, channelId }: ChannelSelectEvent) {
@@ -84,7 +80,7 @@ export default definePlugin({
await DataStore.set("KeepCurrentChannel_previousData", previousCache);
} else if (previousCache.channelId) {
- attemptToNavigateToChannel(previousCache.guildId, previousCache.channelId);
+ ChannelRouter.transitionToChannel(previousCache.channelId);
}
}
});
diff --git a/src/plugins/userVoiceShow/components.tsx b/src/plugins/userVoiceShow/components.tsx
index fad860dfa8f..f9a81c4b9b7 100644
--- a/src/plugins/userVoiceShow/components.tsx
+++ b/src/plugins/userVoiceShow/components.tsx
@@ -8,7 +8,7 @@ import { classNameFactory } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary";
import { classes } from "@utils/misc";
import { filters, findByCodeLazy, findByPropsLazy, findComponentByCodeLazy, findStoreLazy, mapMangledModuleLazy } from "@webpack";
-import { ChannelStore, GuildStore, IconUtils, match, NavigationRouter, P, PermissionsBits, PermissionStore, React, showToast, Text, Toasts, Tooltip, useMemo, UserStore, useStateFromStores } from "@webpack/common";
+import { ChannelRouter, ChannelStore, GuildStore, IconUtils, match, P, PermissionsBits, PermissionStore, React, showToast, Text, Toasts, Tooltip, useMemo, UserStore, useStateFromStores } from "@webpack/common";
import { Channel } from "discord-types/general";
const cl = classNameFactory("vc-uvs-");
@@ -24,6 +24,8 @@ const UserSummaryItem = findComponentByCodeLazy("defaultRenderUser", "showDefaul
const Avatar = findComponentByCodeLazy(".AVATAR_STATUS_TYPING_16;");
const GroupDMAvatars = findComponentByCodeLazy(".AvatarSizeSpecs[", "getAvatarURL");
+const ActionButtonClasses = findByPropsLazy("actionButton", "highlight");
+
interface IconProps extends React.ComponentPropsWithoutRef<"div"> {
size?: number;
}
@@ -74,9 +76,10 @@ function LockedSpeakerIcon(props: IconProps) {
interface VoiceChannelTooltipProps {
channel: Channel;
+ isLocked: boolean;
}
-function VoiceChannelTooltip({ channel }: VoiceChannelTooltipProps) {
+function VoiceChannelTooltip({ channel, isLocked }: VoiceChannelTooltipProps) {
const voiceStates = useStateFromStores([VoiceStateStore], () => VoiceStateStore.getVoiceStatesForChannel(channel.id));
const users = useMemo(
@@ -113,7 +116,7 @@ function VoiceChannelTooltip({ channel }: VoiceChannelTooltipProps) {
{channelName}
-
+ {isLocked ? : }
;
-export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId, size, isActionButton }: VoiceChannelIndicatorProps) => {
+export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId, isMessageIndicator, isProfile, isActionButton, shouldHighlight }: VoiceChannelIndicatorProps) => {
const channelId = useStateFromStores([VoiceStateStore], () => VoiceStateStore.getVoiceStateForUser(userId)?.channelId as string | undefined);
const channel = channelId == null ? undefined : ChannelStore.getChannel(channelId);
@@ -165,7 +170,7 @@ export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId, size, isActio
selectVoiceChannel(channelId);
} else {
clickTimers[channelId] = setTimeout(() => {
- NavigationRouter.transitionTo(`/channels/${channel.getGuildId() ?? "@me"}/${channelId}`);
+ ChannelRouter.transitionToChannel(channelId);
delete clickTimers[channelId];
}, 250);
}
@@ -173,16 +178,16 @@ export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId, size, isActio
return (
}
+ text={}
tooltipClassName={cl("tooltip-container")}
tooltipContentClassName={cl("tooltip-content")}
>
{props => {
- const iconProps = {
+ const iconProps: IconProps = {
...props,
- onClick,
- size,
- className: isActionButton ? cl("indicator-action-button") : cl("speaker-padding")
+ className: classes(isMessageIndicator && cl("message-indicator"), (!isProfile && !isActionButton) && cl("speaker-margin"), isActionButton && ActionButtonClasses.actionButton, shouldHighlight && ActionButtonClasses.highlight),
+ size: isActionButton ? 20 : undefined,
+ onClick
};
return isLocked ?
diff --git a/src/plugins/userVoiceShow/index.tsx b/src/plugins/userVoiceShow/index.tsx
index 573fd0e384e..98386a16e5c 100644
--- a/src/plugins/userVoiceShow/index.tsx
+++ b/src/plugins/userVoiceShow/index.tsx
@@ -19,6 +19,7 @@
import "./style.css";
import { addDecorator, removeDecorator } from "@api/MemberListDecorators";
+import { addDecoration, removeDecoration } from "@api/MessageDecorations";
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
@@ -37,13 +38,19 @@ const settings = definePluginSettings({
description: "Show a user's Voice Channel indicator in the member and DMs list",
default: true,
restartNeeded: true
+ },
+ showInMessages: {
+ type: OptionType.BOOLEAN,
+ description: "Show a user's Voice Channel indicator in messages",
+ default: true,
+ restartNeeded: true
}
});
export default definePlugin({
name: "UserVoiceShow",
description: "Shows an indicator when a user is in a Voice Channel",
- authors: [Devs.LordElias, Devs.Nuckyz],
+ authors: [Devs.Nuckyz, Devs.LordElias],
settings,
patches: [
@@ -52,7 +59,7 @@ export default definePlugin({
find: ".Messages.USER_PROFILE_LOAD_ERROR",
replacement: {
match: /(\.fetchError.+?\?)null/,
- replace: (_, rest) => `${rest}$self.VoiceChannelIndicator({userId:arguments[0]?.userId})`
+ replace: (_, rest) => `${rest}$self.VoiceChannelIndicator({userId:arguments[0]?.userId,isProfile:true})`
},
predicate: () => settings.store.showInUserProfileModal
},
@@ -79,8 +86,8 @@ export default definePlugin({
{
find: "null!=this.peopleListItemRef.current",
replacement: {
- match: /\.actions,children:\[/,
- replace: "$&$self.VoiceChannelIndicator({userId:this?.props?.user?.id,size:20,isActionButton:true}),"
+ match: /\.actions,children:\[(?<=isFocused:(\i).+?)/,
+ replace: "$&$self.VoiceChannelIndicator({userId:this?.props?.user?.id,isActionButton:true,shouldHighlight:$1}),"
},
predicate: () => settings.store.showInMemberList
}
@@ -90,10 +97,14 @@ export default definePlugin({
if (settings.store.showInMemberList) {
addDecorator("UserVoiceShow", ({ user }) => user == null ? null : );
}
+ if (settings.store.showInMessages) {
+ addDecoration("UserVoiceShow", ({ message }) => message?.author == null ? null : );
+ }
},
stop() {
removeDecorator("UserVoiceShow");
+ removeDecoration("UserVoiceShow");
},
VoiceChannelIndicator
diff --git a/src/plugins/userVoiceShow/style.css b/src/plugins/userVoiceShow/style.css
index 67f4c4958ab..d172975b8ee 100644
--- a/src/plugins/userVoiceShow/style.css
+++ b/src/plugins/userVoiceShow/style.css
@@ -13,16 +13,14 @@
color: var(--interactive-hover);
}
-.vc-uvs-speaker-padding {
- padding: 0 4px;
+.vc-uvs-speaker-margin {
+ margin-left: 4px;
}
-.vc-uvs-indicator-action-button {
- background-color: var(--background-secondary);
- border-radius: 100%;
- height: 36px;
- width: 36px;
- margin-left: 10px;
+.vc-uvs-message-indicator {
+ display: inline-flex;
+ top: 2.5px;
+ position: relative;
}
.vc-uvs-tooltip-container {
diff --git a/src/webpack/common/types/utils.d.ts b/src/webpack/common/types/utils.d.ts
index dd76d1adef5..c0a93004917 100644
--- a/src/webpack/common/types/utils.d.ts
+++ b/src/webpack/common/types/utils.d.ts
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-import { Guild, GuildMember, User } from "discord-types/general";
+import { Channel, Guild, GuildMember, User } from "discord-types/general";
import type { ReactNode } from "react";
import { LiteralUnion } from "type-fest";
@@ -173,6 +173,11 @@ export interface NavigationRouter {
transitionToGuild(guildId: string, ...args: unknown[]): void;
}
+export interface ChannelRouter {
+ transitionToChannel: (channelId: string) => void;
+ transitionToThread: (channel: Channel) => void;
+}
+
export interface IconUtils {
getUserAvatarURL(user: User, canAnimate?: boolean, size?: number, format?: string): string;
getDefaultAvatarURL(id: string, discriminator?: string): string;
diff --git a/src/webpack/common/utils.ts b/src/webpack/common/utils.ts
index b557f4da24f..2d0026b5849 100644
--- a/src/webpack/common/utils.ts
+++ b/src/webpack/common/utils.ts
@@ -149,6 +149,10 @@ export const NavigationRouter: t.NavigationRouter = mapMangledModuleLazy("Transi
back: filters.byCode("goBack()"),
forward: filters.byCode("goForward()"),
});
+export const ChannelRouter: t.ChannelRouter = mapMangledModuleLazy('"Thread must have a parent ID."', {
+ transitionToChannel: filters.byCode(".preload"),
+ transitionToThread: filters.byCode('"Thread must have a parent ID."')
+});
export let SettingsRouter: any;
waitFor(["open", "saveAccountChanges"], m => SettingsRouter = m);
From 2d675b4b2e4c797315aff657298de96d07e4bbf1 Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Sat, 21 Sep 2024 08:43:13 -0300
Subject: [PATCH 2/8] ReviewDB: Fix in panel profile (again)
---
src/plugins/reviewDB/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/reviewDB/index.tsx b/src/plugins/reviewDB/index.tsx
index 9d93e53a32f..822ebde68d5 100644
--- a/src/plugins/reviewDB/index.tsx
+++ b/src/plugins/reviewDB/index.tsx
@@ -91,7 +91,7 @@ export default definePlugin({
}
},
{
- find: ".PANEL,interactionType:",
+ find: 'location:"UserProfilePanel"',
replacement: {
match: /{profileType:\i\.\i\.PANEL,children:\[/,
replace: "$&$self.BiteSizeReviewsButton({user:arguments[0].user}),"
From 492b0cff0888452096d5c2ba45258e769f4f4ff1 Mon Sep 17 00:00:00 2001
From: Joona <69722179+Masterjoona@users.noreply.github.com>
Date: Sat, 21 Sep 2024 18:22:19 +0300
Subject: [PATCH 3/8] OpenInApp: Fix opening in spotify activity cards for web
(#2894)
---
src/plugins/openInApp/index.ts | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/plugins/openInApp/index.ts b/src/plugins/openInApp/index.ts
index 7b62831f987..576980cba8b 100644
--- a/src/plugins/openInApp/index.ts
+++ b/src/plugins/openInApp/index.ts
@@ -100,6 +100,20 @@ export default definePlugin({
replace: "true$1VencordNative.native.openExternal"
}
},
+ {
+ find: "no artist ids in metadata",
+ predicate: () => !IS_DISCORD_DESKTOP && pluginSettings.store.spotify,
+ replacement: [
+ {
+ match: /\i\.\i\.isProtocolRegistered\(\)/g,
+ replace: "true"
+ },
+ {
+ match: /!\(0,\i\.isDesktop\)\(\)/,
+ replace: "false"
+ }
+ ]
+ },
{
find: ".CONNECTED_ACCOUNT_VIEWED,",
replacement: {
From 1dc2d924932f29ccf7422ac51eb0fac90490634f Mon Sep 17 00:00:00 2001
From: Drew <84212701+MrDiamondDog@users.noreply.github.com>
Date: Sat, 21 Sep 2024 13:10:46 -0600
Subject: [PATCH 4/8] ReplaceGoogleSearch: Fix DuckDuckGo URL (#2895)
---
src/plugins/replaceGoogleSearch/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/replaceGoogleSearch/index.tsx b/src/plugins/replaceGoogleSearch/index.tsx
index 43b0762a100..593c98632e9 100644
--- a/src/plugins/replaceGoogleSearch/index.tsx
+++ b/src/plugins/replaceGoogleSearch/index.tsx
@@ -12,7 +12,7 @@ import { Flex, Menu } from "@webpack/common";
const DefaultEngines = {
Google: "https://www.google.com/search?q=",
- DuckDuckGo: "https://duckduckgo.com/",
+ DuckDuckGo: "https://duckduckgo.com/?q=",
Brave: "https://search.brave.com/search?q=",
Bing: "https://www.bing.com/search?q=",
Yahoo: "https://search.yahoo.com/search?p=",
From 22a5b18bfa0b736acc1a0393fe1ad3a82f828dc1 Mon Sep 17 00:00:00 2001
From: DokterKaj <54882101+DokterKaj@users.noreply.github.com>
Date: Sun, 22 Sep 2024 03:12:20 +0800
Subject: [PATCH 5/8] CopyFileContents: Add padding to button (#2848)
---
src/plugins/copyFileContents/style.css | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/plugins/copyFileContents/style.css b/src/plugins/copyFileContents/style.css
index c643cf0f07a..91034bf2125 100644
--- a/src/plugins/copyFileContents/style.css
+++ b/src/plugins/copyFileContents/style.css
@@ -1,6 +1,7 @@
.vc-cfc-button {
color: var(--interactive-normal);
cursor: pointer;
+ padding-left: 4px;
}
.vc-cfc-button:hover {
From eaf62d8c1cd8ea7997e6efde04317e5b4700afbe Mon Sep 17 00:00:00 2001
From: Kyuuhachi <1547062+Kyuuhachi@users.noreply.github.com>
Date: Sun, 22 Sep 2024 09:11:07 +0200
Subject: [PATCH 6/8] RoleColorEverywhere: Add coloring to message contents
(#2893)
---
src/plugins/roleColorEverywhere/index.tsx | 40 ++++++++++++++++++++---
1 file changed, 36 insertions(+), 4 deletions(-)
diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx
index b5f66c09820..e3b22fd6ae0 100644
--- a/src/plugins/roleColorEverywhere/index.tsx
+++ b/src/plugins/roleColorEverywhere/index.tsx
@@ -18,10 +18,14 @@
import { definePluginSettings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
+import { makeRange } from "@components/PluginSettings/components";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
+import { findByCodeLazy } from "@webpack";
import { ChannelStore, GuildMemberStore, GuildStore } from "@webpack/common";
+const useMessageAuthor = findByCodeLazy('"Result cannot be null because the message is not null"');
+
const settings = definePluginSettings({
chatMentions: {
type: OptionType.BOOLEAN,
@@ -46,13 +50,21 @@ const settings = definePluginSettings({
default: true,
description: "Show role colors in the reactors list",
restartNeeded: true
- }
+ },
+ messageSaturation: {
+ type: OptionType.SLIDER,
+ description: "Intensity of message coloring. 0 to disable.",
+ markers: makeRange(0, 100, 10),
+ default: 30,
+ // This is called only once at startup, but late enough that the store is initialized.
+ get restartNeeded() { return settings.store.messageSaturation === 0; }
+ },
});
export default definePlugin({
name: "RoleColorEverywhere",
- authors: [Devs.KingFish, Devs.lewisakura, Devs.AutumnVN],
+ authors: [Devs.KingFish, Devs.lewisakura, Devs.AutumnVN, Devs.Kyuuhachi],
description: "Adds the top role color anywhere possible",
patches: [
// Chat Mentions
@@ -114,7 +126,15 @@ export default definePlugin({
replace: "$&,style:{color:$self.getColor($2?.id,$1)}"
},
predicate: () => settings.store.reactorsList,
- }
+ },
+ {
+ find: '.Messages.MESSAGE_EDITED,")"',
+ replacement: {
+ match: /(?<=isUnsupported\]:(\i)\.isUnsupported\}\),)(?=children:\[)/,
+ replace: "style:{color:$self.useMessageColor($1)},"
+ },
+ predicate: () => settings.store.messageSaturation !== 0,
+ },
],
settings,
@@ -148,5 +168,17 @@ export default definePlugin({
color: this.getColor(userId, { guildId })
}
};
- }
+ },
+
+ useMessageColor(message: any) {
+ try {
+ const { messageSaturation } = settings.use(["messageSaturation"]);
+ const author = useMessageAuthor(message);
+ if (author.colorString !== undefined && messageSaturation !== 0)
+ return `color-mix(in oklab, ${author.colorString} ${messageSaturation}%, var(--text-normal))`;
+ } catch(e) {
+ console.error("[RCE] failed to get message color", e);
+ }
+ return undefined;
+ },
});
From e4318a887a70c9bf70888c55bec09e33efb2351d Mon Sep 17 00:00:00 2001
From: sadan4 <117494111+sadan4@users.noreply.github.com>
Date: Sun, 22 Sep 2024 03:24:12 -0400
Subject: [PATCH 7/8] ConsoleJanitor: Ignore all loggers with whitelist (#2896)
---
src/plugins/consoleJanitor/README.md | 4 +-
src/plugins/consoleJanitor/index.ts | 61 ++++++++++++++--------------
2 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/src/plugins/consoleJanitor/README.md b/src/plugins/consoleJanitor/README.md
index fbba766a49d..9737f53d16e 100644
--- a/src/plugins/consoleJanitor/README.md
+++ b/src/plugins/consoleJanitor/README.md
@@ -1,5 +1,5 @@
# ConsoleJanitor
-Disables annoying console messages/errors. This plugin mainly removes errors/warnings that happen all the time and noisy/spammy logging messages.
+Disables annoying console messages/errors. This plugin mainly removes errors/warnings that happen all the time and Discord logger messages.
-Some of the disabled messages include the "notosans-400-normalitalic" error and MessageActionCreators, Routing/Utils loggers.
+One of the disabled messages is the "Window state not initialized" warning, for example.
diff --git a/src/plugins/consoleJanitor/index.ts b/src/plugins/consoleJanitor/index.ts
index f5f43c06be9..b0c8905f76a 100644
--- a/src/plugins/consoleJanitor/index.ts
+++ b/src/plugins/consoleJanitor/index.ts
@@ -6,7 +6,7 @@
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
-import definePlugin, { OptionType } from "@utils/types";
+import definePlugin, { OptionType, StartAt } from "@utils/types";
const Noop = () => { };
const NoopLogger = {
@@ -22,10 +22,12 @@ const NoopLogger = {
fileOnly: Noop
};
+const logAllow = new Set();
+
const settings = definePluginSettings({
- disableNoisyLoggers: {
+ disableLoggers: {
type: OptionType.BOOLEAN,
- description: "Disable noisy loggers like the MessageActionCreators",
+ description: "Disables Discords loggers",
default: false,
restartNeeded: true
},
@@ -34,16 +36,34 @@ const settings = definePluginSettings({
description: "Disable the Spotify logger, which leaks account information and access token",
default: true,
restartNeeded: true
+ },
+ whitelistedLoggers: {
+ type: OptionType.STRING,
+ description: "Semi colon separated list of loggers to allow even if others are hidden",
+ default: "GatewaySocket; Routing/Utils",
+ onChange(newVal: string) {
+ logAllow.clear();
+ newVal.split(";").map(x => x.trim()).forEach(logAllow.add.bind(logAllow));
+ }
}
});
export default definePlugin({
name: "ConsoleJanitor",
description: "Disables annoying console messages/errors",
- authors: [Devs.Nuckyz],
+ authors: [Devs.Nuckyz, Devs.sadan],
settings,
+ startAt: StartAt.Init,
+ start() {
+ logAllow.clear();
+ this.settings.store.whitelistedLoggers?.split(";").map(x => x.trim()).forEach(logAllow.add.bind(logAllow));
+ },
+
NoopLogger: () => NoopLogger,
+ shouldLog(logger: string) {
+ return logAllow.has(logger);
+ },
patches: [
{
@@ -103,34 +123,13 @@ export default definePlugin({
replace: ""
}
},
- ...[
- '("MessageActionCreators")', '("ChannelMessages")',
- '("Routing/Utils")', '("RTCControlSocket")',
- '("ConnectionEventFramerateReducer")', '("RTCLatencyTestManager")',
- '("OverlayBridgeStore")', '("RPCServer:WSS")', '("RPCServer:IPC")'
- ].map(logger => ({
- find: logger,
- predicate: () => settings.store.disableNoisyLoggers,
- all: true,
- replacement: {
- match: new RegExp(String.raw`new \i\.\i${logger.replace(/([()])/g, "\\$1")}`),
- replace: `$self.NoopLogger${logger}`
- }
- })),
+ // Patches discords generic logger function
{
- find: '"Experimental codecs: "',
- predicate: () => settings.store.disableNoisyLoggers,
+ find: "Σ:",
+ predicate: () => settings.store.disableLoggers,
replacement: {
- match: /new \i\.\i\("Connection\("\.concat\(\i,"\)"\)\)/,
- replace: "$self.NoopLogger()"
- }
- },
- {
- find: '"_handleLocalVideoDisabled: ',
- predicate: () => settings.store.disableNoisyLoggers,
- replacement: {
- match: /new \i\.\i\("RTCConnection\("\.concat.+?\)\)(?=,)/,
- replace: "$self.NoopLogger()"
+ match: /(?<=&&)(?=console)/,
+ replace: "$self.shouldLog(arguments[0])&&"
}
},
{
@@ -141,5 +140,5 @@ export default definePlugin({
replace: "$self.NoopLogger()"
}
}
- ]
+ ],
});
From db5fe2a39472275d2422035d3c55cb6f8cf15538 Mon Sep 17 00:00:00 2001
From: TheGreenPig <67547385+TheGreenPig@users.noreply.github.com>
Date: Sun, 22 Sep 2024 09:38:32 +0200
Subject: [PATCH 8/8] Fix plugin settings inconsistency regarding setting names
(#2884)
---
.../PluginSettings/components/SettingNumericComponent.tsx | 5 ++++-
.../PluginSettings/components/SettingSelectComponent.tsx | 5 ++++-
.../PluginSettings/components/SettingSliderComponent.tsx | 5 ++++-
.../PluginSettings/components/SettingTextComponent.tsx | 5 ++++-
4 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/components/PluginSettings/components/SettingNumericComponent.tsx b/src/components/PluginSettings/components/SettingNumericComponent.tsx
index 446d2504b64..b724717d7a0 100644
--- a/src/components/PluginSettings/components/SettingNumericComponent.tsx
+++ b/src/components/PluginSettings/components/SettingNumericComponent.tsx
@@ -16,6 +16,8 @@
* along with this program. If not, see .
*/
+import { Margins } from "@utils/margins";
+import { wordsFromCamel, wordsToTitle } from "@utils/text";
import { OptionType, PluginOptionNumber } from "@utils/types";
import { Forms, React, TextInput } from "@webpack/common";
@@ -54,7 +56,8 @@ export function SettingNumericComponent({ option, pluginSettings, definedSetting
return (
- {option.description}
+ {wordsToTitle(wordsFromCamel(id))}
+ {option.description}
.
*/
+import { Margins } from "@utils/margins";
+import { wordsFromCamel, wordsToTitle } from "@utils/text";
import { PluginOptionSelect } from "@utils/types";
import { Forms, React, Select } from "@webpack/common";
@@ -44,7 +46,8 @@ export function SettingSelectComponent({ option, pluginSettings, definedSettings
return (
- {option.description}
+ {wordsToTitle(wordsFromCamel(id))}
+ {option.description}
.
*/
+import { Margins } from "@utils/margins";
+import { wordsFromCamel, wordsToTitle } from "@utils/text";
import { PluginOptionSlider } from "@utils/types";
import { Forms, React, Slider } from "@webpack/common";
@@ -50,7 +52,8 @@ export function SettingSliderComponent({ option, pluginSettings, definedSettings
return (
- {option.description}
+ {wordsToTitle(wordsFromCamel(id))}
+ {option.description}
.
*/
+import { Margins } from "@utils/margins";
+import { wordsFromCamel, wordsToTitle } from "@utils/text";
import { PluginOptionString } from "@utils/types";
import { Forms, React, TextInput } from "@webpack/common";
@@ -41,7 +43,8 @@ export function SettingTextComponent({ option, pluginSettings, definedSettings,
return (
- {option.description}
+ {wordsToTitle(wordsFromCamel(id))}
+ {option.description}