From 9a0acbd72dfa2d00080e460f46f29643a0097ba1 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 25 Jul 2024 19:36:45 -0400 Subject: [PATCH 1/3] Possible Fix For Theme Reset --- src/plugins/fakeNitro/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index 5f7429d0..de07ce0d 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -442,7 +442,7 @@ export default definePlugin({ if (proto == null || typeof proto === "string") return; // @ts-ignore - const premiumType: number = user?._realPremiumType ?? UserStore?.getCurrentUser?._realPremiumType ?? user?.premium_type ?? UserStore?.getCurrentUser()?.premiumType ?? 0; + const premiumType: number = user?._realPremiumType ?? user?.premium_type ?? UserStore?.getCurrentUser()?.premiumType ?? 0; if (premiumType !== 2) { proto.appearance ??= AppearanceSettingsActionCreators.create(); From cdba643226ac7964f08fdf10ee0c18fcca46c36b Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 25 Jul 2024 20:37:31 -0400 Subject: [PATCH 2/3] Fix Broken Patch + Remove @ From MentionAvatars --- src/plugins/mentionAvatars/index.tsx | 25 ++++++++++++++++++------ src/plugins/showHiddenChannels/index.tsx | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/plugins/mentionAvatars/index.tsx b/src/plugins/mentionAvatars/index.tsx index 54969314..7454e367 100644 --- a/src/plugins/mentionAvatars/index.tsx +++ b/src/plugins/mentionAvatars/index.tsx @@ -6,17 +6,25 @@ import "./styles.css"; +import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; +import definePlugin, { OptionType } from "@utils/types"; import { SelectedGuildStore, useState } from "@webpack/common"; import { User } from "discord-types/general"; +export const settings = definePluginSettings({ + hideAtSymbol: { + type: OptionType.BOOLEAN, + description: "Whether the the @-symbol should be hidden.", + default: true + } +}); + export default definePlugin({ name: "MentionAvatars", description: "Shows user avatars inside mentions", - authors: [Devs.Ven], - + authors: [Devs.Ven, Devs.Luna], patches: [{ find: ".USER_MENTION)", replacement: { @@ -24,12 +32,12 @@ export default definePlugin({ replace: "children:$self.renderUsername({username:$1,user:$2})" } }], - + settings, renderUsername: ErrorBoundary.wrap((props: { user: User, username: string; }) => { const { user, username } = props; const [isHovering, setIsHovering] = useState(false); - if (!user) return <>@{username}; + if (!user) return <>{getUsernameString(username)}; return ( setIsHovering(false)} > - @{username} + {getUsernameString(username)} ); }, { noop: true }) }); + +function getUsernameString(username: string) { + if (settings.store.hideAtSymbol) return username; + return `@${username}`; +} diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index 2d8b0c19..68778915 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -307,7 +307,7 @@ export default definePlugin({ ] }, { - find: '+1]})},"overflow"))', + find: '})},"overflow"))', replacement: [ { // Create a variable for the channel prop From 1905ea04fb1561e6447336d0a37bc6873ccc3e28 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 25 Jul 2024 21:54:59 -0400 Subject: [PATCH 3/3] loadlazychunks without dev --- .../commandPalette/commands.tsx | 36 +++++++++---------- src/equicordplugins/commandPalette/index.tsx | 14 ++++---- src/plugins/consoleShortcuts/index.ts | 2 +- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/equicordplugins/commandPalette/commands.tsx b/src/equicordplugins/commandPalette/commands.tsx index 23a97b65..3b78ec12 100644 --- a/src/equicordplugins/commandPalette/commands.tsx +++ b/src/equicordplugins/commandPalette/commands.tsx @@ -25,16 +25,16 @@ export interface ButtonAction { } export const actions: ButtonAction[] = [ - { id: "openSuncordSettings", label: "Open Suncord tab", callback: async () => await SettingsRouter.open("SuncordSettings"), registrar: "Suncord" }, - { id: "openPluginSettings", label: "Open Plugin tab", callback: () => SettingsRouter.open("SuncordPlugins"), registrar: "Suncord" }, - { id: "openThemesSettings", label: "Open Themes tab", callback: () => SettingsRouter.open("SuncordThemes"), registrar: "Suncord" }, - { id: "openUpdaterSettings", label: "Open Updater tab", callback: () => SettingsRouter.open("SuncordUpdater"), registrar: "Suncord" }, - { id: "openSuncordCloudSettings", label: "Open Cloud tab", callback: () => SettingsRouter.open("SuncordCloud"), registrar: "Suncord" }, - { id: "openBackupSettings", label: "Open Backup & Restore tab", callback: () => SettingsRouter.open("SuncordSettingsSync"), registrar: "Suncord" }, - { id: "restartClient", label: "Restart Client", callback: () => relaunch(), registrar: "Suncord" }, - { id: "openQuickCSSFile", label: "Open Quick CSS File", callback: () => VencordNative.quickCss.openEditor(), registrar: "Suncord" }, - { id: "openSettingsFolder", label: "Open Settings Folder", callback: async () => showItemInFolder(await VencordNative.settings.getSettingsDir()), registrar: "Suncord" }, - { id: "openInGithub", label: "Open in Github", callback: async () => VencordNative.native.openExternal(await getRepo()), registrar: "Suncord" }, + { id: "openEquicordSettings", label: "Open Equicord tab", callback: async () => await SettingsRouter.open("EquicordSettings"), registrar: "Equicord" }, + { id: "openPluginSettings", label: "Open Plugin tab", callback: () => SettingsRouter.open("EquicordPlugins"), registrar: "Equicord" }, + { id: "openThemesSettings", label: "Open Themes tab", callback: () => SettingsRouter.open("EquicordThemes"), registrar: "Equicord" }, + { id: "openUpdaterSettings", label: "Open Updater tab", callback: () => SettingsRouter.open("EquicordUpdater"), registrar: "Equicord" }, + { id: "openEquicordCloudSettings", label: "Open Cloud tab", callback: () => SettingsRouter.open("EquicordCloud"), registrar: "Equicord" }, + { id: "openBackupSettings", label: "Open Backup & Restore tab", callback: () => SettingsRouter.open("EquicordSettingsSync"), registrar: "Equicord" }, + { id: "restartClient", label: "Restart Client", callback: () => relaunch(), registrar: "Equicord" }, + { id: "openQuickCSSFile", label: "Open Quick CSS File", callback: () => VencordNative.quickCss.openEditor(), registrar: "Equicord" }, + { id: "openSettingsFolder", label: "Open Settings Folder", callback: async () => showItemInFolder(await VencordNative.settings.getSettingsDir()), registrar: "Equicord" }, + { id: "openInGithub", label: "Open in Github", callback: async () => VencordNative.native.openExternal(await getRepo()), registrar: "Equicord" }, { id: "openInBrowser", label: "Open in Browser", callback: async () => { @@ -54,7 +54,7 @@ export const actions: ButtonAction[] = [ } }); } - }, registrar: "Suncord" + }, registrar: "Equicord" }, { @@ -79,7 +79,7 @@ export const actions: ButtonAction[] = [ if (choice && enabled) { return togglePlugin(choice, enabled.id === "enable"); } - }, registrar: "Suncord" + }, registrar: "Equicord" }, { @@ -110,7 +110,7 @@ export const actions: ButtonAction[] = [ } }); } - }, registrar: "Suncord" + }, registrar: "Equicord" }, { @@ -125,7 +125,7 @@ export const actions: ButtonAction[] = [ position: Toasts.Position.BOTTOM } }); - }, registrar: "Suncord" + }, registrar: "Equicord" }, { @@ -134,12 +134,12 @@ export const actions: ButtonAction[] = [ if (isOutdated) { setTimeout(() => showNotification({ - title: "A Suncord update is available!", + title: "A Equicord update is available!", body: "Click here to view the update", permanent: true, noPersist: true, onClick() { - SettingsRouter.open("SuncordUpdater"); + SettingsRouter.open("EquicordUpdater"); } }), 10_000); } else { @@ -152,7 +152,7 @@ export const actions: ButtonAction[] = [ } }); } - }, registrar: "Suncord" + }, registrar: "Equicord" }, { @@ -172,7 +172,7 @@ export const actions: ButtonAction[] = [ if (choice) { NavigationRouter.transitionToGuild(choice.id); } - }, registrar: "Suncord" + }, registrar: "Equicord" } ]; diff --git a/src/equicordplugins/commandPalette/index.tsx b/src/equicordplugins/commandPalette/index.tsx index be8d622d..c9bc5ff5 100644 --- a/src/equicordplugins/commandPalette/index.tsx +++ b/src/equicordplugins/commandPalette/index.tsx @@ -94,14 +94,12 @@ export default definePlugin({ start() { document.addEventListener("keydown", this.event); - if (IS_DEV) { - registerAction({ - id: "openDevSettings", - label: "Open Dev tab", - callback: () => SettingsRouter.open("SuncordPatchHelper"), - registrar: "Suncord" - }); - } + registerAction({ + id: "openDevSettings", + label: "Open Dev tab", + callback: () => SettingsRouter.open("EquicordPatchHelper"), + registrar: "Equicord" + }); }, stop() { diff --git a/src/plugins/consoleShortcuts/index.ts b/src/plugins/consoleShortcuts/index.ts index 2fdf8735..14eed6d3 100644 --- a/src/plugins/consoleShortcuts/index.ts +++ b/src/plugins/consoleShortcuts/index.ts @@ -83,7 +83,7 @@ function makeShortcuts() { wpsearch: search, wpex: extract, wpexs: (code: string) => extract(findModuleId(code)!), - loadLazyChunks: IS_DEV ? loadLazyChunks : () => { throw new Error("loadLazyChunks is dev only."); }, + loadLazyChunks: loadLazyChunks, find, findAll: findAll, findByProps,