diff options
| author | Nuckyz <61953774+Nuckyz@users.noreply.github.com> | 2023-05-19 21:24:56 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-20 02:24:56 +0200 |
| commit | ec091a79591cf9619dd589102f5b338827b70ad8 (patch) | |
| tree | bbb7f56689a4ef399d5ef67cfda68d6f97a2b1db /src/plugins/showHiddenChannels | |
| parent | 89a6c575c9cfe6a6fa72def404220817e008cfea (diff) | |
| download | Vencord-ec091a79591cf9619dd589102f5b338827b70ad8.tar.gz Vencord-ec091a79591cf9619dd589102f5b338827b70ad8.tar.bz2 Vencord-ec091a79591cf9619dd589102f5b338827b70ad8.zip | |
Fix SHC broken patches; Sort PermViewer channel overwrites roles (#1166)
Diffstat (limited to 'src/plugins/showHiddenChannels')
| -rw-r--r-- | src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx | 5 | ||||
| -rw-r--r-- | src/plugins/showHiddenChannels/index.tsx | 10 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx b/src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx index 506fbe7..d01efec 100644 --- a/src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx +++ b/src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx @@ -26,6 +26,7 @@ import type { Channel } from "discord-types/general"; import type { ComponentType } from "react"; import openRolesAndUsersPermissionsModal, { PermissionType, RoleOrUserPermission } from "../../permissionsViewer/components/RolesAndUsersPermissions"; +import { sortPermissionOverwrites } from "../../permissionsViewer/utils"; import { settings, VIEW_CHANNEL } from ".."; enum SortOrderTypes { @@ -169,12 +170,12 @@ function HiddenChannelLockScreen({ channel }: { channel: ExtendedChannel; }) { } if (Settings.plugins.PermissionsViewer.enabled) { - setPermissions(Object.values(permissionOverwrites).map(overwrite => ({ + setPermissions(sortPermissionOverwrites(Object.values(permissionOverwrites).map(overwrite => ({ type: overwrite.type as PermissionType, id: overwrite.id, overwriteAllow: overwrite.allow, overwriteDeny: overwrite.deny - }))); + })), guild_id)); } }, [channelId]); diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index 667f710..634b5cd 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -107,13 +107,13 @@ export default definePlugin({ }, { // Prevent Discord from trying to connect to hidden channels - match: /(?=\|\|\i\.default\.selectVoiceChannel\((\i)\.id\))/, - replace: (_, channel) => `||$self.isHiddenChannel(${channel})` + match: /if\(!\i&&!\i(?=.{0,50}?selectVoiceChannel\((\i)\.id\))/, + replace: (m, channel) => `${m}&&!$self.isHiddenChannel(${channel})` }, { // Make Discord show inside the channel if clicking on a hidden or locked channel - match: /(?<=\|\|\i\.default\.selectVoiceChannel\((\i)\.id\);!__OVERLAY__&&\()/, - replace: (_, channel) => `$self.isHiddenChannel(${channel},true)||` + match: /!__OVERLAY__&&\((?<=selectVoiceChannel\((\i)\.id\).+?)/, + replace: (m, channel) => `${m}$self.isHiddenChannel(${channel},true)||` } ] }, @@ -195,7 +195,7 @@ export default definePlugin({ replace: (_, pushNotificationButtonExpression, channel) => `if($self.isHiddenChannel(${channel})){${pushNotificationButtonExpression}break;}` }, { - match: /(?<=renderHeaderToolbar=function.+?case \i\.\i\.GUILD_FORUM:if\(!\i\){)(?=.+?;(.+?{channel:(\i)},"notifications"\)\)))/, + match: /(?<=renderHeaderToolbar=function.+?case \i\.\i\.GUILD_FORUM:.+?if\(!\i\){)(?=.+?;(.+?{channel:(\i)},"notifications"\)\)))/, replace: (_, pushNotificationButtonExpression, channel) => `if($self.isHiddenChannel(${channel})){${pushNotificationButtonExpression};break;}` }, { |
