From d7d9e7dca16965069045c3c4999d8607c69258b4 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Fri, 14 Feb 2025 02:46:00 -0500 Subject: [PATCH] CustomUserColors: Remove Ignore --- .../customUserColors/SetColorModal.tsx | 65 +++++++++---------- .../customUserColors/index.tsx | 20 +++--- .../fixFileExtensions/components.tsx | 19 ------ .../fixFileExtensions/index.tsx | 14 +++- src/equicordplugins/glide/index.tsx | 2 +- .../themeLibrary/components/ThemeTab.tsx | 2 +- src/plugins/anonymiseFileNames/index.tsx | 3 +- src/plugins/roleColorEverywhere/index.tsx | 2 +- src/plugins/typingTweaks/index.tsx | 4 +- 9 files changed, 59 insertions(+), 72 deletions(-) delete mode 100644 src/equicordplugins/fixFileExtensions/components.tsx diff --git a/src/equicordplugins/customUserColors/SetColorModal.tsx b/src/equicordplugins/customUserColors/SetColorModal.tsx index ba8919f9..bdb36d6a 100644 --- a/src/equicordplugins/customUserColors/SetColorModal.tsx +++ b/src/equicordplugins/customUserColors/SetColorModal.tsx @@ -24,9 +24,6 @@ const ColorPicker = findComponentByCodeLazy("#{intl::USER_SETT const cl = classNameFactory("vc-customColors-"); export function SetColorModal({ userId, modalProps }: { userId: string, modalProps: ModalProps; }) { - - const userColor = colors[userId]; - const initialColor = parseInt(colors[userId], 16) || 372735; // color picker default to current color set for user (if null it's 0x05afff :3 ) @@ -57,39 +54,39 @@ export function SetColorModal({ userId, modalProps }: { userId: string, modalPro return ( - - - Custom Color + + + Custom Color + + + + +
+ + Pick a color - - - -
- - Pick a color - - -
-
+ +
+
- - - - + + + +
); } diff --git a/src/equicordplugins/customUserColors/index.tsx b/src/equicordplugins/customUserColors/index.tsx index b204350d..e99d1e5a 100644 --- a/src/equicordplugins/customUserColors/index.tsx +++ b/src/equicordplugins/customUserColors/index.tsx @@ -13,19 +13,21 @@ import { EquicordDevs } from "@utils/constants"; import { openModal } from "@utils/modal"; import definePlugin, { OptionType } from "@utils/types"; import { extractAndLoadChunksLazy } from "@webpack"; -import { Menu, UserStore } from "@webpack/common"; +import { Menu } from "@webpack/common"; import { User } from "discord-types/general"; import { SetColorModal } from "./SetColorModal"; export const DATASTORE_KEY = "equicord-customcolors"; export let colors: Record = {}; + (async () => { colors = await get>(DATASTORE_KEY) || {}; })(); -const requireSettingsMenu = extractAndLoadChunksLazy(['name:"UserSettings"'], /createPromise:.{0,20}(\i\.\i\("?.+?"?\).*?).then\(\i\.bind\(\i,"?(.+?)"?\)\).{0,50}"UserSettings"/); // needed for color picker to be available without opening settings (ty pindms!!) +const requireSettingsMenu = extractAndLoadChunksLazy(['name:"UserSettings"'], /createPromise:.{0,20}(\i\.\i\("?.+?"?\).*?).then\(\i\.bind\(\i,"?(.+?)"?\)\).{0,50}"UserSettings"/); + const userContextMenuPatch: NavContextMenuPatchCallback = (children, { user }: { user: User; }) => { if (user?.id == null) return; @@ -96,15 +98,11 @@ export default definePlugin({ ], colorDMList(a: any): string | undefined { - try { - // @ts-ignore - const { id } = UserStore.findByTag(a.avatar.props["aria-label"]); - // get user id by props on avatars having username as aria label - const colorString = getCustomColorString(id, true); - if (colorString) - return colorString; - return "inherit"; - } catch { return; } // if you have a group in your dms then discord will crash on load without this + const userId = a?.subText?.props?.user?.id; + if (!userId) return; + const colorString = getCustomColorString(userId, true); + if (colorString) return colorString; + return "inherit"; }, colorIfServer(a: any): string | undefined { diff --git a/src/equicordplugins/fixFileExtensions/components.tsx b/src/equicordplugins/fixFileExtensions/components.tsx deleted file mode 100644 index 3c9322f2..00000000 --- a/src/equicordplugins/fixFileExtensions/components.tsx +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -const extensionMap = { - "ogg": [".ogv", ".oga", ".ogx", ".ogm", ".spx", ".opus"], - "jpg": [".jpg", ".jpeg", ".jfif", ".jpe", ".jif", ".jfi", ".pjpeg", ".pjp"], - "svg": [".svgz"], - "mp4": [".m4v", ".m4r", ".m4p"], - "m4a": [".m4b"], - "mov": [".movie", ".qt"], -}; - -export const reverseExtensionMap = Object.entries(extensionMap).reduce((acc, [target, exts]) => { - exts.forEach(ext => acc[ext] = `.${target}`); - return acc; -}, {} as Record); diff --git a/src/equicordplugins/fixFileExtensions/index.tsx b/src/equicordplugins/fixFileExtensions/index.tsx index 7e1b646a..18df49d4 100644 --- a/src/equicordplugins/fixFileExtensions/index.tsx +++ b/src/equicordplugins/fixFileExtensions/index.tsx @@ -9,7 +9,19 @@ import { Settings } from "@api/Settings"; import { EquicordDevs } from "@utils/constants"; import definePlugin, { ReporterTestable } from "@utils/types"; -import { reverseExtensionMap } from "./components"; +const extensionMap = { + "ogg": [".ogv", ".oga", ".ogx", ".ogm", ".spx", ".opus"], + "jpg": [".jpg", ".jpeg", ".jfif", ".jpe", ".jif", ".jfi", ".pjpeg", ".pjp"], + "svg": [".svgz"], + "mp4": [".m4v", ".m4r", ".m4p"], + "m4a": [".m4b"], + "mov": [".movie", ".qt"], +}; + +export const reverseExtensionMap = Object.entries(extensionMap).reduce((acc, [target, exts]) => { + exts.forEach(ext => acc[ext] = `.${target}`); + return acc; +}, {} as Record); type ExtUpload = Upload & { fixExtension?: boolean; }; diff --git a/src/equicordplugins/glide/index.tsx b/src/equicordplugins/glide/index.tsx index f195800b..5547133a 100644 --- a/src/equicordplugins/glide/index.tsx +++ b/src/equicordplugins/glide/index.tsx @@ -797,5 +797,5 @@ export default definePlugin({ }, startAt: StartAt.DOMContentLoaded, // preview thing, kinda low effort but eh - settingsAboutComponent: () => + settingsAboutComponent: () => }); diff --git a/src/equicordplugins/themeLibrary/components/ThemeTab.tsx b/src/equicordplugins/themeLibrary/components/ThemeTab.tsx index 5d8c95a9..4a98b920 100644 --- a/src/equicordplugins/themeLibrary/components/ThemeTab.tsx +++ b/src/equicordplugins/themeLibrary/components/ThemeTab.tsx @@ -275,7 +275,7 @@ function SubmitThemes() { color: "var(--text-normal)" }}>

This tab was replaced in favour of the new website:

-

discord-themes.com

+

discord-themes.com