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

View file

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