Merge branch 'main' into main

This commit is contained in:
Mekdim Dereje 2024-07-13 21:50:40 -07:00 committed by GitHub
commit c8f76eda6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 38 additions and 27 deletions

View file

@ -114,7 +114,7 @@ export default definePlugin({
'("MessageActionCreators")', '("ChannelMessages")', '("MessageActionCreators")', '("ChannelMessages")',
'("Routing/Utils")', '("RTCControlSocket")', '("Routing/Utils")', '("RTCControlSocket")',
'("ConnectionEventFramerateReducer")', '("RTCLatencyTestManager")', '("ConnectionEventFramerateReducer")', '("RTCLatencyTestManager")',
'("OverlayBridgeStore")', '("RPCServer:WSS")' '("OverlayBridgeStore")', '("RPCServer:WSS")', '("RPCServer:IPC")'
].map(logger => ({ ].map(logger => ({
find: logger, find: logger,
predicate: () => settings.store.disableNoisyLoggers, predicate: () => settings.store.disableNoisyLoggers,

View file

@ -39,6 +39,15 @@ export default definePlugin({
} }
}), }),
patches: [ patches: [
// Only one of the two patches will be at effect; Discord often updates to switch between them.
// See: https://discord.com/channels/1015060230222131221/1032770730703716362/1261398512017477673
{
find: ".ENTER&&(!",
replacement: {
match: /(?<=(\i)\.which===\i\.\i.ENTER&&).{0,100}(\(0,\i\.\i\)\(\i\)).{0,100}(?=&&\(\i\.preventDefault)/,
replace: "$self.shouldSubmit($1, $2)"
}
},
{ {
find: "!this.hasOpenCodeBlock()", find: "!this.hasOpenCodeBlock()",
replacement: { replacement: {

View file

@ -88,8 +88,8 @@ export default definePlugin({
{ {
find: "useCanFavoriteChannel", find: "useCanFavoriteChannel",
replacement: { replacement: {
match: /!\(\i\.isDM\(\)\|\|\i\.isThread\(\)\)/, match: /\i\.isDM\(\)\|\|\i\.isThread\(\)/,
replace: "true", replace: "false",
} }
} }
], ],

View file

@ -17,7 +17,7 @@ const container = findByPropsLazy("memberSince");
const getCreatedAtDate = findByCodeLazy('month:"short",day:"numeric"'); const getCreatedAtDate = findByCodeLazy('month:"short",day:"numeric"');
const locale = findByPropsLazy("getLocale"); const locale = findByPropsLazy("getLocale");
const lastSection = findByPropsLazy("lastSection"); const lastSection = findByPropsLazy("lastSection");
const section = findLazy((m: any) => m.section !== void 0 && Object.values(m).length === 1); const section = findLazy((m: any) => m.section !== void 0 && m.heading !== void 0 && Object.values(m).length === 2);
export default definePlugin({ export default definePlugin({
name: "FriendsSince", name: "FriendsSince",

View file

@ -256,6 +256,7 @@ export default definePlugin({
// in profiles // in profiles
{ {
find: ",overrideDiscriminator:", find: ",overrideDiscriminator:",
group: true,
replacement: [ replacement: [
{ {
// prevent channel id from getting ghosted // prevent channel id from getting ghosted
@ -263,7 +264,7 @@ export default definePlugin({
match: /user:\i,nick:\i,/, match: /user:\i,nick:\i,/,
replace: "$&moreTags_channelId," replace: "$&moreTags_channelId,"
}, { }, {
match: /,botType:(\i\((\i)\)),/g, match: /,botType:(\i),(?<=user:(\i).+?)/g,
replace: ",botType:$self.getTag({user:$2,channelId:moreTags_channelId,origType:$1,location:'not-chat'})," replace: ",botType:$self.getTag({user:$2,channelId:moreTags_channelId,origType:$1,location:'not-chat'}),"
} }
] ]

View file

@ -34,7 +34,7 @@ import UserPermissions from "./components/UserPermissions";
import { getSortedRoles, sortPermissionOverwrites } from "./utils"; import { getSortedRoles, sortPermissionOverwrites } from "./utils";
const PopoutClasses = findByPropsLazy("container", "scroller", "list"); const PopoutClasses = findByPropsLazy("container", "scroller", "list");
const RoleButtonClasses = findByPropsLazy("button", "buttonInner", "icon", "text"); const RoleButtonClasses = findByPropsLazy("button", "buttonInner", "icon", "banner");
export const enum PermissionsSortOrder { export const enum PermissionsSortOrder {
HighestRole, HighestRole,

View file

@ -37,8 +37,7 @@ import { getCurrentUserInfo, readNotification } from "./reviewDbApi";
import { settings } from "./settings"; import { settings } from "./settings";
import { showToast } from "./utils"; import { showToast } from "./utils";
const PopoutClasses = findByPropsLazy("container", "scroller", "list"); const RoleButtonClasses = findByPropsLazy("button", "buttonInner", "icon", "banner");
const RoleButtonClasses = findByPropsLazy("button", "buttonInner", "icon", "text");
const guildPopoutPatch: NavContextMenuPatchCallback = (children, { guild }: { guild: Guild, onClose(): void; }) => { const guildPopoutPatch: NavContextMenuPatchCallback = (children, { guild }: { guild: Guild, onClose(): void; }) => {
if (!guild) return; if (!guild) return;
@ -181,9 +180,9 @@ export default definePlugin({
onClick={() => openReviewsModal(user.id, user.username)} onClick={() => openReviewsModal(user.id, user.username)}
look={Button.Looks.FILLED} look={Button.Looks.FILLED}
size={Button.Sizes.NONE} size={Button.Sizes.NONE}
color={RoleButtonClasses.color} color={RoleButtonClasses.bannerColor}
className={classes(RoleButtonClasses.button, RoleButtonClasses.banner)} className={classes(RoleButtonClasses.button, RoleButtonClasses.icon, RoleButtonClasses.banner)}
innerClassName={classes(RoleButtonClasses.buttonInner, RoleButtonClasses.banner)} innerClassName={classes(RoleButtonClasses.buttonInner, RoleButtonClasses.icon, RoleButtonClasses.banner)}
> >
<NotesIcon height={16} width={16} /> <NotesIcon height={16} width={16} />
</Button> </Button>

View file

@ -257,7 +257,7 @@ export default definePlugin({
{ {
find: '"alt+shift+down"', find: '"alt+shift+down"',
replacement: { replacement: {
match: /(?<=getChannel\(\i\);return null!=(\i))(?=.{0,150}?>0\)&&\(0,\i\.\i\)\(\i\))/, match: /(?<=getChannel\(\i\);return null!=(\i))(?=.{0,200}?>0\)&&\(0,\i\.\i\)\(\i\))/,
replace: (_, channel) => `&&!$self.isHiddenChannel(${channel})` replace: (_, channel) => `&&!$self.isHiddenChannel(${channel})`
} }
}, },
@ -265,8 +265,8 @@ export default definePlugin({
{ {
find: ".APPLICATION_STORE&&null!=", find: ".APPLICATION_STORE&&null!=",
replacement: { replacement: {
match: /(?<=getState\(\)\.channelId.{0,30}?\(0,\i\.\i\)\(\i\))(?=\.map\()/, match: /getState\(\)\.channelId.+?(?=\.map\(\i=>\i\.id)/,
replace: ".filter(e=>!$self.isHiddenChannel(e))" replace: "$&.filter(e=>!$self.isHiddenChannel(e))"
} }
}, },
{ {

View file

@ -183,14 +183,24 @@ export default definePlugin({
}, },
patches: [ patches: [
// Profiles Modal pfp // Avatar component used in User DMs "User Profile" popup in the right and Profiles Modal pfp
...[".MODAL,hasProfileEffect", ".FULL_SIZE,hasProfileEffect:"].map(find => ({ {
find, find: ".overlay:void 0,status:",
replacement: [
...[/"PRESS_VIEW_PROFILE".+?(?=children:)(?<=avatarSrc:(\i).+?)/, /avatarSrc:(\i),eventHandlers:(\i).+?"div",{...\2,/].map(match => ({
match,
replace: "$&style:{cursor:\"pointer\"},onClick:()=>{$self.openImage($1)},"
}))
]
},
// Old Profiles Modal pfp
{
find: ".MODAL,hasProfileEffect",
replacement: { replacement: {
match: /\{src:(\i)(?=,avatarDecoration)/, match: /\{src:(\i)(?=,avatarDecoration)/,
replace: "{src:$1,onClick:()=>$self.openImage($1)" replace: "{src:$1,onClick:()=>$self.openImage($1)"
} }
})), },
// Banners // Banners
...[".NITRO_BANNER,", "=!1,canUsePremiumCustomization:"].map(find => ({ ...[".NITRO_BANNER,", "=!1,canUsePremiumCustomization:"].map(find => ({
find, find,
@ -202,7 +212,7 @@ export default definePlugin({
'onClick:ev=>$1&&ev.target.style.backgroundImage&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,' 'onClick:ev=>$1&&ev.target.style.backgroundImage&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,'
} }
})), })),
// User DMs "User Profile" popup in the right // Old User DMs "User Profile" popup in the right
{ {
find: ".avatarPositionPanel", find: ".avatarPositionPanel",
replacement: { replacement: {
@ -210,14 +220,6 @@ export default definePlugin({
replace: "$1style:($2)?{cursor:\"pointer\"}:{},onClick:$2?()=>{$self.openImage($3)}" replace: "$1style:($2)?{cursor:\"pointer\"}:{},onClick:$2?()=>{$self.openImage($3)}"
} }
}, },
{
find: ".canUsePremiumProfileCustomization,{avatarSrc:",
replacement: {
match: /children:\(0,\i\.jsx\)\(\i,{src:(\i)/,
replace: "style:{cursor:\"pointer\"},onClick:()=>{$self.openImage($1)},$&"
}
},
// Group DMs top small & large icon // Group DMs top small & large icon
{ {
find: /\.recipients\.length>=2(?!<isMultiUserDM.{0,50})/, find: /\.recipients\.length>=2(?!<isMultiUserDM.{0,50})/,