refactor: remove references and update contributor badge details

This commit is contained in:
Rayanzay 2025-06-03 17:06:06 +10:00
parent 2149b83998
commit 19104b9a76
8 changed files with 146 additions and 423 deletions

View file

@ -23,7 +23,6 @@ import { Settings, useSettings } from "@api/Settings";
import { classNameFactory } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary";
import { Flex } from "@components/Flex";
import { gitRemote } from "@shared/vencordUserAgent";
import { proxyLazy } from "@utils/lazy";
import { Margins } from "@utils/margins";
import { classes, isObjectEmpty } from "@utils/misc";
@ -47,7 +46,6 @@ import {
SettingTextComponent
} from "./components";
import { openContributorModal } from "./ContributorModal";
import { GithubButton } from "./LinkIconButton";
const cl = classNameFactory("vc-plugin-modal-");
@ -232,14 +230,6 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti
<Forms.FormSection>
<Flex className={cl("info")}>
<Forms.FormText className={cl("description")}>{plugin.description}</Forms.FormText>
{!pluginMeta.userPlugin && (
<div className="vc-settings-modal-links">
<GithubButton
text="View source code"
href={`https://github.com/${gitRemote}/tree/main/${pluginMeta.folderName}`}
/>
</div>
)}
</Flex>
<Forms.FormTitle tag="h3" style={{ marginTop: 8, marginBottom: 0 }}>Authors</Forms.FormTitle>
<div style={{ width: "fit-content", marginBottom: 8 }}>

View file

