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))", find: ".COLLECTIBLES_SHOP_FULLSCREEN))",
replacement: { 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" replace: "$1$4$self.render,{currentChannel:$2,children:$3})$5"
} }
}, },

View file

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

View file

@ -124,27 +124,42 @@ export default definePlugin({
replacement: [ replacement: [
// Create the isBetterFolders variable in the GuildsBar component // 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" replace: "$&,isBetterFolders"
}, },
// If we are rendering the Better Folders sidebar, we filter out guilds that are not in folders and unexpanded folders // 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)` 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 // 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))" 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 // 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))" 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 // 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,' replace: '$&isBetterFolders:typeof isBetterFolders!=="undefined"?isBetterFolders:false,'
} }
] ]
@ -327,13 +342,7 @@ export default definePlugin({
return child => { return child => {
if (!isBetterFolders) return true; if (!isBetterFolders) return true;
if (child?.props?.className?.includes("itemsContainer") && child.props.children != null) { return 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;
}; };
}, },

View file

@ -29,7 +29,8 @@ export default definePlugin({
{ {
find: "#{intl::GUILD_OWNER}),children:", find: "#{intl::GUILD_OWNER}),children:",
replacement: { 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)," 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"', find: '.id,"Search Results"',
replacement: [ 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" replace: "if(false)$1"
}, },
{ {

View file

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

View file

@ -357,7 +357,7 @@ export default definePlugin({
] ]
}, },
{ {
find: '})},"overflow"))', find: "overflowCountVariant",
replacement: [ replacement: [
{ {
// Create a variable for the channel prop // 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 // 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})` 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 // Prevent Discord from overwriting the last children with the plus button
match: /(?<=\.value\(\),(\i)=.+?length-)1(?=\]=.{0,60}renderPopout)/, // 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)` 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 // Show only the plus text without overflowed children amount
match: /(?<="\+",)(\i)\+1/, // 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}` replace: (m, amount) => `$self.isHiddenChannel(typeof shcChannel!=="undefined"?shcChannel:void 0,true)&&${amount}<=0?"":${m}`
} }
] ]