Equicord/src/equicordplugins/fullVcPfp/index.tsx
2025-12-16 23:26:01 -05:00

45 lines
1.3 KiB
TypeScript

/*
* Vencord, a Discord client mod
* Copyright (c) 2025 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { disableStyle, enableStyle } from "@api/Styles";
import { EquicordDevs } from "@utils/constants";
import definePlugin from "@utils/types";
import { IconUtils, UserStore } from "@webpack/common";
import style from "./style.css?managed";
export default definePlugin({
name: "FullVCPFP",
description: "Makes avatars take up the entire vc tile",
authors: [EquicordDevs.mochienya],
patches: [
{
find: "\"data-selenium-video-tile\":",
replacement: {
match: /(?<=function\((\i),\i\)\{)/,
replace: "Object.assign($1.style=$1.style||{},$self.getVoiceBackgroundStyles($1));",
}
},
],
getVoiceBackgroundStyles({ className, participantUserId }: any) {
if (!className.includes("tile") || !participantUserId) return;
const user = UserStore.getUser(participantUserId);
const avatarUrl = IconUtils.getUserAvatarURL(user, false, 1024);
return {
"--full-res-avatar": `url(${avatarUrl})`
};
},
start() {
enableStyle(style);
},
stop() {
disableStyle(style);
},
});