Fixes For BetterFolders & ReviewDB
Some checks are pending
Test / Test (push) Waiting to run
Release / Build Equicord (push) Waiting to run

Co-Authored-By: sadan4 <117494111+sadan4@users.noreply.github.com>
This commit is contained in:
thororen1234 2025-04-26 16:19:59 -04:00
parent db08d79314
commit 720edbdc3b
No known key found for this signature in database
2 changed files with 23 additions and 24 deletions

View file

@ -106,14 +106,10 @@ export const settings = definePluginSettings({
}
});
const cssMade = false;
const cssElementId = "VC-BetterFolders";
export default definePlugin({
name: "BetterFolders",
description: "Shows server folders on dedicated sidebar and adds folder related improvements",
authors: [Devs.juby, Devs.AutumnVN, Devs.Nuckyz, Devs.sadan],
authors: [Devs.juby, Devs.AutumnVN, Devs.Nuckyz],
settings,
@ -123,26 +119,29 @@ export default definePlugin({
predicate: () => settings.store.sidebar,
replacement: [
// Create the isBetterFolders variable in the GuildsBar component
// Needed because we access this from a closure so we can't use arguments[0]
{
match: /let{disableAppDownload:\i=\i\.isPlatformEmbedded,isOverlay:.+?(?=}=\i,)/g,
match: /let{disableAppDownload:\i=\i\.isPlatformEmbedded,isOverlay:.+?(?=}=\i,)/,
replace: "$&,isBetterFolders"
},
// Discord extacts the folders component, we need to pass the isBetterFolders and betterFoldersExpandedIds variable to it
{
match: /0,\i\.jsxs?[^0}]{0,100}guildDiscoveryButton:\i,/g,
replace: "$&isBetterFolders:arguments[0]?.isBetterFolders,betterFoldersExpandedIds:arguments[0]?.betterFoldersExpandedIds,"
},
// 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\(\).+?}\))(?=,)/g,
match: /\[(\i)\]=(\(0,\i\.\i\).{0,40}getGuildsTree\(\).+?}\))(?=,)/,
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)?\](?=}\))/g,
match: /lastTargetNode:\i\[\i\.length-1\].+?}\)(?::null)?\](?=}\))/,
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: /topSection.+?unreadMentionsIndicatorBottom,.+?}\)\]/,
match: /lurkingGuildIds:\i\}\)\](?=\}\)\})/,
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
@ -159,7 +158,7 @@ export default definePlugin({
},
// Export the isBetterFolders variable to the folders component
{
match: /switch\(\i\.type\){case \i\.\i\.FOLDER:.+?folderNode:\i,/g,
match: /switch\(\i\.type\){case \i\.\i\.FOLDER:.+?folderNode:\i,/,
replace: '$&isBetterFolders:typeof isBetterFolders!=="undefined"?isBetterFolders:false,'
}
]
@ -342,7 +341,7 @@ export default definePlugin({
return child => {
if (!isBetterFolders) return true;
return child?.props?.className?.includes("itemsContainer") && child.props.children != null;
return !!child?.props?.renderTreeNode;
};
},

View file

@ -77,25 +77,25 @@ export default definePlugin({
patches: [
{
find: ".BITE_SIZE,user:",
find: ".POPOUT,user:",
replacement: {
match: /{profileType:\i\.\i\.BITE_SIZE,children:\[/,
replace: "$&$self.BiteSizeReviewsButton({user:arguments[0].user}),"
match: /(children:\[)([^[]+shouldShowTooltip:)/,
replace: "$1$self.BiteSizeReviewsButton({user:arguments[0].user}),$2"
}
},
{
find: ".FULL_SIZE,user:",
find: ".MODAL,user:",
replacement: {
match: /{profileType:\i\.\i\.FULL_SIZE,children:\[/,
replace: "$&$self.BiteSizeReviewsButton({user:arguments[0].user}),"
match: /(children:\[)([^[]+shouldShowTooltip:)/,
replace: "$1$self.BiteSizeReviewsButton({user:arguments[0].user}),$2"
}
},
{
// location: "UserProfileSiebar"
find: ".PANEL,children:[",
// places like the user profile on the right in dms
find: 'location:"UserProfileSiebar"',
replacement: {
match: /{profileType:\i\.\i\.PANEL,children:\[/,
replace: "$&$self.BiteSizeReviewsButton({user:arguments[0].user}),"
match: /(children:\[)([^[]+shouldShowTooltip:)/,
replace: "$1$self.BiteSizeReviewsButton({user:arguments[0].user}),$2"
}
}
],