CustomUserColors: Remove Ignore

This commit is contained in:
thororen1234 2025-02-14 02:46:00 -05:00
parent 7ca3bbb8e6
commit d7d9e7dca1
No known key found for this signature in database
9 changed files with 59 additions and 72 deletions

View file

@ -24,9 +24,6 @@ const ColorPicker = findComponentByCodeLazy<ColorPickerProps>("#{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 (
<ModalRoot {...modalProps}>
<ModalHeader className={cl("modal-header")}>
<Forms.FormTitle tag="h2">
Custom Color
<ModalHeader className={cl("modal-header")}>
<Forms.FormTitle tag="h2">
Custom Color
</Forms.FormTitle>
<ModalCloseButton onClick={modalProps.onClose} />
</ModalHeader>
<ModalContent className={cl("modal-content")} onKeyDown={handleKey}>
<section className={Margins.bottom16}>
<Forms.FormTitle tag="h3">
Pick a color
</Forms.FormTitle>
<ModalCloseButton onClick={modalProps.onClose} />
</ModalHeader>
<ModalContent className={cl("modal-content")} onKeyDown={handleKey}>
<section className={Margins.bottom16}>
<Forms.FormTitle tag="h3">
Pick a color
</Forms.FormTitle>
<ColorPicker
color={colorPickerColor}
onChange={setUserColor}
showEyeDropper={false}
/>
</section>
</ModalContent>
<ColorPicker
color={colorPickerColor}
onChange={setUserColor}
showEyeDropper={false}
/>
</section>
</ModalContent>
<ModalFooter className={cl("modal-footer")}>
<Button
color={Button.Colors.RED}
onClick={deleteUserColor}
>
Delete Entry
</Button>
<Button
color={Button.Colors.BRAND}
onClick={saveUserColor}
>
Save
</Button>
</ModalFooter>
<ModalFooter className={cl("modal-footer")}>
<Button
color={Button.Colors.RED}
onClick={deleteUserColor}
>
Delete Entry
</Button>
<Button
color={Button.Colors.BRAND}
onClick={saveUserColor}
>
Save
</Button>
</ModalFooter>
</ModalRoot>
);
}

View file

@ -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<string, string> = {};
(async () => {
colors = await get<Record<string, string>>(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 {

View file

@ -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<string, string>);

View file

@ -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<string, string>);
type ExtUpload = Upload & { fixExtension?: boolean; };

View file

@ -797,5 +797,5 @@ export default definePlugin({
},
startAt: StartAt.DOMContentLoaded,
// preview thing, kinda low effort but eh
settingsAboutComponent: () => <img src="https://cdn.nest.rip/uploads/97fdf6c1-764c-4445-9422-d3d52af7434c.webp" style={{ width: "568px", borderRadius: "30px" }} ></img>
settingsAboutComponent: () => <img src="https://cdn.nest.rip/uploads/97fdf6c1-764c-4445-9422-d3d52af7434c.webp" style={{ width: "568px", borderRadius: "30px" }} alt=""></img>
});

View file

@ -275,7 +275,7 @@ function SubmitThemes() {
color: "var(--text-normal)"
}}>
<p> This tab was replaced in favour of the new website: </p>
<p><a href="https://discord-themes.com" target="_blank">discord-themes.com</a></p>
<p><a href="https://discord-themes.com" target="_blank" rel="noreferrer">discord-themes.com</a></p>
<p style={{
fontSize: ".75em",
color: "var(--text-muted)"

View file

@ -19,12 +19,11 @@
import { Upload } from "@api/MessageEvents";
import { definePluginSettings, Settings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { reverseExtensionMap } from "@equicordplugins/fixFileExtensions";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { findByCodeLazy, findByPropsLazy } from "@webpack";
import { reverseExtensionMap } from "../../equicordplugins/fixFileExtensions/components";
type AnonUpload = Upload & { anonymise?: boolean; };
const ActionBarIcon = findByCodeLazy(".actionBarIcon)");

View file

@ -19,12 +19,12 @@
import { definePluginSettings, Settings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { makeRange } from "@components/PluginSettings/components";
import { getCustomColorString } from "@equicordplugins/customUserColors";
import { Devs } from "@utils/constants";
import { Logger } from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types";
import { findByCodeLazy } from "@webpack";
import { ChannelStore, GuildMemberStore, GuildStore } from "@webpack/common";
import { getCustomColorString } from "@equicordplugins/customUserColors";
const useMessageAuthor = findByCodeLazy('"Result cannot be null because the message is not null"');

View file

@ -18,12 +18,12 @@
import { definePluginSettings, Settings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { getCustomColorString } from "@equicordplugins/customUserColors";
import { Devs } from "@utils/constants";
import { openUserProfile } from "@utils/discord";
import definePlugin, { OptionType } from "@utils/types";
import { Avatar, GuildMemberStore, React, RelationshipStore } from "@webpack/common";
import { User } from "discord-types/general";
import { getCustomColorString } from "@equicordplugins/customUserColors";
import { PropsWithChildren } from "react";
const settings = definePluginSettings({
@ -58,7 +58,7 @@ interface Props {
guildId: string;
}
function TypingUserColor(guildId: string, userId: string) {
function typingUserColor(guildId: string, userId: string) {
if (!settings.store.showRoleColors) return;
if (Settings.plugins.customUserColors.enabled) return getCustomColorString(userId, true);
return GuildMemberStore.getMember(guildId, userId)?.colorString;