second batch of fixes (#2596)

Co-authored-by: programminglaboratorys <107296738+programminglaboratorys@users.noreply.github.com>
Co-authored-by: Haruka <personal@shiroko.me>
Co-authored-by: Amia <9750071+aamiaa@users.noreply.github.com>
Co-authored-by: AutumnVN <autumnvnchino@gmail.com>
Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
This commit is contained in:
vee 2024-06-19 04:36:21 +02:00 committed by GitHub
parent d6f1209438
commit d19b0aeb5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 58 additions and 63 deletions

View file

@ -58,19 +58,13 @@ export default definePlugin({
patches: [
{
find: ".NITRO_BANNER,",
replacement: [
{
match: /(\i)\.premiumType/,
replace: "$self.patchPremiumType($1)||$&"
},
{
match: /\?\(0,\i\.jsx\)\(\i,{type:\i,shown/,
replace: "&&$self.shouldShowBadge(arguments[0])$&"
}
]
replacement: {
match: /\?\(0,\i\.jsx\)\(\i,{type:\i,shown/,
replace: "&&$self.shouldShowBadge(arguments[0])$&"
}
},
{
find: "BannerLoadingStatus:function",
find: ".banner)==null",
replacement: {
match: /(?<=void 0:)\i.getPreviewBanner\(\i,\i,\i\)/,
replace: "$self.patchBannerUrl(arguments[0])||$&"
@ -115,10 +109,6 @@ export default definePlugin({
if (this.userHasBackground(displayProfile?.userId)) return this.getImageUrl(displayProfile?.userId);
},
patchPremiumType({ userId }: any) {
if (this.userHasBackground(userId)) return 2;
},
shouldShowBadge({ displayProfile, user }: any) {
return displayProfile?.banner && (!this.userHasBackground(user.id) || settings.store.nitroFirst);
},