Fix broken patches
This commit is contained in:
parent
7b1d03699d
commit
70278f64a9
2 changed files with 20 additions and 14 deletions
|
@ -22,12 +22,17 @@ import definePlugin from "@utils/types";
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "MessagePopoverAPI",
|
name: "MessagePopoverAPI",
|
||||||
description: "API to add buttons to message popovers.",
|
description: "API to add buttons to message popovers.",
|
||||||
authors: [Devs.KingFish],
|
authors: [Devs.KingFish, Devs.Ven],
|
||||||
patches: [{
|
patches: [{
|
||||||
find: "Messages.MESSAGE_UTILITIES_A11Y_LABEL",
|
find: "Messages.MESSAGE_UTILITIES_A11Y_LABEL",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\?(?<makeButton>\i)\(.{1,35}\.Messages\.CONFIGURE.+?message:(?<message>\i).+?children:\[/,
|
// foo && !bar ? createElement(blah,...makeElement(addReactionData))
|
||||||
replace: "$&...Vencord.Api.MessagePopover._buildPopoverElements($<message>,$<makeButton>),"
|
match: /(\i&&!\i)\?\(0,\i\.jsxs?\)\(.{0,20}renderPopout:.{0,300}?(\i)\(.{3,20}\{key:"add-reaction".+?\}/,
|
||||||
|
replace: (m, bools, makeElement) => {
|
||||||
|
const msg = m.match(/message:(.{1,3}),/)?.[1];
|
||||||
|
if (!msg) throw new Error("Could not find message variable");
|
||||||
|
return `...(${bools}?Vencord.Api.MessagePopover._buildPopoverElements(${msg},${makeElement}):[]),${m}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
});
|
});
|
||||||
|
|
|
@ -43,17 +43,18 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
// pass the target to the open link menu so we can check if it's an image
|
// pass the target to the open link menu so we can check if it's an image
|
||||||
find: "REMOVE_ALL_REACTIONS_CONFIRM_BODY,",
|
find: ".Messages.MESSAGE_ACTIONS_MENU_LABEL",
|
||||||
replacement: {
|
replacement: [
|
||||||
// url1 = url2 = props.attachment.url
|
{
|
||||||
// ...
|
match: /ariaLabel:\i\.Z\.Messages\.MESSAGE_ACTIONS_MENU_LABEL/,
|
||||||
// OpenLinks(url2 != null ? url2 : url1, someStuffs)
|
replace: "$&,_vencordTarget:arguments[0].target"
|
||||||
//
|
},
|
||||||
// the back references are needed because the code is like Z(a!=null?b:c,d), no way to match that
|
{
|
||||||
// otherwise
|
// var f = props.itemHref, .... MakeNativeMenu(null != f ? f : blah)
|
||||||
match: /(?<props>.).onHeightUpdate.{0,200}(.)=(.)=.\.url;.+?\(null!=\3\?\3:\2[^)]+/,
|
match: /(\i)=\i\.itemHref,.+?\(null!=\1\?\1:.{1,10}(?=\))/,
|
||||||
replace: "$&,$<props>.target"
|
replace: "$&,arguments[0]._vencordTarget"
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
makeMenu(src: string, target: HTMLElement) {
|
makeMenu(src: string, target: HTMLElement) {
|
||||||
|
|
Loading…
Reference in a new issue