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

View file

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

View file

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