aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNuckyz <61953774+Nuckyz@users.noreply.github.com>2023-03-05 18:49:59 -0300
committerGitHub <noreply@github.com>2023-03-05 22:49:59 +0100
commitbed5e98bb03a2c7073f9f421a396fa7616d56ac5 (patch)
treedd862f2649c4a59f9242ab5c73d57221c52c61ec
parenta5392e5c53675e5206a4d5fcf97b9d6a8d07727b (diff)
downloadVencord-bed5e98bb03a2c7073f9f421a396fa7616d56ac5.tar.gz
Vencord-bed5e98bb03a2c7073f9f421a396fa7616d56ac5.tar.bz2
Vencord-bed5e98bb03a2c7073f9f421a396fa7616d56ac5.zip
Misc fixes and improvements (#555)
Co-authored-by: Ven <vendicated@riseup.net>
-rw-r--r--src/plugins/fakeNitro.ts6
-rw-r--r--src/plugins/noScreensharePreview.ts6
-rw-r--r--src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx18
-rw-r--r--src/plugins/showHiddenChannels/index.tsx13
-rw-r--r--src/plugins/typingTweaks.tsx2
-rw-r--r--src/plugins/webhookTags.ts4
6 files changed, 31 insertions, 18 deletions
diff --git a/src/plugins/fakeNitro.ts b/src/plugins/fakeNitro.ts
index 22ffb80..a09a95a 100644
--- a/src/plugins/fakeNitro.ts
+++ b/src/plugins/fakeNitro.ts
@@ -87,11 +87,11 @@ export default definePlugin({
},
{
match: /(?<=\.(?:canUseEmojisEverywhere|canUseAnimatedEmojis)\(\i)(?=\))/g,
- replace: ",fakeNitroIntention"
+ replace: ',typeof fakeNitroIntention!=="undefined"?fakeNitroIntention:void 0'
},
{
match: /(?<=&&!\i&&)!(?<canUseExternal>\i)(?=\)return \i\.\i\.DISALLOW_EXTERNAL;)/,
- replace: `(!$<canUseExternal>&&![${EmojiIntentions.CHAT},${EmojiIntentions.GUILD_STICKER_RELATED_EMOJI}].includes(fakeNitroIntention))`
+ replace: `(!$<canUseExternal>&&(typeof fakeNitroIntention==="undefined"||![${EmojiIntentions.CHAT},${EmojiIntentions.GUILD_STICKER_RELATED_EMOJI}].includes(fakeNitroIntention)))`
}
]
},
@@ -100,7 +100,7 @@ export default definePlugin({
predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true,
replacement: {
match: /(?<=(?:canUseEmojisEverywhere|canUseAnimatedEmojis):function\((?<user>\i))\){(?<premiumCheck>.+?\))/g,
- replace: `,fakeNitroIntention){$<premiumCheck>||fakeNitroIntention===undefined||[${EmojiIntentions.CHAT},${EmojiIntentions.GUILD_STICKER_RELATED_EMOJI}].includes(fakeNitroIntention)`
+ replace: `,fakeNitroIntention){$<premiumCheck>||fakeNitroIntention==null||[${EmojiIntentions.CHAT},${EmojiIntentions.GUILD_STICKER_RELATED_EMOJI}].includes(fakeNitroIntention)`
}
},
{
diff --git a/src/plugins/noScreensharePreview.ts b/src/plugins/noScreensharePreview.ts
index 5641ea3..b09f206 100644
--- a/src/plugins/noScreensharePreview.ts
+++ b/src/plugins/noScreensharePreview.ts
@@ -27,10 +27,10 @@ export default definePlugin({
{
find: '("ApplicationStreamPreviewUploadManager")',
replacement: [
- ".\\.default\\.makeChunkedRequest\\(",
- ".{1,2}\\..\\.post\\({url:"
+ "\\i\\.default\\.makeChunkedRequest\\(",
+ "\\i\\.\\i\\.post\\({url:"
].map(match => ({
- match: new RegExp(`return\\[(?<code>\\d),${match}.\\..{1,3}\\.STREAM_PREVIEW.+?}\\)\\];`),
+ match: new RegExp(`return\\[(?<code>\\d),${match}\\i\\.\\i\\.STREAM_PREVIEW.+?}\\)\\];`),
replace: 'return[$<code>,Promise.resolve({body:"",status:204})];'
}))
},
diff --git a/src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx b/src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx
index 7e66a6a..01bc3a7 100644
--- a/src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx
+++ b/src/plugins/showHiddenChannels/components/HiddenChannelLockScreen.tsx
@@ -19,9 +19,11 @@
import ErrorBoundary from "@components/ErrorBoundary";
import { LazyComponent } from "@utils/misc";
import { formatDuration } from "@utils/text";
-import { find, findByCode, findByPropsLazy } from "@webpack";
+import { find, findByPropsLazy } from "@webpack";
import { FluxDispatcher, GuildMemberStore, GuildStore, moment, Parser, SnowflakeUtils, Text, Timestamp, Tooltip } from "@webpack/common";
import { Channel } from "discord-types/general";
+import type { ComponentType } from "react";
+
enum SortOrderTypes {
LATEST_ACTIVITY = 0,
@@ -73,6 +75,17 @@ enum ChannelFlags {
REQUIRE_TAG = 1 << 4
}
+let EmojiComponent: ComponentType<any>;
+let ChannelBeginHeader: ComponentType<any>;
+
+export function setEmojiComponent(component: ComponentType<any>) {
+ EmojiComponent = component;
+}
+
+export function setChannelBeginHeaderComponent(component: ComponentType<any>) {
+ ChannelBeginHeader = component;
+}
+
const ChatScrollClasses = findByPropsLazy("auto", "content", "scrollerBase");
const TagComponent = LazyComponent(() => find(m => {
if (typeof m !== "function") return false;
@@ -81,9 +94,6 @@ const TagComponent = LazyComponent(() => find(m => {
// Get the component which doesn't include increasedActivity logic
return code.includes(".Messages.FORUM_TAG_A11Y_FILTER_BY_TAG") && !code.includes("increasedActivityPill");
}));
-const EmojiComponent = LazyComponent(() => findByCode('.jumboable?"jumbo":"default"'));
-// The component for the beggining of a channel, but we patched it so it only returns the allowed users and roles components for hidden channels
-const ChannelBeginHeader = LazyComponent(() => findByCode(".Messages.ROLE_REQUIRED_SINGLE_USER_MESSAGE"));
const ChannelTypesToChannelNames = {
[ChannelTypes.GUILD_TEXT]: "text",
diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx
index fe14fe6..60e0c51 100644
--- a/src/plugins/showHiddenChannels/index.tsx
+++ b/src/plugins/showHiddenChannels/index.tsx
@@ -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;
diff --git a/src/plugins/typingTweaks.tsx b/src/plugins/typingTweaks.tsx
index c3f8f87..3eb4fad 100644
--- a/src/plugins/typingTweaks.tsx
+++ b/src/plugins/typingTweaks.tsx
@@ -70,7 +70,7 @@ export default definePlugin({
{
find: "getCooldownTextStyle",
replacement: {
- match: /return \i\.Z\.getName\(.,.\.props\.channel\.id,(.)\)/,
+ match: /return \i\.\i\.getName\(.,.\.props\.channel\.id,(.)\)/,
replace: "return $1"
}
},
diff --git a/src/plugins/webhookTags.ts b/src/plugins/webhookTags.ts
index 51d68fa..96cbf38 100644
--- a/src/plugins/webhookTags.ts
+++ b/src/plugins/webhookTags.ts
@@ -42,9 +42,9 @@ export default definePlugin({
{
find: ".Types.ORIGINAL_POSTER",
replacement: {
- match: /return null==(.)\?null:\(0,.{1,3}\.jsxs?\)\((.{1,3})\.Z/,
+ match: /return null==(.)\?null:\(0,.{1,3}\.jsxs?\)\((.{1,3}\.\i)/,
replace: (orig, type, BotTag) =>
- `if(arguments[0].message.webhookId&&arguments[0].user.isNonUserBot()){${type}=${BotTag}.Z.Types.WEBHOOK}${orig}`,
+ `if(arguments[0].message.webhookId&&arguments[0].user.isNonUserBot()){${type}=${BotTag}.Types.WEBHOOK}${orig}`,
},
},
],