Fix Desktop thinking it's web

I forgor to test host after adding web support
This commit is contained in:
Vendicated 2022-10-04 12:57:39 +02:00
parent e35393b40c
commit 3a9f692644
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3
6 changed files with 8 additions and 5 deletions

View file

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

View file

@ -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
View file

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

View file

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

View file

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

View file

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