From 548378ea4c595cf6c3227322a084e366103bb5d7 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Tue, 16 Dec 2025 23:26:01 -0500 Subject: [PATCH] FullVCPFP & USRBG: Dedupe --- src/equicordplugins/fullVcPfp/index.tsx | 30 +++---------------------- src/plugins/usrbg/index.tsx | 7 ++---- 2 files changed, 5 insertions(+), 32 deletions(-) diff --git a/src/equicordplugins/fullVcPfp/index.tsx b/src/equicordplugins/fullVcPfp/index.tsx index 7106c3d86..686fff588 100644 --- a/src/equicordplugins/fullVcPfp/index.tsx +++ b/src/equicordplugins/fullVcPfp/index.tsx @@ -4,9 +4,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -import { isPluginEnabled } from "@api/PluginManager"; import { disableStyle, enableStyle } from "@api/Styles"; -import usrbg from "@plugins/usrbg"; import { EquicordDevs } from "@utils/constants"; import definePlugin from "@utils/types"; import { IconUtils, UserStore } from "@webpack/common"; @@ -22,17 +20,9 @@ export default definePlugin({ find: "\"data-selenium-video-tile\":", replacement: { match: /(?<=function\((\i),\i\)\{)/, - replace: "$1.style=$self.getVoiceBackgroundStyles($1);", + replace: "Object.assign($1.style=$1.style||{},$self.getVoiceBackgroundStyles($1));", } }, - { - find: '"VideoBackground-web"', - predicate: () => isPluginEnabled(usrbg.name) && usrbg.settings.store.voiceBackground, - replacement: { - match: /backgroundColor:.{0,25},\{style:(?=\i\?)/, - replace: "$&$self.userHasBackground(arguments[0]?.userId)?null:", - } - } ], getVoiceBackgroundStyles({ className, participantUserId }: any) { @@ -40,24 +30,10 @@ export default definePlugin({ const user = UserStore.getUser(participantUserId); const avatarUrl = IconUtils.getUserAvatarURL(user, false, 1024); - const style: Record = { + + return { "--full-res-avatar": `url(${avatarUrl})` }; - - if (isPluginEnabled(usrbg.name) && usrbg.settings.store.voiceBackground && this.userHasBackground(participantUserId)) { - Object.assign(style, { - backgroundImage: `url(${usrbg.getImageUrl(participantUserId)})`, - backgroundSize: "cover", - backgroundPosition: "center", - backgroundRepeat: "no-repeat" - }); - } - - return style; - }, - - userHasBackground(userId: string) { - return usrbg.userHasBackground(userId); }, start() { diff --git a/src/plugins/usrbg/index.tsx b/src/plugins/usrbg/index.tsx index a00d6b663..ad95a53b5 100644 --- a/src/plugins/usrbg/index.tsx +++ b/src/plugins/usrbg/index.tsx @@ -18,11 +18,9 @@ import "./styles.css"; -import { isPluginEnabled } from "@api/PluginManager"; import { definePluginSettings } from "@api/Settings"; import { classNameFactory } from "@api/Styles"; import { Button } from "@components/Button"; -import fullVcPfp from "@equicordplugins/fullVcPfp"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; @@ -69,17 +67,16 @@ export default definePlugin({ }, { find: "\"data-selenium-video-tile\":", - predicate: () => !isPluginEnabled(fullVcPfp.name) && settings.store.voiceBackground, replacement: [ { match: /(?<=function\((\i),\i\)\{)(?=let.{20,40},style:)/, - replace: "$1.style=$self.getVoiceBackgroundStyles($1);" + replace: "Object.assign($1.style=$1.style||{},$self.getVoiceBackgroundStyles($1));" } ] }, { find: '"VideoBackground-web"', - predicate: () => !isPluginEnabled(fullVcPfp.name) && settings.store.voiceBackground, + predicate: () => settings.store.voiceBackground, replacement: { match: /backgroundColor:.{0,25},\{style:(?=\i\?)/, replace: "$&$self.userHasBackground(arguments[0]?.userId)?null:",