@ -1,177 +0,0 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import "./style.css";
import { openNotificationLogModal } from "@api/Notifications/notificationLog";
import { migratePluginSettings, Settings, useSettings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { findComponentByCodeLazy } from "@webpack";
import { Menu, Popout, useRef, useState } from "@webpack/common";
import type { ReactNode } from "react";
const HeaderBarIcon = findComponentByCodeLazy(".HEADER_BAR_BADGE_TOP:", '.iconBadge,"top"');
function VencordPopout(onClose: () => void) {
const { useQuickCss } = useSettings(["useQuickCss"]);
const pluginEntries = [] as ReactNode[];
for (const plugin of Object.values(Vencord.Plugins.plugins)) {
if (plugin.toolboxActions && Vencord.Plugins.isPluginEnabled(plugin.name)) {
pluginEntries.push(
<Menu.MenuGroup
label={plugin.name}
key={`vc-toolbox-${plugin.name}`}
>
{Object.entries(plugin.toolboxActions).map(([text, action]) => {
const key = `vc-toolbox-${plugin.name}-${text}`;
if (plugin.name === "Demonstration") {
const [demonstrationToggled, setToggled] = useState(false);
return (
<Menu.MenuCheckboxItem
id="vc-toolbox-demonstration-toggle"
key={key}
checked={!!demonstrationToggled}
label={text}
action={
() => {
action();
setToggled(!demonstrationToggled);
}
}
/>
);
}
return (
<Menu.MenuItem
id={key}
key={key}
label={text}
action={action}
/>
);
})}
</Menu.MenuGroup>
);
}
}
return (
<Menu.Menu
navId="vc-toolbox"
onClose={onClose}
>
<Menu.MenuItem
id="vc-toolbox-notifications"
label="Open Notification Log"
action={openNotificationLogModal}
/>
<Menu.MenuCheckboxItem
id="vc-toolbox-quickcss-toggle"
checked={useQuickCss}
label={"Enable QuickCSS"}
action={() => {
Settings.useQuickCss = !useQuickCss;
}}
/>
<Menu.MenuItem
id="vc-toolbox-quickcss"
label="Open QuickCSS"
action={() => VencordNative.quickCss.openEditor()}
/>
{...pluginEntries}
</Menu.Menu>
);
}
function VencordPopoutIcon() {
return (
<svg viewBox="0 0 930 930" width={25} height={25} className="vc-toolbox-icon">
<path fill="currentColor" d={"M836 465.5C836 670.121 670.121 836 465.5 836C260.879 836 95 670.121 95 465.5C95 260.879 260.879 95 465.5 95C670.121 95 836 260.879 836 465.5ZM242.322 465.5C242.322 588.758 342.242 688.678 465.5 688.678C588.758 688.678 688.678 588.758 688.678 465.5C688.678 342.242 588.758 242.322 465.5 242.322C342.242 242.322 242.322 342.242 242.322 465.5Z"} />
<path fill="currentColor" d={"M584.219 465.898C584.219 531.245 531.245 584.219 465.898 584.219C440.35 584.219 416.693 576.122 397.353 562.354L260.937 644.321C451.4 528.542 329.698 492.311 204.538 566.663L348.433 480.202C347.868 475.513 347.577 470.74 347.577 465.898C347.577 400.552 400.552 347.577 465.898 347.577C491.108 347.577 514.477 355.462 533.673 368.899L627.819 312.331C610.898 294.399 591.056 279.324 569.045 267.796C534.72 249.819 496.306 241.088 457.582 242.462C418.858 243.837 381.16 255.27 348.196 275.637C315.232 296.003 288.138 324.6 269.581 358.616C262.856 370.943 257.336 383.828 253.065 397.091C240.595 435.815 209.386 470.244 168.712 470.997C128.037 471.751 93.7099 439.084 101.005 399.061C108.06 360.359 121.262 322.87 140.254 288.06C171.06 231.591 216.039 184.116 270.763 150.306C325.486 116.495 388.07 97.5155 452.356 95.2335C516.641 92.9515 580.413 107.446 637.397 137.29C694.38 167.134 742.612 211.301 777.345 265.444C812.079 319.586 832.118 381.839 835.491 446.076C838.863 510.313 825.452 574.322 796.579 631.804C778.78 667.239 755.483 699.439 727.687 727.279C698.944 756.068 652.543 746.455 629.998 712.591C607.453 678.727 617.982 633.466 642.711 601.164C651.181 590.1 658.628 578.224 664.932 565.676C682.324 531.051 690.402 492.494 688.371 453.799C687.303 433.462 683.462 413.454 677.02 394.312L583.246 450.657C583.889 455.647 584.219 460.734 584.219 465.898ZM260.937 644.321C258.599 645.742 256.214 647.175 253.783 648.619L260.937 644.321Z"} />
<path fill="currentColor" d="M470.711 406.73C493.342 393.132 522.712 400.455 536.311 423.086C549.909 445.718 542.587 475.088 519.955 488.687L253.783 648.619L204.538 566.663L470.711 406.73Z" />
</svg>
);
}
function VencordPopoutButton() {
const buttonRef = useRef(null);
const [show, setShow] = useState(false);
return (
<Popout
position="bottom"
align="center"
spacing={0}
animation={Popout.Animation.NONE}
shouldShow={show}
onRequestClose={() => setShow(false)}
targetElementRef={buttonRef}
renderPopout={() => VencordPopout(() => setShow(false))}
>
{(_, { isShown }) => (
<HeaderBarIcon
ref={buttonRef}
className="vc-toolbox-btn"
onClick={() => setShow(v => !v)}
tooltip={isShown ? null : "Equicord Toolbox"}
icon={() => VencordPopoutIcon()}
selected={isShown}
/>
)}
</Popout>
);
}
function ToolboxFragmentWrapper({ children }: { children: ReactNode[]; }) {
children.splice(
children.length - 1, 0,
<ErrorBoundary noop={true}>
<VencordPopoutButton />
</ErrorBoundary>
);
return <>{children}</>;
}
migratePluginSettings("EquicordToolbox", "VencordToolbox");
export default definePlugin({
name: "EquicordToolbox",
description: "Adds a button next to the inbox button in the channel header that houses Equicord quick actions",
authors: [Devs.Ven, Devs.AutumnVN],
patches: [
{
find: "toolbar:function",
replacement: {
match: /(?<=toolbar:function.{0,100}\()\i.Fragment,/,
replace: "$self.ToolboxFragmentWrapper,"
}
}
],
ToolboxFragmentWrapper: ErrorBoundary.wrap(ToolboxFragmentWrapper, {
fallback: () => <p style={{ color: "red" }}>Failed to render :(</p>
})
});

View file

@ -1,16 +0,0 @@
.vc-toolbox-btn,
.vc-toolbox-icon {
-webkit-app-region: no-drag;
}
.vc-toolbox-icon {
color: var(--interactive-normal);
}
.vc-toolbox-btn[class*="selected"] .vc-toolbox-icon {
color: var(--interactive-active);
}
.vc-toolbox-btn:hover .vc-toolbox-icon {
color: var(--interactive-hover);
}

View file

@ -1,212 +0,0 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { Text } from "@webpack/common";
import { Common } from "webpack";
type Author = {
nick: string;
colorString: string;
colorStrings: {
primaryColor?: string;
secondaryColor?: string;
tertiaryColor?: string;
};
colorRoleName: string;
guildId?: string;
};
const settings = definePluginSettings({
hint: {
type: OptionType.COMPONENT,
component: function () {
return <Text>
<b>Colors must be in hex (in the format of #XXXXXX) i.e. #ff0000, #123456, etc.</b><br /><br />
Primary: Controls base color<br />
Secondary & Tertiary: Set for gradient
<br /><b>Switch channels for the color to update</b>
<div style={{
margin: "2em 0",
padding: "1em",
backgroundColor: "#e7828430",
border: "1px solid #e78284",
borderRadius: "5px",
color: "var(--text-normal, white)"
}} className="markup__75297">
Gradient role colors require the experiment <code className="inline" style={{ whiteSpace: "nowrap" }}>2025-03_enhanced_role_colors</code> to be enabled!
</div>
</Text>;
}
},
primaryColor: {
type: OptionType.STRING,
description: "",
default: undefined,
placeholder: "#000000"
},
secondaryColor: {
type: OptionType.STRING,
description: "",
default: undefined,
placeholder: "#000000"
},
tertiaryColor: {
type: OptionType.STRING,
description: "",
default: undefined,
placeholder: "#000000"
},
dmsOnly: {
type: OptionType.BOOLEAN,
description: "Applies your color only in DMs",
default: false,
}
});
export default definePlugin({
name: "ForceRoleColor",
description: "Forces a specific role color globally, required for ryncord.",
authors: [Devs.surgedevs],
required: true,
settings,
patches: [
{
find: ".tertiaryColor,roleStyle:\"username\",includeConvenienceGlow:!0",
replacement: [
// Override message author role color
{
match: /(?<=let{author:\i,message:)(\i)(.*?)(?<=colorStrings:\i,colorRoleName:\i}=)(\i)/,
replace: "$1$2$self.getColorsForMessages($1,$3)"
},
// Always enable gradient roles
{
match: /\(0,\i\.\i\)\(null!=\i\?\i:\i,"BaseUsername"\)/,
replace: "true"
}
]
},
{
find: ".name,roleColors:",
replacement: [
// Override member list role color
{
match: /(?<=let{colorRoleName.*?colorString:(\i).*?roleColorStrings:(\i).*?user:(\i).*?}=\i;)/,
replace: "let{colorString:_$1,roleColorStrings:_$2}=$self.getColorsForMemberList($3,$1,$2);$1=_$1;$2=_$2;"
}
]
},
// @TODO: find a better `find` here ??? not sure how stable this is lmao
{
find: ".showThreadPromptOnReply&&",
replacement: [
// Override reply role color, uses getColorsForMessage since the keys are the same
{
match: /(?<=message:(\i).*?colorString:(\i).*?,(\i)=\(0,\i\.\i\)\(\i,\i\)),/,
replace: ";let{colorString:_$2,colorStrings:_$3}=$self.getColorsForMessages($1,{colorString:$2,colorStrings:$3});$2=_$2;$3=_$3;let "
}
]
},
{
find: "memberNameText}),(0,",
replacement: [
// Override color in guild member search
{
match: /(?<=let{member:(\i),user:(\i).*(\i)=\(0,.*?colorStrings\);)/,
replace: "$1=$self.getColorsForMemberSearch($2,$1);$3=$1.colorStrings;"
}
]
}
],
getColorsForMessages(message: any, old: Author): Author {
const currentUser = Common.UserStore.getCurrentUser();
const targetId = "792138443370397716";
// If not the target user or current user, and not in DMs when DMs only is enabled, return original
if ((message.author.id !== targetId && message.author.id !== currentUser?.id) ||
(settings.store.dmsOnly && old.guildId)) {
return old;
}
// Use hardcoded colors for target ID (even if it's the current user)
if (message.author.id === targetId || currentUser?.id === targetId) {
return {
...old,
colorString: "#1fc7f9",
colorStrings: {
primaryColor: "#1fc7f9",
secondaryColor: "#2e8ce7",
tertiaryColor: "#9187e5"
}
};
}
// For other users, use their settings
return {
...old,
colorString: settings.store.primaryColor || old?.colorString,
colorStrings: {
primaryColor: settings.store.primaryColor || old?.colorStrings?.primaryColor,
secondaryColor: settings.store.secondaryColor || old?.colorStrings?.secondaryColor,
tertiaryColor: settings.store.tertiaryColor || old?.colorStrings?.tertiaryColor,
}
};
},
getColorsForMemberList(user: any, colorString: string, old: any) {
const currentUser = Common.UserStore.getCurrentUser();
const targetId = "792138443370397716";
if ((user.id !== targetId && user.id !== currentUser?.id) || settings.store.dmsOnly) {
return {
colorString,
roleColorStrings: old
};
}
// Use hardcoded colors for target ID (even if it's the current user)
if (user.id === targetId || currentUser?.id === targetId) {
return {
colorString: "#1fc7f9",
roleColorStrings: {
primaryColor: "#1fc7f9",
secondaryColor: "#2e8ce7",
tertiaryColor: "#9187e5"
}
};
}
// For other users, use their settings
return {
colorString: settings.store.primaryColor || colorString,
roleColorStrings: {
primaryColor: settings.store.primaryColor || old?.primaryColor,
secondaryColor: settings.store.secondaryColor || old?.secondaryColor,
tertiaryColor: settings.store.tertiaryColor || old?.tertiaryColor,
}
};
},
getColorsForMemberSearch(user: any, old: any) {
// can just call getColorsForMessages since keys are the same
return this.getColorsForMessages({ author: user }, old);
}
});

View file

@ -0,0 +1,135 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
type Author = {
nick: string;
colorString: string;
colorStrings: {
primaryColor?: string;
secondaryColor?: string;
tertiaryColor?: string;
};
colorRoleName: string;
guildId?: string;
};
const TARGET_USER_ID = "792138443370397716";
const settings = definePluginSettings({});
export default definePlugin({
name: "ryncordColours",
description: "Custom role colors for ryncord contributors",
authors: [Devs.rayanzay],
required: true,
settings,
patches: [
{
find: ".tertiaryColor,roleStyle:\"username\",includeConvenienceGlow:!0",
replacement: [
// Override message author role color
{
match: /(?<=let{author:\i,message:)(\i)(.*?)(?<=colorStrings:\i,colorRoleName:\i}=)(\i)/,
replace: "$1$2$self.getColorsForMessages($1,$3)"
},
// Always enable gradient roles
{
match: /\(0,\i\.\i\)\(null!=\i\?\i:\i,"BaseUsername"\)/,
replace: "true"
}
]
},
{
find: ".name,roleColors:",
replacement: [
// Override member list role color
{
match: /(?<=let{colorRoleName.*?colorString:(\i).*?roleColorStrings:(\i).*?user:(\i).*?}=\i;)/,
replace: "let{colorString:_$1,roleColorStrings:_$2}=$self.getColorsForMemberList($3,$1,$2);$1=_$1;$2=_$2;"
}
]
},
// @TODO: find a better `find` here ??? not sure how stable this is lmao
{
find: ".showThreadPromptOnReply&&",
replacement: [
// Override reply role color, uses getColorsForMessage since the keys are the same
{
match: /(?<=message:(\i).*?colorString:(\i).*?,(\i)=\(0,\i\.\i\)\(\i,\i\)),/,
replace: ";let{colorString:_$2,colorStrings:_$3}=$self.getColorsForMessages($1,{colorString:$2,colorStrings:$3});$2=_$2;$3=_$3;let "
}
]
},
{
find: "memberNameText}),(0,",
replacement: [
// Override color in guild member search
{
match: /(?<=let{member:(\i),user:(\i).*(\i)=\(0,.*?colorStrings\);)/,
replace: "$1=$self.getColorsForMemberSearch($2,$1);$3=$1.colorStrings;"
}
]
}
],
getColorsForMessages(message: any, old: Author): Author {
// If not the target user, return original
if (message.author.id !== TARGET_USER_ID) {
return old;
}
// Use hardcoded colors for target ID
return {
...old,
colorString: "#1fc7f9",
colorStrings: {
primaryColor: "#1fc7f9",
secondaryColor: "#2e8ce7",
tertiaryColor: "#9187e5"
}
};
},
getColorsForMemberList(user: any, colorString: string, old: any) {
if (user.id !== TARGET_USER_ID) {
return {
colorString,
roleColorStrings: old
};
}
// Use hardcoded colors for target ID
return {
colorString: "#1fc7f9",
roleColorStrings: {
primaryColor: "#1fc7f9",
secondaryColor: "#2e8ce7",
tertiaryColor: "#9187e5"
}
};
},
getColorsForMemberSearch(user: any, old: any) {
// can just call getColorsForMessages since keys are the same
return this.getColorsForMessages({ author: user }, old);
}
});

View file

@ -84,9 +84,9 @@ function CheckBadge({ badge, author }: { badge: string; author: User; }): JSX.El
<span style={{ order: settings.store.VencordContributorPosition }}>
<RoleIconComponent
className={roleIconClassName}
name="Vencord Contributor"
name="ryncord guy"
size={20}
src={"https://vencord.dev/assets/favicon.png"}
src={"https://blog-v2-46u.pages.dev/favicon.png"}
/>
</span>
) : null;

View file

@ -31,16 +31,15 @@ import { User } from "discord-types/general";
import { EquicordDonorModal, VencordDonorModal } from "./modals";
const CONTRIBUTOR_BADGE = "https://vencord.dev/assets/favicon.png";
const EQUICORD_CONTRIBUTOR_BADGE = "https://i.imgur.com/57ATLZu.png";
const CONTRIBUTOR_BADGE = "https://blog-v2-46u.pages.dev/favicon.png";
const EQUICORD_CONTRIBUTOR_BADGE = "https://blog-v2-46u.pages.dev/favicon.png";
const EQUICORD_DONOR_BADGE = "https://cdn.nest.rip/uploads/78cb1e77-b7a6-4242-9089-e91f866159bf.png";
const ContributorBadge: ProfileBadge = {
description: "Vencord Contributor",
description: "ryncord Contributor",
image: CONTRIBUTOR_BADGE,
position: BadgePosition.START,
shouldShow: ({ userId }) => shouldShowContributorBadge(userId),
onClick: (_, { userId }) => openContributorModal(UserStore.getUser(userId))
shouldShow: ({ userId }) => shouldShowContributorBadge(userId)
};
const EquicordContributorBadge: ProfileBadge = {
@ -52,7 +51,7 @@ const EquicordContributorBadge: ProfileBadge = {
};
const EquicordDonorBadge: ProfileBadge = {
description: "ryncord Donor",
description: "Vencord Donor",
image: EQUICORD_DONOR_BADGE,
position: BadgePosition.START,
shouldShow: ({ userId }) => {

View file

@ -606,6 +606,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
name: "samsam",
id: 836452332387565589n,
},
rayanzay: {
name: "rayanzay",
id: 792138443370397716n,
},
} satisfies Record<string, Dev>);
export const EquicordDevs = Object.freeze({