Fix Desktop thinking it's web

I forgor to test host after adding web support
main
Vendicated 2 years ago
parent e35393b40c
commit 3a9f692644
No known key found for this signature in database
GPG Key ID: EC781ADFB93EFFA3

@ -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() {

@ -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({

1
src/globals.d.ts vendored

@ -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: {

@ -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",

@ -1 +0,0 @@
export const IS_WEB = window.IS_WEB = typeof window.DiscordNative === "undefined";

@ -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) => {

Loading…
Cancel
Save