ShowConnections, NoProfileThemes: Fix (#1854)

This commit is contained in:
TheKodeToad 2023-10-25 14:56:43 +01:00 committed by V
parent cf5e93ee52
commit 65d39dcf21
2 changed files with 15 additions and 15 deletions

@ -34,19 +34,19 @@ export default definePlugin({
}
},
{
find: "().avatarPositionPremiumNoBanner,default:",
find: ".avatarPositionPremiumNoBanner,default:",
replacement: {
// premiumUserWithoutBanner: foo().avatarPositionPremiumNoBanner, default: foo().avatarPositionNormal
match: /\.avatarPositionPremiumNoBanner(?=,default:\i\(\)\.(\i))/,
match: /\.avatarPositionPremiumNoBanner(?=,default:\i\.(\i))/,
// premiumUserWithoutBanner: foo().avatarPositionNormal...
replace: ".$1"
}
},
{
find: ".hasThemeColors=function(){",
find: "hasThemeColors(){",
replacement: {
match: /(?<=key:"canUsePremiumProfileCustomization",get:function\(\){return)/,
replace: " false;"
match: /get canUsePremiumProfileCustomization\(\){return /,
replace: "$&false &&"
}
}
]

@ -32,7 +32,7 @@ import { User } from "discord-types/general";
import { VerifiedIcon } from "./VerifiedIcon";
const Section = LazyComponent(() => findByCode("().lastSection"));
const Section = LazyComponent(() => findByCode(".lastSection]:"));
const ThemeStore = findStoreLazy("ThemeStore");
const platforms: { get(type: string): ConnectionPlatform; } = findByPropsLazy("isSupported", "getByUrl");
const getTheme: (user: User, displayProfile: any) => any = findByCodeLazy(',"--profile-gradient-primary-color"');
@ -74,12 +74,12 @@ interface ConnectionPlatform {
icon: { lightSVG: string, darkSVG: string; };
}
const profilePopoutComponent = ErrorBoundary.wrap(e =>
<ConnectionsComponent id={e.user.id} theme={getTheme(e.user, e.displayProfile).profileTheme} />
const profilePopoutComponent = ErrorBoundary.wrap(({ user, displayProfile }: { user: User, displayProfile; }) =>
<ConnectionsComponent id={user.id} theme={getTheme(user, displayProfile).profileTheme} />
);
const profilePanelComponent = ErrorBoundary.wrap(e =>
<ConnectionsComponent id={e.channel.recipients[0]} theme={ThemeStore.theme} />
const profilePanelComponent = ErrorBoundary.wrap(({ id }: { id: string; }) =>
<ConnectionsComponent id={id} theme={ThemeStore.theme} />
);
function ConnectionsComponent({ id, theme }: { id: string, theme: string; }) {
@ -175,18 +175,18 @@ export default definePlugin({
authors: [Devs.TheKodeToad],
patches: [
{
find: ".Messages.BOT_PROFILE_SLASH_COMMANDS",
find: "{isUsingGuildBio:null!==(",
replacement: {
match: /,theme:\i\}\)(?=,.{0,100}setNote:)/,
replace: "$&,$self.profilePopoutComponent(arguments[0])"
match: /,theme:\i\}\)(?=,.{0,150}setNote:)/,
replace: "$&,$self.profilePopoutComponent({ user: arguments[0].user, displayProfile: arguments[0].displayProfile })"
}
},
{
find: "\"Profile Panel: user cannot be undefined\"",
replacement: {
// createElement(Divider, {}), createElement(NoteComponent)
match: /\(0,\i\.jsx\)\(\i\.\i,\{\}\).{0,100}setNote:/,
replace: "$self.profilePanelComponent(arguments[0]),$&"
match: /\(0,\i\.jsx\)\(\i\.\i,\{\}\).{0,100}setNote:(?=.+?channelId:(\i).id)/,
replace: "$self.profilePanelComponent({ id: $1.recipients[0] }),$&"
}
}
],