Fix ViewIcons and NoProfileThemes

This commit is contained in:
Nuckyz 2024-08-23 03:02:04 -03:00
parent 2e81b9aeba
commit ed9b28febf
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
5 changed files with 29 additions and 34 deletions

View file

@ -18,27 +18,36 @@
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { UserStore } from "@webpack/common";
import virtualMerge from "virtual-merge";
export default definePlugin({
name: "NoProfileThemes",
description: "Completely removes Nitro profile themes",
description: "Completely removes Nitro profile themes from everyone but yourself",
authors: [Devs.TheKodeToad],
patches: [
{
find: ".NITRO_BANNER,",
replacement: {
// = isPremiumAtLeast(user.premiumType, TIER_2)
match: /=(?=\i\.\i\.isPremiumAtLeast\(null==(\i))/,
// = user.banner && isPremiumAtLeast(user.premiumType, TIER_2)
replace: "=(arguments[0]?.bannerSrc||$1?.banner)&&"
}
},
{
find: "hasThemeColors(){",
replacement: {
match: /get canUsePremiumProfileCustomization\(\){return /,
replace: "$&false &&"
replace: "$&$self.isCurrentUser(this.userId)&&"
}
},
{
find: "UserProfileStore",
replacement: {
match: /(?<=getUserProfile\(\i\){return )(.+?)(?=})/,
replace: "$self.removeProfileThemes($1)"
}
}
]
],
isCurrentUser: (userId: string) => userId === UserStore.getCurrentUser()?.id,
removeProfileThemes: (displayProfile: any) => {
if (displayProfile == null) return displayProfile;
return displayProfile.userId === UserStore.getCurrentUser()?.id
? displayProfile
: virtualMerge(displayProfile, { banner: undefined, profileEffectId: undefined });
}
});