From cb980a1cadc3eeb6b69e62821be951764dd5c806 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Wed, 28 Jun 2023 00:45:16 -0300 Subject: [PATCH] Fix broken SHC patches (#1360) --- src/plugins/showHiddenChannels/index.tsx | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index 64500c40..1aa484af 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -342,32 +342,27 @@ export default definePlugin({ ] }, { - find: "Guild voice channel without guild id.", + find: "useNotificationSettingsItem: channel cannot be undefined", replacement: [ { // Render our HiddenChannelLockScreen component instead of the main stage channel component - match: /Guild voice channel without guild id.+?children:(?<=(\i)\.getGuildId\(\).+?)(?=.{0,20}?}\)}function)/, + match: /"124px".+?children:(?<=var (\i)=\i\.channel.+?)(?=.{0,20}?}\)}function)/, replace: (m, channel) => `${m}$self.isHiddenChannel(${channel})?$self.HiddenChannelLockScreen(${channel}):` }, { // Disable useless components for the HiddenChannelLockScreen of stage channels - match: /render(?!Header).{0,30}?:(?<=(\i)\.getGuildId\(\).+?Guild voice channel without guild id.+?)/g, + match: /render(?:BottomLeft|BottomCenter|BottomRight|ChatToasts):(?<=var (\i)=\i\.channel.+?)/g, replace: (m, channel) => `${m}$self.isHiddenChannel(${channel})?null:` }, - // Prevent Discord from replacing our route if we aren't connected to the stage channel - { - match: /(?=!\i&&!\i&&!\i.{0,80}?(\i)\.getGuildId\(\).{0,50}?Guild voice channel without guild id)(?<=if\()/, - replace: (_, channel) => `!$self.isHiddenChannel(${channel})&&` - }, { // Disable gradients for the HiddenChannelLockScreen of stage channels - match: /Guild voice channel without guild id.+?disableGradients:(?<=(\i)\.getGuildId\(\).+?)/, + match: /"124px".+?disableGradients:(?<=(\i)\.getGuildId\(\).+?)/, replace: (m, channel) => `${m}$self.isHiddenChannel(${channel})||` }, { // Disable strange styles applied to the header for the HiddenChannelLockScreen of stage channels - match: /Guild voice channel without guild id.+?style:(?<=(\i)\.getGuildId\(\).+?)/, - replace: (m, channel) => `${m}$self.isHiddenChannel(${channel})?undefined:` + match: /"124px".+?style:(?<=(\i)\.getGuildId\(\).+?)/, + replace: (m, channel) => `${m}$self.isHiddenChannel(${channel})?void 0:` }, { // Remove the divider and amount of users in stage channel components for the HiddenChannelLockScreen @@ -376,7 +371,7 @@ export default definePlugin({ }, { // Remove the open chat button for the HiddenChannelLockScreen - match: /"recents".+?null,(?=.+?channelId:(\i)\.id,showRequestToSpeakSidebar)/, + match: /"recents".+?&&(?=\(.+?channelId:(\i)\.id,showRequestToSpeakSidebar)/, replace: (m, channel) => `${m}!$self.isHiddenChannel(${channel})&&` } ],