diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/constants.ts | 27 | ||||
-rw-r--r-- | src/utils/misc.tsx | 4 |
2 files changed, 28 insertions, 3 deletions
diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 1c70470..9671ac3 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -29,7 +29,18 @@ export const REACT_GLOBAL = "Vencord.Webpack.Common.React"; export const VENCORD_USER_AGENT = `Vencord/${gitHash}${gitRemote ? ` (https://github.com/${gitRemote})` : ""}`; export const SUPPORT_CHANNEL_ID = "1026515880080842772"; -// Add yourself here if you made a plugin +export interface Dev { + name: string; + id: bigint; + badge?: boolean; +} + +/** + * If you made a plugin or substantial contribution, add yourself here. + * This object is used for the plugin author list, as well as to add a contributor badge to your profile. + * If you wish to stay fully anonymous, feel free to set ID to 0n. + * If you are fine with attribution but don't want the badge, add badge: false + */ export const Devs = /* #__PURE__*/ Object.freeze({ Ven: { name: "Vendicated", @@ -201,7 +212,8 @@ export const Devs = /* #__PURE__*/ Object.freeze({ }, nick: { name: "nick", - id: 347884694408265729n + id: 347884694408265729n, + badge: false }, whqwert: { name: "whqwert", @@ -295,4 +307,13 @@ export const Devs = /* #__PURE__*/ Object.freeze({ name: "outfoxxed", id: 837425748435796060n }, -}); +} satisfies Record<string, Dev>); + +// iife so #__PURE__ works correctly +export const DevsById = /* #__PURE__*/ (() => + Object.freeze(Object.fromEntries( + Object.entries(Devs) + .filter(d => d[1].id !== 0n) + .map(([_, v]) => [v.id, v] as const) + )) +)() as Record<string, Dev>; diff --git a/src/utils/misc.tsx b/src/utils/misc.tsx index 59475cb..ec612a9 100644 --- a/src/utils/misc.tsx +++ b/src/utils/misc.tsx @@ -18,6 +18,8 @@ import { Clipboard, Toasts } from "@webpack/common"; +import { DevsById } from "./constants"; + /** * Recursively merges defaults into an object and returns the same object * @param obj Object @@ -100,3 +102,5 @@ export function identity<T>(value: T): T { // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#mobile_tablet_or_desktop // "In summary, we recommend looking for the string Mobi anywhere in the User Agent to detect a mobile device." export const isMobile = navigator.userAgent.includes("Mobi"); + +export const isPluginDev = (id: string) => Object.hasOwn(DevsById, id); |