Fix plugins broken by latest canary update (#1637)

* Fix WebContextMenus
* BetterGifAltText: futureproof find
* Fix pronoundb profile patch
* Fix NoScreensharePreview
* Fix FakeNitro emote text patch

---------

Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
This commit is contained in:
V 2023-08-12 05:27:59 +02:00 committed by GitHub
parent d5b3b51050
commit 3e732646e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 10 deletions

View file

@ -34,7 +34,7 @@ export default definePlugin({
},
},
{
find: 'preload:"none","aria',
find: ".embedGallerySide",
replacement: {
match: /(?<==(.{1,3})\.alt.{0,20})\?.{0,5}\.Messages\.GIF/,
replace:

View file

@ -313,7 +313,7 @@ export default definePlugin({
find: ".Messages.EMOJI_POPOUT_PREMIUM_JOINED_GUILD_DESCRIPTION",
predicate: () => settings.store.transformEmojis,
replacement: {
match: /((\i)=\i\.node,\i=\i\.emojiSourceDiscoverableGuild)(.+?return )(.{0,450}Messages\.EMOJI_POPOUT_PREMIUM_JOINED_GUILD_DESCRIPTION.+?}\))/,
match: /((\i)=\i\.node,\i=\i\.expressionSourceGuild)(.+?return )(.{0,450}Messages\.EMOJI_POPOUT_PREMIUM_JOINED_GUILD_DESCRIPTION.+?}\))/,
replace: (_, rest1, node, rest2, reactNode) => `${rest1},fakeNitroNode=${node}${rest2}$self.addFakeNotice("EMOJI",${reactNode},fakeNitroNode.fake)`
}
}

View file

@ -27,10 +27,10 @@ export default definePlugin({
{
find: '("ApplicationStreamPreviewUploadManager")',
replacement: [
"\\i\\.default\\.makeChunkedRequest\\(",
"\\i\\.\\i\\.post\\({url:"
String.raw`\i\.\i\.makeChunkedRequest\(`,
String.raw`\i\.\i\.post\({url:`
].map(match => ({
match: new RegExp(`(?=return\\[(\\d),${match}\\i\\.\\i\\.STREAM_PREVIEW.+?}\\)\\];)`),
match: new RegExp(String.raw`(?=return\[(\d),${match}\i\.\i\.STREAM_PREVIEW.+?}\)\];)`),
replace: (_, code) => `return[${code},Promise.resolve({body:"",status:204})];`
}))
}

View file

@ -68,7 +68,8 @@ export default definePlugin({
find: ".USER_PROFILE_ACTIVITY",
replacement: [
{
match: /getGlobalName\(\i\);(?<=displayProfile.{0,200})/,
/* FIXME: old name is getGlobalName, new name is getName. Remove optional Global once stable has also migrated */
match: /\.get(?:Global)?Name\(\i\);(?<=displayProfile.{0,200})/,
replace: "$&const [vcPronounce,vcPronounSource]=$self.useProfilePronouns(arguments[0].user.id,true);if(arguments[0].displayProfile&&vcPronounce)arguments[0].displayProfile.pronouns=vcPronounce;"
},
PRONOUN_TOOLTIP_PATCH

View file

@ -86,7 +86,7 @@ export default definePlugin({
},
// Fix silly Discord calling the non web support copy
{
match: /\w\.default\.copy/,
match: /\i\.\i\.copy/,
replace: "Vencord.Webpack.Common.Clipboard.copy"
}
]
@ -102,7 +102,7 @@ export default definePlugin({
replace: "if(null=="
},
{
match: /return\s*?\[\i\.default\.canCopyImage\(\)/,
match: /return\s*?\[\i\.\i\.canCopyImage\(\)/,
replace: "return [true"
},
{
@ -158,7 +158,7 @@ export default definePlugin({
},
{
// Change calls to DiscordNative.clipboard to us instead
match: /\b\i\.default\.(copy|cut|paste)/g,
match: /\b\i\.\i\.(copy|cut|paste)/g,
replace: "$self.$1"
}
]

View file

@ -93,7 +93,7 @@ export const UserUtils = {
};
export const Clipboard = mapMangledModuleLazy('document.queryCommandEnabled("copy")||document.queryCommandSupported("copy")', {
copy: filters.byCode(".default.copy("),
copy: filters.byCode(".copy("),
SUPPORTS_COPY: x => typeof x === "boolean",
});