Misc fixes and improvements (#555)

Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
Nuckyz
2023-03-05 18:49:59 -03:00
committed by GitHub
parent a5392e5c53
commit bed5e98bb0
6 changed files with 31 additions and 18 deletions

View File

@ -26,7 +26,7 @@ import { findByPropsLazy } from "@webpack";
import { ChannelStore, PermissionStore, Tooltip } from "@webpack/common";
import { Channel } from "discord-types/general";
import HiddenChannelLockScreen from "./components/HiddenChannelLockScreen";
import HiddenChannelLockScreen, { setChannelBeginHeaderComponent, setEmojiComponent } from "./components/HiddenChannelLockScreen";
const ChannelListClasses = findByPropsLazy("channelName", "subtitle", "modeMuted", "iconContainer");
@ -239,8 +239,8 @@ export default definePlugin({
{
find: 'jumboable?"jumbo":"default"',
replacement: {
match: /(?<=\i:\(\)=>\i)(?=}.+?(?<component>\i)=function.{1,20}node,\i=\i.isInteracting)/,
replace: ",hc1:()=>$<component>" // Blame Ven length check for the small name :pensive_cry:
match: /(?<=(?<component>\i)=function.{1,20}node,\i=\i.isInteracting.+?}}\)},)/,
replace: "shcEmojiComponentExport=($self.setEmojiComponent($<component>),void 0),"
}
},
{
@ -248,8 +248,8 @@ export default definePlugin({
replacement: [
{
// Export the channel beggining header
match: /(?<=\i:\(\)=>\i)(?=}.+?function (?<component>\i).{1,600}computePermissionsForRoles)/,
replace: ",hc2:()=>$<component>"
match: /(?<=function (?<component>\i)\(.{1,600}computePermissionsForRoles.+?}\)})(?=var)/,
replace: "$self.setChannelBeginHeaderComponent($<component>);"
},
{
// Patch the header to only return allowed users and roles if it's a hidden channel (Like when it's used on the HiddenChannelLockScreen)
@ -325,6 +325,9 @@ export default definePlugin({
}
],
setEmojiComponent,
setChannelBeginHeaderComponent,
isHiddenChannel(channel: Channel & { channelId?: string; }) {
if (!channel) return false;