fix USRBG & ViewIcons in new profiles (#2557)

Co-authored-by: Vendicated <vendicated@riseup.net>
This commit is contained in:
AutumnVN 2024-06-08 04:42:12 +07:00 committed by GitHub
parent 29c65948b4
commit 5996e67c7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 22 deletions

View file

@ -61,11 +61,7 @@ export default definePlugin({
replacement: [
{
match: /(\i)\.premiumType/,
replace: "$self.premiumHook($1)||$&"
},
{
match: /(?<=function \i\((\i)\)\{)(?=var.{30,50},bannerSrc:)/,
replace: "$1.bannerSrc=$self.useBannerHook($1);"
replace: "$self.patchPremiumType($1)||$&"
},
{
match: /\?\(0,\i\.jsx\)\(\i,{type:\i,shown/,
@ -74,17 +70,19 @@ export default definePlugin({
]
},
{
find: /overrideBannerSrc:\i,overrideBannerWidth:/,
replacement: [
{
match: /(\i)\.premiumType/,
replace: "$self.premiumHook($1)||$&"
},
{
match: /function \i\((\i)\)\{/,
replace: "$&$1.overrideBannerSrc=$self.useBannerHook($1);"
}
]
find: "=!1,canUsePremiumCustomization:",
replacement: {
match: /(\i)\.premiumType/,
replace: "$self.patchPremiumType($1)||$&"
}
},
{
find: "BannerLoadingStatus:function",
replacement: {
match: /(?<=void 0:)\i.getPreviewBanner\(\i,\i,\i\)/,
replace: "$self.patchBannerUrl(arguments[0])||$&"
}
},
{
find: "\"data-selenium-video-tile\":",
@ -92,7 +90,7 @@ export default definePlugin({
replacement: [
{
match: /(?<=function\((\i),\i\)\{)(?=let.{20,40},style:)/,
replace: "$1.style=$self.voiceBackgroundHook($1);"
replace: "$1.style=$self.getVoiceBackgroundStyles($1);"
}
]
}
@ -106,7 +104,7 @@ export default definePlugin({
);
},
voiceBackgroundHook({ className, participantUserId }: any) {
getVoiceBackgroundStyles({ className, participantUserId }: any) {
if (className.includes("tile_")) {
if (this.userHasBackground(participantUserId)) {
return {
@ -119,12 +117,12 @@ export default definePlugin({
}
},
useBannerHook({ displayProfile, user }: any) {
patchBannerUrl({ displayProfile }: any) {
if (displayProfile?.banner && settings.store.nitroFirst) return;
if (this.userHasBackground(user.id)) return this.getImageUrl(user.id);
if (this.userHasBackground(displayProfile?.userId)) return this.getImageUrl(displayProfile?.userId);
},
premiumHook({ userId }: any) {
patchPremiumType({ userId }: any) {
if (this.userHasBackground(userId)) return 2;
},

View file

@ -192,7 +192,7 @@ export default definePlugin({
}
})),
// Banners
...[".NITRO_BANNER,", /overrideBannerSrc:\i,overrideBannerWidth:/].map(find => ({
...[".NITRO_BANNER,", "=!1,canUsePremiumCustomization:"].map(find => ({
find,
replacement: {
// style: { backgroundImage: shouldShowBanner ? "url(".concat(bannerUrl,