From d10e649b63ec46a511cd70f684ac9a7fbfaf8f52 Mon Sep 17 00:00:00 2001
From: sadan4 <117494111+sadan4@users.noreply.github.com>
Date: Wed, 4 Sep 2024 07:04:17 -0400
Subject: [PATCH 1/3] VolumeBooster: Fix playing sound in wrong output device
(#2840)
---
src/plugins/volumeBooster/index.ts | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/plugins/volumeBooster/index.ts b/src/plugins/volumeBooster/index.ts
index 02a955a80..490bf62c2 100644
--- a/src/plugins/volumeBooster/index.ts
+++ b/src/plugins/volumeBooster/index.ts
@@ -39,7 +39,7 @@ interface StreamData {
gainNode?: GainNode,
id: string,
levelNode: AudioWorkletNode,
- sinkId: string,
+ sinkId: string | "default",
stream: MediaStream,
streamSourceNode?: MediaStreamAudioSourceNode,
videoStreamId: string,
@@ -128,6 +128,12 @@ export default definePlugin({
gain.connect(data.audioContext.destination);
}
+ // @ts-expect-error
+ if (data.sinkId != null && data.sinkId !== data.audioContext.sinkId && "setSinkId" in AudioContext.prototype) {
+ // @ts-expect-error https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/setSinkId
+ data.audioContext.setSinkId(data.sinkId);
+ }
+
data.gainNode.gain.value = data._mute
? 0
: data._volume / 100;
From df8aec8e3c5e4d13bc2f2df4e125ee3205c4d185 Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Wed, 4 Sep 2024 08:24:54 -0300
Subject: [PATCH 2/3] Fix BetterFolders and FriendsSince
---
src/plugins/_api/serverList.ts | 2 +-
src/plugins/betterFolders/index.tsx | 4 ++--
src/plugins/friendsSince/index.tsx | 33 +++++++----------------------
3 files changed, 11 insertions(+), 28 deletions(-)
diff --git a/src/plugins/_api/serverList.ts b/src/plugins/_api/serverList.ts
index f45bbf104..7904e78b0 100644
--- a/src/plugins/_api/serverList.ts
+++ b/src/plugins/_api/serverList.ts
@@ -34,7 +34,7 @@ export default definePlugin({
{
find: "Messages.SERVERS,children",
replacement: {
- match: /(?<=Messages\.SERVERS,children:).+?default:return null\}\}\)/,
+ match: /(?<=Messages\.SERVERS,children:)\i\.map\(\i\)/,
replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)"
}
}
diff --git a/src/plugins/betterFolders/index.tsx b/src/plugins/betterFolders/index.tsx
index 072f4ee66..0bef0933d 100644
--- a/src/plugins/betterFolders/index.tsx
+++ b/src/plugins/betterFolders/index.tsx
@@ -132,8 +132,8 @@ export default definePlugin({
},
// Export the isBetterFolders variable to the folders component
{
- match: /(?<=\.Messages\.SERVERS.+?switch\((\i)\.type\){case \i\.\i\.FOLDER:.+?folderNode:\i,)/,
- replace: 'isBetterFolders:typeof isBetterFolders!=="undefined"?isBetterFolders:false,'
+ match: /switch\(\i\.type\){case \i\.\i\.FOLDER:.+?folderNode:\i,/,
+ replace: '$&isBetterFolders:typeof isBetterFolders!=="undefined"?isBetterFolders:false,'
}
]
},
diff --git a/src/plugins/friendsSince/index.tsx b/src/plugins/friendsSince/index.tsx
index 0399a2f72..cb5634c8e 100644
--- a/src/plugins/friendsSince/index.tsx
+++ b/src/plugins/friendsSince/index.tsx
@@ -7,16 +7,15 @@
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { getCurrentChannel } from "@utils/discord";
-import { Logger } from "@utils/Logger";
import definePlugin from "@utils/types";
-import { findByCodeLazy, findByPropsLazy, findLazy } from "@webpack";
-import { Heading, RelationshipStore, Text } from "@webpack/common";
+import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpack";
+import { RelationshipStore, Text } from "@webpack/common";
const containerWrapper = findByPropsLazy("memberSinceWrapper");
const container = findByPropsLazy("memberSince");
const getCreatedAtDate = findByCodeLazy('month:"short",day:"numeric"');
const locale = findByPropsLazy("getLocale");
-const section = findLazy((m: any) => m.section !== void 0 && m.heading !== void 0 && Object.values(m).length === 2);
+const Section = findComponentByCodeLazy('"auto":"smooth"', ".section");
export default definePlugin({
name: "FriendsSince",
@@ -28,7 +27,7 @@ export default definePlugin({
find: ".PANEL}),nicknameIcons",
replacement: {
match: /USER_PROFILE_MEMBER_SINCE,.{0,100}userId:(\i\.id)}\)}\)/,
- replace: "$&,$self.friendsSinceNew({userId:$1,isSidebar:true})"
+ replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:true})"
}
},
// User Profile Modal
@@ -36,34 +35,19 @@ export default definePlugin({
find: "action:\"PRESS_APP_CONNECTION\"",
replacement: {
match: /USER_PROFILE_MEMBER_SINCE,.{0,100}userId:(\i\.id),.{0,100}}\)}\),/,
- replace: "$&,$self.friendsSinceNew({userId:$1,isSidebar:false}),"
+ replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:false}),"
}
}
],
- getFriendSince(userId: string) {
- try {
- if (!RelationshipStore.isFriend(userId)) return null;
-
- return RelationshipStore.getSince(userId);
- } catch (err) {
- new Logger("FriendsSince").error(err);
- return null;
- }
- },
-
- friendsSinceNew: ErrorBoundary.wrap(({ userId, isSidebar }: { userId: string; isSidebar: boolean; }) => {
+ FriendsSinceComponent: ErrorBoundary.wrap(({ userId, isSidebar }: { userId: string; isSidebar: boolean; }) => {
if (!RelationshipStore.isFriend(userId)) return null;
const friendsSince = RelationshipStore.getSince(userId);
if (!friendsSince) return null;
return (
-
-
- Friends Since
-
-
+
{
isSidebar ? (
@@ -91,8 +75,7 @@ export default definePlugin({
)
}
-
-
+
);
}, { noop: true }),
});
From 244cb26c328828503835c680fa294917cb7d5f9b Mon Sep 17 00:00:00 2001
From: ElectricSteve <96793824+electricsteve@users.noreply.github.com>
Date: Wed, 4 Sep 2024 14:00:49 +0200
Subject: [PATCH 3/3] Dearrow: Add option to not dearrow by default (#2818)
---
src/plugins/dearrow/index.tsx | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/plugins/dearrow/index.tsx b/src/plugins/dearrow/index.tsx
index 5fb438256..10175c846 100644
--- a/src/plugins/dearrow/index.tsx
+++ b/src/plugins/dearrow/index.tsx
@@ -46,7 +46,7 @@ const embedUrlRe = /https:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]{11})/;
async function embedDidMount(this: Component) {
try {
const { embed } = this.props;
- const { replaceElements } = settings.store;
+ const { replaceElements, dearrowByDefault } = settings.store;
if (!embed || embed.dearrow || embed.provider?.name !== "YouTube" || !embed.video?.url) return;
@@ -63,18 +63,22 @@ async function embedDidMount(this: Component) {
if (!hasTitle && !hasThumb) return;
+
embed.dearrow = {
- enabled: true
+ enabled: dearrowByDefault
};
if (hasTitle && replaceElements !== ReplaceElements.ReplaceThumbnailsOnly) {
- embed.dearrow.oldTitle = embed.rawTitle;
- embed.rawTitle = titles[0].title.replace(/(^|\s)>(\S)/g, "$1$2");
- }
+ const replacementTitle = titles[0].title.replace(/(^|\s)>(\S)/g, "$1$2");
+ embed.dearrow.oldTitle = dearrowByDefault ? embed.rawTitle : replacementTitle;
+ if (dearrowByDefault) embed.rawTitle = replacementTitle;
+ }
if (hasThumb && replaceElements !== ReplaceElements.ReplaceTitlesOnly) {
- embed.dearrow.oldThumb = embed.thumbnail.proxyURL;
- embed.thumbnail.proxyURL = `https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}&time=${thumbnails[0].timestamp}`;
+ const replacementProxyURL = `https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}&time=${thumbnails[0].timestamp}`;
+
+ embed.dearrow.oldThumb = dearrowByDefault ? embed.thumbnail.proxyURL : replacementProxyURL;
+ if (embed.thumbnail.proxyURL) embed.thumbnail.proxyURL = replacementProxyURL;
}
this.forceUpdate();
@@ -96,6 +100,7 @@ function DearrowButton({ component }: { component: Component; }) {
className={"vc-dearrow-toggle-" + (embed.dearrow.enabled ? "on" : "off")}
onClick={() => {
const { enabled, oldThumb, oldTitle } = embed.dearrow;
+ settings.store.dearrowByDefault = !enabled;
embed.dearrow.enabled = !enabled;
if (oldTitle) {
embed.dearrow.oldTitle = embed.rawTitle;
@@ -153,6 +158,12 @@ const settings = definePluginSettings({
{ label: "Titles", value: ReplaceElements.ReplaceTitlesOnly },
{ label: "Thumbnails", value: ReplaceElements.ReplaceThumbnailsOnly },
],
+ },
+ dearrowByDefault: {
+ description: "Dearrow videos automatically",
+ type: OptionType.BOOLEAN,
+ default: true,
+ restartNeeded: false
}
});