Fix ViewIcons, make banner have right cursor

Discord loves pushing 2 almost identical Avatar components for A/B
testing, they have never heard of an if statement 🚎
This commit is contained in:
Vendicated 2022-10-19 19:45:22 +02:00
parent 7cdc4e4c03
commit d97c3e2e02
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3

View file

@ -31,14 +31,15 @@ export default definePlugin({
{ {
find: "onAddFriend:", find: "onAddFriend:",
replacement: { replacement: {
match: /\{src:(.{1,2}),avatarDecoration/, // global because Discord has two components that are 99% identical with one small change ._.
match: /\{src:(.{1,2}),avatarDecoration/g,
replace: (_, src) => `{src:${src},onClick:()=>${OPEN_URL}${src}.replace(/\\?.+$/, "")+"?size=2048"),avatarDecoration` replace: (_, src) => `{src:${src},onClick:()=>${OPEN_URL}${src}.replace(/\\?.+$/, "")+"?size=2048"),avatarDecoration`
} }
}, { }, {
find: "().popoutNoBannerPremium", find: "().popoutNoBannerPremium",
replacement: { replacement: {
match: /style:.{0,10}\{\},(.{1,2})\)/, match: /style:.{0,10}\{\},(.{1,2})\)/,
replace: (m, bannerObj) => `onClick:${bannerObj}.backgroundImage&&(()=>${OPEN_URL}${bannerObj}.backgroundImage.replace("url(", "").replace(/(\\?size=.+)?\\)/, "?size=2048"))),${m}` replace: (m, style) => `onClick:${style}.backgroundImage&&(${style}.cursor="pointer",()=>${OPEN_URL}${style}.backgroundImage.replace("url(", "").replace(/(\\?size=.+)?\\)/, "?size=2048"))),${m}`
} }
}, { }, {
find: '"GuildContextMenu:', find: '"GuildContextMenu:',