aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Vencord.ts6
-rw-r--r--src/components/Settings.tsx3
-rw-r--r--src/globals.d.ts1
-rw-r--r--src/plugins/settings.ts1
-rw-r--r--src/utils/isWeb.ts1
-rw-r--r--src/webpack/patchWebpack.ts1
6 files changed, 8 insertions, 5 deletions
diff --git a/src/Vencord.ts b/src/Vencord.ts
index 5b3d6f2..716cb83 100644
--- a/src/Vencord.ts
+++ b/src/Vencord.ts
@@ -16,6 +16,12 @@ import { checkForUpdates, UpdateLogger } from './utils/updater';
import { onceReady } from "./webpack";
import { Router } from "./webpack/common";
+Object.defineProperty(window, "IS_WEB", {
+ get: () => !window.DiscordNative,
+ configurable: true,
+ enumerable: true
+});
+
export let Components;
async function init() {
diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx
index 4dbb1b2..007767e 100644
--- a/src/components/Settings.tsx
+++ b/src/components/Settings.tsx
@@ -9,7 +9,6 @@ import { startPlugin } from "../plugins";
import { stopPlugin } from '../plugins/index';
import { Flex } from './Flex';
import { ChangeList } from '../utils/ChangeList';
-import { IS_WEB } from '../utils/isWeb';
function showErrorToast(message: string) {
Toasts.show({
@@ -25,7 +24,7 @@ function showErrorToast(message: string) {
export default ErrorBoundary.wrap(function Settings() {
const [settingsDir, , settingsDirPending] = useAwaiter(() => VencordNative.ipc.invoke<string>(IpcEvents.GET_SETTINGS_DIR), "Loading...");
const settings = useSettings();
- const changes = React.useMemo(() => new ChangeList<string>, []);
+ const changes = React.useMemo(() => new ChangeList<string>(), []);
React.useEffect(() => {
return () => void (changes.hasChanges && Alerts.show({
diff --git a/src/globals.d.ts b/src/globals.d.ts
index 92ca95c..292fa96 100644
--- a/src/globals.d.ts
+++ b/src/globals.d.ts
@@ -1,4 +1,5 @@
declare global {
+ export var IS_WEB: boolean;
export var VencordNative: typeof import("./VencordNative").default;
export var Vencord: typeof import("./Vencord");
export var appSettings: {
diff --git a/src/plugins/settings.ts b/src/plugins/settings.ts
index 6927f64..7125823 100644
--- a/src/plugins/settings.ts
+++ b/src/plugins/settings.ts
@@ -1,7 +1,6 @@
import definePlugin from "../utils/types";
import gitHash from "git-hash";
import { Devs } from '../utils/constants';
-import { IS_WEB } from "../utils/isWeb";
export default definePlugin({
name: "Settings",
diff --git a/src/utils/isWeb.ts b/src/utils/isWeb.ts
deleted file mode 100644
index 4082164..0000000
--- a/src/utils/isWeb.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const IS_WEB = window.IS_WEB = typeof window.DiscordNative === "undefined";
diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts
index ffd81d5..469b930 100644
--- a/src/webpack/patchWebpack.ts
+++ b/src/webpack/patchWebpack.ts
@@ -6,7 +6,6 @@ let webpackChunk: any[];
const logger = new Logger("WebpackInterceptor", "#8caaee");
-console.log("prepatch is", window[WEBPACK_CHUNK]);
Object.defineProperty(window, WEBPACK_CHUNK, {
get: () => webpackChunk,
set: (v) => {