Patches
Some checks failed
Test / Test (push) Has been cancelled

This commit is contained in:
thororen1234 2025-04-21 23:30:40 -04:00
parent a068fb8e8a
commit 186e7b5595
No known key found for this signature in database
9 changed files with 51 additions and 36 deletions

View file

@ -48,7 +48,7 @@ export default definePlugin({
{
find: ".COLLECTIBLES_SHOP_FULLSCREEN))",
replacement: {
match: /(\?void 0:(\i)\.channelId.{0,300}return)((.{0,15})"div",{.*?\])(\}\)\}\})/,
match: /(\?void 0:(\i)\.channelId.{0,500}return)((.{0,15})"div",{.*?\])(\}\)\}\})/,
replace: "$1$4$self.render,{currentChannel:$2,children:$3})$5"
}
},

View file

@ -36,9 +36,13 @@ export default definePlugin({
match: /let\{[^}]*lostPermissionTooltipText:\i[^}]*\}=(\i),/,
replace: "$&vencordProps=$1,"
},
{
match: /decorators:.{0,100}?(?=user:)/,
replace: "$&vencordProps:typeof vencordProps!=='undefined'?vencordProps:void 0,"
},
{
match: /children:\[(?=.{0,300},lostPermissionTooltipText:)/,
replace: "children:[(typeof vencordProps!=='undefined'&&Vencord.Api.MemberListDecorators.__getDecorators(vencordProps)),"
replace: "children:[(arguments[0]?.vencordProps&&Vencord.Api.MemberListDecorators.__getDecorators(arguments[0].vencordProps)),"
}
]
},

View file

@ -9,7 +9,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { getCurrentChannel } from "@utils/discord";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
import { findComponentByCodeLazy } from "@webpack";
import { ContextMenuApi, Menu, useEffect, useRef } from "@webpack/common";
import { User } from "discord-types/general";
@ -19,8 +19,7 @@ interface UserProfileProps {
originalRenderPopout: () => React.ReactNode;
}
const UserProfile = findComponentByCodeLazy("UserProfilePopoutWrapper: user cannot be undefined");
const styles = findByPropsLazy("accountProfilePopoutWrapper");
const UserProfile = findComponentByCodeLazy(".BITE_SIZE,user:");
let openAlternatePopout = false;
let accountPanelRef: React.RefObject<Record<PropertyKey, any> | null> = { current: null };
@ -77,7 +76,7 @@ export default definePlugin({
replace: "$self.useAccountPanelRef();$&"
},
{
match: /(\.AVATAR,children:.+?renderPopout:(\(\i,\i\))=>){(.+?)}(?=,position)(?<=currentUser:(\i).+?)/,
match: /(\.AVATAR,children:.+?renderPopout:\((\i),\i\)=>){(.+?)}(?=,position)(?<=currentUser:(\i).+?)/,
replace: (_, rest, popoutProps, originalPopout, currentUser) => `${rest}$self.UserProfile({popoutProps:${popoutProps},currentUser:${currentUser},originalRenderPopout:()=>{${originalPopout}}})`
},
{
@ -121,14 +120,18 @@ export default definePlugin({
}
const currentChannel = getCurrentChannel();
if (currentChannel?.getGuildId() == null) {
if (currentChannel?.getGuildId() == null || !UserProfile.$$vencordGetWrappedComponent()) {
return originalRenderPopout();
}
return (
<div className={styles.accountProfilePopoutWrapper}>
<UserProfile {...popoutProps} userId={currentUser.id} guildId={currentChannel.getGuildId()} channelId={currentChannel.id} />
</div>
<UserProfile
{...popoutProps}
user={currentUser}
currentUser={currentUser}
guildId={currentChannel.getGuildId()}
channelId={currentChannel.id}
/>
);
}, { noop: true })
});

View file

