Skip to content

Commit

Permalink
fix: plaintext patches for new intl
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeIlLeone committed Nov 8, 2024
1 parent 1df7737 commit cbbf750
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/renderer/coremods/badges/plaintextPatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { PlaintextPatch } from "src/types";
export default [
{
// Edit the ProfileBadges component
find: /\.container,\w+\),"aria-label":\w+.\w+\.Messages\.PROFILE_USER_BADGES/,
find: /action:"PRESS_BADGE"/,
replacements: [
// Add the "replugged-badge" class if it's our custom badge
{
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/coremods/contextMenu/plaintextPatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default [
{
match: /((\w+)\){)(var\s*\w+;let{navId:)/,
replace: (_, prefix, props, suffix) =>
`${prefix}${props}=replugged.coremods.coremods.contextMenu._insertMenuItems(${props});${suffix}`,
`${prefix}${props}=replugged.coremods.coremods.contextMenu?._insertMenuItems(${props});${suffix}`,
},
],
},
Expand Down
5 changes: 2 additions & 3 deletions src/renderer/coremods/language/plaintextPatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ export default [
find: "getAvailableLocales",
replacements: [
{
match: /(\.Messages\.LANGUAGE,)\s*children:((?:[^}]*?}){3}\))/,
replace: (_, prefix, ogChild) =>
`${prefix}children:[${coremodStr}?.Card() ?? null,${ogChild}]`,
match: /(\.H1,title:\w+\.intl\.string\(.+?\),children:)((?:[^}]*?}){3}\))/,
replace: (_, prefix, ogChild) => `${prefix}[${coremodStr}?.Card() ?? null,${ogChild}]`,
},
{
match: /children:\[(.+?\.localeName[^\]]*?)]/,
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/coremods/messagePopover/plaintextPatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import type { PlaintextPatch } from "src/types";

export default [
{
find: "Messages.MESSAGE_UTILITIES_A11Y_LABEL",
find: 'navId:"message-actions"',
replacements: [
{
match: /(\.Fragment,{children:\[)(.{1,75},{label:\w+\.\w+\.Messages\.COPY_ID_MESSAGE)/,
match: /(\.Fragment,{children:\[)(.{1,75},{label:.{1,100}"copy-id")/,
replace: (_, prefix, suffix) =>
`${prefix}...(replugged.coremods.coremods.messagePopover?._buildPopoverElements(arguments[0]?.message,arguments[0]?.channel) ?? []),${suffix}`,
},
Expand Down

0 comments on commit cbbf750

Please sign in to comment.