From ad3d936dfd75a22e17213e66d2288b46abe6cc90 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Thu, 29 Aug 2024 21:41:51 -0300 Subject: [PATCH 01/11] Fix settings wrapping fallback --- src/plugins/_core/settings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/_core/settings.tsx b/src/plugins/_core/settings.tsx index 3cc020836..be220db1a 100644 --- a/src/plugins/_core/settings.tsx +++ b/src/plugins/_core/settings.tsx @@ -64,7 +64,7 @@ export default definePlugin({ replace: (_, sectionTypes, commaOrSemi, elements, element) => `${commaOrSemi} $self.addSettings(${elements}, ${element}, ${sectionTypes}) ${commaOrSemi}` }, { - match: /({(?=.+?function (\i).{0,120}(\i)=\i\.useMemo.{0,30}return \i\.useMemo\(\(\)=>\i\(\3).+?function\(\){return )\2(?=})/, + match: /({(?=.+?function (\i).{0,120}(\i)=\i\.useMemo.{0,60}return \i\.useMemo\(\(\)=>\i\(\3).+?function\(\){return )\2(?=})/, replace: (_, rest, settingsHook) => `${rest}$self.wrapSettingsHook(${settingsHook})` } ] From e473a57c3d5ee624669910f7f9120038fe12a050 Mon Sep 17 00:00:00 2001 From: Cookie <52550063+Covkie@users.noreply.github.com> Date: Thu, 29 Aug 2024 21:08:48 -0400 Subject: [PATCH 02/11] IgnoreActivities: Add option for blacklist filter (#2712) --- src/plugins/ignoreActivities/index.tsx | 88 ++++++++++++++++++-------- src/utils/constants.ts | 4 ++ 2 files changed, 66 insertions(+), 26 deletions(-) diff --git a/src/plugins/ignoreActivities/index.tsx b/src/plugins/ignoreActivities/index.tsx index bab69d89b..9e6c21bdd 100644 --- a/src/plugins/ignoreActivities/index.tsx +++ b/src/plugins/ignoreActivities/index.tsx @@ -26,6 +26,11 @@ interface IgnoredActivity { type: ActivitiesTypes; } +const enum FilterMode { + Whitelist, + Blacklist +} + const RunningGameStore = findStoreLazy("RunningGameStore"); const ShowCurrentGame = getUserSettingLazy("status", "showCurrentGame")!; @@ -70,14 +75,17 @@ function handleActivityToggle(e: React.MouseEvent if (ignoredActivityIndex === -1) settings.store.ignoredActivities = getIgnoredActivities().concat(activity); else settings.store.ignoredActivities = getIgnoredActivities().filter((_, index) => index !== ignoredActivityIndex); - // Trigger activities recalculation + recalculateActivities(); +} + +function recalculateActivities() { ShowCurrentGame.updateSetting(old => old); } function ImportCustomRPCComponent() { return ( - Import the application id of the CustomRPC plugin to the allowed list + Import the application id of the CustomRPC plugin to the filter list
+ )} From 273981deb74039c0aa8252f5c981d21f7352a412 Mon Sep 17 00:00:00 2001 From: ImBanana Date: Sun, 1 Sep 2024 05:33:07 +0300 Subject: [PATCH 08/11] new plugin StickerPaste ~ Insert stickers instead of sending (#2781) --- src/plugins/stickerPaste/README.md | 3 +++ src/plugins/stickerPaste/index.ts | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 src/plugins/stickerPaste/README.md create mode 100644 src/plugins/stickerPaste/index.ts diff --git a/src/plugins/stickerPaste/README.md b/src/plugins/stickerPaste/README.md new file mode 100644 index 000000000..a29170272 --- /dev/null +++ b/src/plugins/stickerPaste/README.md @@ -0,0 +1,3 @@ +# StickerPaste + +Makes picking a sticker in the sticker picker insert it into the chatbox instead of instantly sending. diff --git a/src/plugins/stickerPaste/index.ts b/src/plugins/stickerPaste/index.ts new file mode 100644 index 000000000..8a0082073 --- /dev/null +++ b/src/plugins/stickerPaste/index.ts @@ -0,0 +1,24 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; + +export default definePlugin({ + name: "StickerPaste", + description: "Makes picking a sticker in the sticker picker insert it into the chatbox instead of instantly sending", + authors: [Devs.ImBanana], + + patches: [ + { + find: ".stickers,previewSticker:", + replacement: { + match: /if\(\i\.\i\.getUploadCount/, + replace: "return true;$&", + } + } + ] +}); From e07a4e19e65b556b0e398a39499b85b88699756b Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Sat, 31 Aug 2024 23:08:33 -0400 Subject: [PATCH 09/11] VolumeBooster: Support browser and Vesktop (#2730) --- src/plugins/volumeBooster/README.md | 9 +++ .../index.ts | 61 +++++++++++++++++-- src/utils/constants.ts | 4 ++ 3 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 src/plugins/volumeBooster/README.md rename src/plugins/{volumeBooster.discordDesktop => volumeBooster}/index.ts (64%) diff --git a/src/plugins/volumeBooster/README.md b/src/plugins/volumeBooster/README.md new file mode 100644 index 000000000..62bd5ab52 --- /dev/null +++ b/src/plugins/volumeBooster/README.md @@ -0,0 +1,9 @@ +# Volume Booster + +Allows you to boost the volume over 200% on desktop and over 100% on other clients. + +Works on users, bots, and streams! + +![the volume being moved up to 270% on vesktop](https://github.com/user-attachments/assets/793e012e-c069-4fa4-a3d5-61c2f55edd3e) + +![the volume being moved up to 297% on a stream](https://github.com/user-attachments/assets/77463eb9-2537-4821-a3ab-82f60633ccbc) diff --git a/src/plugins/volumeBooster.discordDesktop/index.ts b/src/plugins/volumeBooster/index.ts similarity index 64% rename from src/plugins/volumeBooster.discordDesktop/index.ts rename to src/plugins/volumeBooster/index.ts index b455c97ec..3ab47b197 100644 --- a/src/plugins/volumeBooster.discordDesktop/index.ts +++ b/src/plugins/volumeBooster/index.ts @@ -31,10 +31,27 @@ const settings = definePluginSettings({ } }); +interface StreamData { + audioContext: AudioContext, + audioElement: HTMLAudioElement, + emitter: any, + // added by this plugin + gainNode?: GainNode, + id: string, + levelNode: AudioWorkletNode, + sinkId: string, + stream: MediaStream, + streamSourceNode?: MediaStreamAudioSourceNode, + videoStreamId: string, + _mute: boolean, + _speakingFlags: number, + _volume: number; +} + export default definePlugin({ name: "VolumeBooster", - authors: [Devs.Nuckyz], - description: "Allows you to set the user and stream volume above the default maximum.", + authors: [Devs.Nuckyz, Devs.sadan], + description: "Allows you to set the user and stream volume above the default maximum", settings, patches: [ @@ -45,12 +62,28 @@ export default definePlugin({ ].map(find => ({ find, replacement: { - match: /(?<=maxValue:\i\.\i)\?(\d+?):(\d+?)(?=,)/, - replace: (_, higherMaxVolume, minorMaxVolume) => "" - + `?${higherMaxVolume}*$self.settings.store.multiplier` - + `:${minorMaxVolume}*$self.settings.store.multiplier` + match: /(?<=maxValue:)\i\.\i\?(\d+?):(\d+?)(?=,)/, + replace: (_, higherMaxVolume, minorMaxVolume) => `${higherMaxVolume}*$self.settings.store.multiplier` } })), + // Patches needed for web/vesktop + { + find: "streamSourceNode", + predicate: () => IS_WEB, + group: true, + replacement: [ + // Remove rounding algorithm + { + match: /Math\.max.{0,30}\)\)/, + replace: "arguments[0]" + }, + // Patch the volume + { + match: /\.volume=this\._volume\/100;/, + replace: ".volume=0.00;$self.patchVolume(this);" + } + ] + }, // Prevent Audio Context Settings sync from trying to sync with values above 200, changing them to 200 before we send to Discord { find: "AudioContextSettingsMigrated", @@ -83,4 +116,20 @@ export default definePlugin({ ] } ], + + patchVolume(data: StreamData) { + if (data.stream.getAudioTracks().length === 0) return; + + data.streamSourceNode ??= data.audioContext.createMediaStreamSource(data.stream); + + if (!data.gainNode) { + const gain = data.gainNode = data.audioContext.createGain(); + data.streamSourceNode.connect(gain); + gain.connect(data.audioContext.destination); + } + + data.gainNode.gain.value = data._mute + ? 0 + : data._volume / 100; + } }); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 60c203252..7fb2b6bf0 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -534,6 +534,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({ name: "Joona", id: 297410829589020673n }, + sadan: { + name: "sadan", + id: 521819891141967883n, + }, Kylie: { name: "Cookie", id: 721853658941227088n From b595a3e33c4a39e67a36dc9041ed2aa90c30aaea Mon Sep 17 00:00:00 2001 From: vxray <41696677+vxray@users.noreply.github.com> Date: Sun, 1 Sep 2024 05:20:22 +0200 Subject: [PATCH 10/11] OpenInApp: Add support for localization in Spotify URL regex (#2776) --- src/plugins/openInApp/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/openInApp/index.ts b/src/plugins/openInApp/index.ts index 1a68e8f5d..2e332465e 100644 --- a/src/plugins/openInApp/index.ts +++ b/src/plugins/openInApp/index.ts @@ -33,7 +33,7 @@ interface URLReplacementRule { // Do not forget to add protocols to the ALLOWED_PROTOCOLS constant const UrlReplacementRules: Record = { spotify: { - match: /^https:\/\/open\.spotify\.com\/(track|album|artist|playlist|user|episode)\/(.+)(?:\?.+?)?$/, + match: /^https:\/\/open\.spotify\.com\/(?:intl-[a-z]{2}\/)?(track|album|artist|playlist|user|episode)\/(.+)(?:\?.+?)?$/, replace: (_, type, id) => `spotify://${type}/${id}`, description: "Open Spotify links in the Spotify app", shortlinkMatch: /^https:\/\/spotify\.link\/.+$/, From 968e688c106ea7b45c1bb522c73104239d3663a6 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 1 Sep 2024 00:53:46 -0300 Subject: [PATCH 11/11] Bump to 1.9.9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0fdda2659..65a2f4512 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vencord", "private": "true", - "version": "1.9.8", + "version": "1.9.9", "description": "The cutest Discord client mod", "homepage": "https://github.com/Vendicated/Vencord#readme", "bugs": {