Fix Broken Finds & Patches

Co-Authored-By: Sadan <117494111+sadan4@users.noreply.github.com>
This commit is contained in:
thororen1234 2026-07-02 13:27:05 -04:00
parent de485f8f98
commit 67971c706a
No known key found for this signature in database
6 changed files with 14 additions and 34 deletions

View file

@ -19,7 +19,7 @@ export default definePlugin({
patches: [
{
find: ".DISPLAY_NAME_STYLES_COACHMARK)",
find: "#{intl::USER_PROFILE_ACCOUNT_POPOUT_BUTTON_A11Y_LABEL}",
replacement: [
{
match: /children:\[(?=.{0,50}accountContainerRef:\i)/,

View file

@ -173,7 +173,7 @@ export default definePlugin({
},
// User Area
{
find: ".DISPLAY_NAME_STYLES_COACHMARK)",
find: "#{intl::USER_PROFILE_ACCOUNT_POPOUT_BUTTON_A11Y_LABEL}",
replacement: [
{
match: /((\i)=\i\?\.avatarDecoration,\i=)\(0,\i\.\i\)\(\2\)/,
@ -221,7 +221,7 @@ export default definePlugin({
},
{
// Always show username
find: ".DISPLAY_NAME_STYLES_COACHMARK)",
find: "#{intl::USER_PROFILE_ACCOUNT_POPOUT_BUTTON_A11Y_LABEL}",
replacement: {
match: /hoverText:(\i),forceHover:\i,children:/g,
replace: "hoverText:$1,forceHover:!0,children:"

View file

@ -53,7 +53,7 @@ export default definePlugin({
}]
},
{
find: ".GIFT_PROMOTION]).",
find: '("ChannelTextAreaButtons")',
replacement: [
{
match: /(?<=(,\i\.stickers\?\.button.{0,50}\i\.push\(\(.{0,100})\},"sticker"\)\))/,

View file

@ -48,7 +48,7 @@ export default definePlugin({
patches: [
{
find: ".DISPLAY_NAME_STYLES_COACHMARK)",
find: "#{intl::USER_PROFILE_ACCOUNT_POPOUT_BUTTON_A11Y_LABEL}",
replacement: {
// react.jsx)(AccountPanel, { ..., showTaglessAccountPanel: blah })
match: /(?<=\i\.jsxs?\)\()(\i),{(?=[^}]*?userTag:\i,occluded:)/,

View file

@ -88,7 +88,7 @@ export default definePlugin({
},
// Current user area, at bottom of channels/dm list
{
find: ".DISPLAY_NAME_STYLES_COACHMARK)",
find: "#{intl::USER_PROFILE_ACCOUNT_POPOUT_BUTTON_A11Y_LABEL}",
replacement: [
// Use Decor avatar decoration hook
{

View file

@ -738,32 +738,6 @@ export default definePlugin({
replace:
"Object.assign($&,{ deleted:$1.deleted, editHistory:$1.editHistory, firstEditTimestamp:$1.firstEditTimestamp, diffViewDisabled:$1.diffViewDisabled })",
},
{
// Construct new edited message and add editHistory & deleted (ref above)
// Pass in custom data to attachment parser to mark attachments deleted as well
match: /attachments:(\i)\((\i)\)/,
replace:
"attachments: $1((() => {" +
" if ($self.shouldIgnore($2)) return $2;" +
" let old = arguments[1]?.attachments;" +
" if (!old) return $2;" +
" let new_ = $2.attachments?.map(a => a.id) ?? [];" +
" let diff = old.filter(a => !new_.includes(a.id));" +
" old.forEach(a => a.deleted = true);" +
" $2.attachments = [...diff, ...$2.attachments];" +
" return $2;" +
"})())," +
"deleted: arguments[1]?.deleted," +
"editHistory: arguments[1]?.editHistory," +
"firstEditTimestamp: new Date(arguments[1]?.firstEditTimestamp ?? $2.editedTimestamp ?? $2.timestamp)," +
"diffViewDisabled: arguments[1]?.diffViewDisabled",
},
{
// Preserve deleted attribute on attachments
match: /(\((\i)\){return null==\2\.attachments.+?)spoiler:/,
replace: "$1deleted: arguments[0]?.deleted," + "spoiler:",
},
],
},
@ -771,9 +745,15 @@ export default definePlugin({
// Attachment renderer
find: "#{intl::REMOVE_ATTACHMENT_TOOLTIP_TEXT}",
replacement: [
// add deleted class to deleted attachments
{
match: /\.SPOILER,(?=\[\i\.\i\]:)/,
replace: '$&"messagelogger-deleted-attachment":arguments[0]?.item?.originalItem?.deleted,'
// we can't use arguments[0] because we patch a nested **non-arrow** function
match: /\.SPOILER,(?=\[\i\.\i\]:)(?<=item:(\i),.{0,200}?)/,
replace: '$&"messagelogger-deleted-attachment": $1?.originalItem?.deleted,'
},
{
match: /(?<=function \i\(\i\)\{let\{[^}]*?item:(\i),\i:\i,)canRemoveItem:(\i)(?=,onRemoveItem:)/,
replace: "_canRemoveItem:$2 = arguments[0].canRemoveItem && !$1?.originalItem?.deleted",
}
]
},