diff --git a/src/components/VencordSettings/VencordTab.tsx b/src/components/VencordSettings/VencordTab.tsx index a8e9ea5b0..d368a1594 100644 --- a/src/components/VencordSettings/VencordTab.tsx +++ b/src/components/VencordSettings/VencordTab.tsx @@ -21,6 +21,7 @@ import { Settings, useSettings } from "@api/Settings"; import { classNameFactory } from "@api/Styles"; import DonateButton from "@components/DonateButton"; import { ErrorCard } from "@components/ErrorCard"; +import { isMac, isWindows } from "@utils/constants"; import { Margins } from "@utils/margins"; import { identity } from "@utils/misc"; import { relaunch, showItemInFolder } from "@utils/native"; @@ -46,9 +47,6 @@ function VencordSettings() { const donateImage = React.useMemo(() => Math.random() > 0.5 ? DEFAULT_DONATE_IMAGE : SHIGGY_DONATE_IMAGE, []); - const isWindows = navigator.platform.toLowerCase().startsWith("win"); - const isMac = navigator.platform.toLowerCase().startsWith("mac"); - const Switches: Array; title: string; diff --git a/src/plugins/experiments/index.tsx b/src/plugins/experiments/index.tsx index 89fcf33e7..1159e92aa 100644 --- a/src/plugins/experiments/index.tsx +++ b/src/plugins/experiments/index.tsx @@ -19,7 +19,7 @@ import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { ErrorCard } from "@components/ErrorCard"; -import { Devs } from "@utils/constants"; +import { Devs, isMac } from "@utils/constants"; import { Margins } from "@utils/margins"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy } from "@webpack"; @@ -96,9 +96,8 @@ export default definePlugin({ ], settingsAboutComponent: () => { - const isMacOS = navigator.platform.includes("Mac"); - const modKey = isMacOS ? "cmd" : "ctrl"; - const altKey = isMacOS ? "opt" : "alt"; + const modKey = isMac ? "cmd" : "ctrl"; + const altKey = isMac ? "opt" : "alt"; return ( More Information diff --git a/src/plugins/quickReply/index.ts b/src/plugins/quickReply/index.ts index 118a51beb..9771445d9 100644 --- a/src/plugins/quickReply/index.ts +++ b/src/plugins/quickReply/index.ts @@ -17,7 +17,7 @@ */ import { definePluginSettings, Settings } from "@api/Settings"; -import { Devs } from "@utils/constants"; +import { Devs, isMac } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy } from "@webpack"; import { ChannelStore, FluxDispatcher as Dispatcher, MessageStore, PermissionsBits, PermissionStore, SelectedChannelStore, UserStore } from "@webpack/common"; @@ -25,7 +25,6 @@ import { Message } from "discord-types/general"; const Kangaroo = findByPropsLazy("jumpToMessage"); -const isMac = navigator.platform.includes("Mac"); // bruh let replyIdx = -1; let editIdx = -1; diff --git a/src/utils/constants.ts b/src/utils/constants.ts index aeadcdbfb..65d289517 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -389,3 +389,10 @@ export const DevsById = /* #__PURE__*/ (() => .map(([_, v]) => [v.id, v] as const) )) )() as Record; + + +const { platform } = navigator; + +export const isWindows = platform.startsWith("Win"); +export const isMac = platform.startsWith("Mac"); +export const isLinux = platform.startsWith("Linux");