@ -124,27 +124,42 @@ export default definePlugin({
replacement: [
// Create the isBetterFolders variable in the GuildsBar component
{
match: /let{disableAppDownload:\i=\i\.isPlatformEmbedded,isOverlay:.+?(?=}=\i,)/,
match: /let{disableAppDownload:\i=\i\.isPlatformEmbedded,isOverlay:.+?(?=}=\i,)/g,
replace: "$&,isBetterFolders"
},
// If we are rendering the Better Folders sidebar, we filter out guilds that are not in folders and unexpanded folders
{
match: /\[(\i)\]=(\(0,\i\.\i\).{0,40}getGuildsTree\(\).+?}\))(?=,)/,
match: /\[(\i)\]=(\(0,\i\.\i\).{0,40}getGuildsTree\(\).+?}\))(?=,)/g,
replace: (_, originalTreeVar, rest) => `[betterFoldersOriginalTree]=${rest},${originalTreeVar}=$self.getGuildTree(!!arguments[0]?.isBetterFolders,betterFoldersOriginalTree,arguments[0]?.betterFoldersExpandedIds)`
},
// If we are rendering the Better Folders sidebar, we filter out everything but the servers and folders from the GuildsBar Guild List children
{
match: /lastTargetNode:\i\[\i\.length-1\].+?}\)(?::null)?\](?=}\))/,
match: /lastTargetNode:\i\[\i\.length-1\].+?}\)(?::null)?\](?=}\))/g,
replace: "$&.filter($self.makeGuildsBarGuildListFilter(!!arguments[0]?.isBetterFolders))"
},
// If we are rendering the Better Folders sidebar, we filter out everything but the scroller for the guild list from the GuildsBar Tree children
// As of now, this is just the unread indicator at the bottom
// Discord has two different sidebars controlled by an experiment
// only the second one needs this filter
{
match: /unreadMentionsIndicatorBottom,.+?}\)\]/,
match: /topSection.+?unreadMentionsIndicatorBottom,.+?}\)\]/,
replace: "$&.filter($self.makeGuildsBarTreeFilter(!!arguments[0]?.isBetterFolders))"
},
// With one of the sidebar versions, there is a sticky top bar. Don't render it if we are rendering the Better Folders sidebar
{
// [^0] to not match any other JSX call
match: /(?=\(0,\i\.jsxs?\)[^0]+\.topSection)/,
replace: "!!arguments[0]?.isBetterFolders?null:"
},
// Don't render the tiny separator line at the top of the Better Folders sidebar
// Only needed with the sidebar variant with the sticky top bar
{
match: /(?=\(0,\i\.jsxs?\)[^0]+fullWidth:)/,
replace: "!!arguments[0]?.isBetterFolders?null:"
},
// Export the isBetterFolders variable to the folders component
{
match: /switch\(\i\.type\){case \i\.\i\.FOLDER:.+?folderNode:\i,/,
match: /switch\(\i\.type\){case \i\.\i\.FOLDER:.+?folderNode:\i,/g,
replace: '$&isBetterFolders:typeof isBetterFolders!=="undefined"?isBetterFolders:false,'
}
]
@ -327,13 +342,7 @@ export default definePlugin({
return child => {
if (!isBetterFolders) return true;
if (child?.props?.className?.includes("itemsContainer") && child.props.children != null) {
// Filter out everything but the scroller for the guild list
child.props.children = child.props.children.filter(child => child?.props?.onScroll != null);
return true;
}
return false;
return child?.props?.className?.includes("itemsContainer") && child.props.children != null;
};
},

View file

@ -29,7 +29,8 @@ export default definePlugin({
{
find: "#{intl::GUILD_OWNER}),children:",
replacement: {
match: /,isOwner:(\i),/,
// The isOwner prop is used in more tha one component in this module. Make sure we patch the right one
match: /,isOwner:(\i),(?=[^}]+guildId)/,
replace: ",_isOwner:$1=$self.isGuildOwner(e),"
}
}

View file

@ -1,5 +0,0 @@
# No Unblock To Jump
Removes the popup preventing you to jump to a message from a blocked/ignored user (eg: in search results)
![A modal popup telling you to unblock a user to jump their message](https://github.com/user-attachments/assets/0e4b859d-f3b3-4101-9a83-829afb473d1e)

View file

@ -30,7 +30,7 @@ export default definePlugin({
find: '.id,"Search Results"',
replacement: [
{
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
match: /if\(.{1,40}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
replace: "if(false)$1"
},
{

View file

@ -91,7 +91,8 @@ export default definePlugin({
}
},
{
find: 'location:"UserProfilePanel"',
// location: "UserProfileSiebar"
find: ".PANEL,children:[",
replacement: {
match: /{profileType:\i\.\i\.PANEL,children:\[/,
replace: "$&$self.BiteSizeReviewsButton({user:arguments[0].user}),"

View file

@ -357,7 +357,7 @@ export default definePlugin({
]
},
{
find: '})},"overflow"))',
find: "overflowCountVariant",
replacement: [
{
// Create a variable for the channel prop
@ -366,17 +366,19 @@ export default definePlugin({
},
{
// Make Discord always render the plus button if the component is used inside the HiddenChannelLockScreen
match: /\i>0(?=&&.{0,60}renderPopout)/,
match: /\i>0(?=&&.{0,60}Math.min)/,
replace: m => `($self.isHiddenChannel(typeof shcChannel!=="undefined"?shcChannel:void 0,true)?true:${m})`
},
{
// Prevent Discord from overwriting the last children with the plus button if the overflow amount is <= 0 and the component is used inside the HiddenChannelLockScreen
match: /(?<=\.value\(\),(\i)=.+?length-)1(?=\]=.{0,60}renderPopout)/,
// Prevent Discord from overwriting the last children with the plus button
// if the overflow amount is <= 0 and the component is used inside the HiddenChannelLockScreen
match: /(?<=\i\.length-)1(?=\]=.{0,60}renderPopout)(?<=(\i)=\i\.length-\i.*)/,
replace: (_, amount) => `($self.isHiddenChannel(typeof shcChannel!=="undefined"?shcChannel:void 0,true)&&${amount}<=0?0:1)`
},
{
// Show only the plus text without overflowed children amount if the overflow amount is <= 0 and the component is used inside the HiddenChannelLockScreen
match: /(?<="\+",)(\i)\+1/,
// Show only the plus text without overflowed children amount
// if the overflow amount is <= 0 and the component is used inside the HiddenChannelLockScreen
match: /(?<="\+"\.concat\()(\i)/,
replace: (m, amount) => `$self.isHiddenChannel(typeof shcChannel!=="undefined"?shcChannel:void 0,true)&&${amount}<=0?"":${m}`
}
]