1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-26 17:26:22 +00:00

Merge branch 'dev' into newDevTools

This commit is contained in:
sadan4 2024-09-01 00:02:33 -04:00 committed by GitHub
commit c79e586245
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 97 additions and 8 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "vencord", "name": "vencord",
"private": "true", "private": "true",
"version": "1.9.8", "version": "1.9.9",
"description": "The cutest Discord client mod", "description": "The cutest Discord client mod",
"homepage": "https://github.com/Vendicated/Vencord#readme", "homepage": "https://github.com/Vendicated/Vencord#readme",
"bugs": { "bugs": {

View file

@ -33,7 +33,7 @@ interface URLReplacementRule {
// Do not forget to add protocols to the ALLOWED_PROTOCOLS constant // Do not forget to add protocols to the ALLOWED_PROTOCOLS constant
const UrlReplacementRules: Record<string, URLReplacementRule> = { const UrlReplacementRules: Record<string, URLReplacementRule> = {
spotify: { 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}`, replace: (_, type, id) => `spotify://${type}/${id}`,
description: "Open Spotify links in the Spotify app", description: "Open Spotify links in the Spotify app",
shortlinkMatch: /^https:\/\/spotify\.link\/.+$/, shortlinkMatch: /^https:\/\/spotify\.link\/.+$/,

View file

@ -0,0 +1,3 @@
# StickerPaste
Makes picking a sticker in the sticker picker insert it into the chatbox instead of instantly sending.

View file

@ -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;$&",
}
}
]
});

View file

@ -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)

View file

@ -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({ export default definePlugin({
name: "VolumeBooster", name: "VolumeBooster",
authors: [Devs.Nuckyz], authors: [Devs.Nuckyz, Devs.sadan],
description: "Allows you to set the user and stream volume above the default maximum.", description: "Allows you to set the user and stream volume above the default maximum",
settings, settings,
patches: [ patches: [
@ -45,12 +62,28 @@ export default definePlugin({
].map(find => ({ ].map(find => ({
find, find,
replacement: { replacement: {
match: /(?<=maxValue:\i\.\i)\?(\d+?):(\d+?)(?=,)/, match: /(?<=maxValue:)\i\.\i\?(\d+?):(\d+?)(?=,)/,
replace: (_, higherMaxVolume, minorMaxVolume) => "" replace: (_, higherMaxVolume, minorMaxVolume) => `${higherMaxVolume}*$self.settings.store.multiplier`
+ `?${higherMaxVolume}*$self.settings.store.multiplier`
+ `:${minorMaxVolume}*$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 // Prevent Audio Context Settings sync from trying to sync with values above 200, changing them to 200 before we send to Discord
{ {
find: "AudioContextSettingsMigrated", 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;
}
}); });

View file

@ -534,6 +534,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
name: "Joona", name: "Joona",
id: 297410829589020673n id: 297410829589020673n
}, },
sadan: {
name: "sadan",
id: 521819891141967883n,
},
Kylie: { Kylie: {
name: "Cookie", name: "Cookie",
id: 721853658941227088n id: 721853658941227088n