diff --git a/src/Vencord.ts b/src/Vencord.ts index a575cc59..88a83ba9 100644 --- a/src/Vencord.ts +++ b/src/Vencord.ts @@ -30,7 +30,6 @@ import "./utils/quickCss"; import "./webpack/patchWebpack"; import { openUpdaterModal } from "@components/VencordSettings/UpdaterTab"; -import { Logger } from "@utils/Logger"; import { StartAt } from "@utils/types"; import { get as dsGet } from "./api/DataStore"; @@ -49,37 +48,6 @@ if (IS_REPORTER) { Settings.plugins.CharacterCounter.enabled = false; } -const logger = new Logger("Debug", "#a6d189"); - -let isFrozen = true; -const checkInterval = 5000; -const freezeChecker = setInterval(() => { - if (isFrozen) { - location.reload(); - } - isFrozen = true; -}, checkInterval); - -function safeInit() { - try { - startAllPlugins(StartAt.Init); - init(); - - const originalLoggerInfo = logger.info.bind(logger); - logger.info = function (message) { - originalLoggerInfo(message); - if (message.includes("Completed Equicord initialization.")) { - isFrozen = false; - clearInterval(freezeChecker); - } - }; - } catch (error) { - logger.error("Failed to initialize Equicord, reloading in 5 seconds...", error); - clearInterval(freezeChecker); - setTimeout(() => location.reload(), 5000); - } -} - async function syncSettings() { // pre-check for local shared settings if ( @@ -126,8 +94,6 @@ async function init() { syncSettings(); - logger.info("Completed Equicord initialization."); - if (!IS_WEB && !IS_UPDATER_DISABLED) { try { const isOutdated = await checkForUpdates(); @@ -173,25 +139,15 @@ async function init() { } } -safeInit(); +startAllPlugins(StartAt.Init); +init(); document.addEventListener("DOMContentLoaded", () => { - try { - startAllPlugins(StartAt.DOMContentLoaded); - - if (IS_DISCORD_DESKTOP && Settings.winNativeTitleBar && navigator.platform.toLowerCase().startsWith("win")) { - document.head.append(Object.assign(document.createElement("style"), { - id: "vencord-native-titlebar-style", - textContent: "[class*=titleBar]{display: none!important}" - })); - } - - isFrozen = false; - clearInterval(freezeChecker); - logger.info("DOMContentLoaded event handled successfully."); - } catch (error) { - logger.error("Error during DOMContentLoaded event, reloading in 5 seconds...", error); - clearInterval(freezeChecker); - setTimeout(() => location.reload(), 5000); + startAllPlugins(StartAt.DOMContentLoaded); + if (IS_DISCORD_DESKTOP && Settings.winNativeTitleBar && navigator.platform.toLowerCase().startsWith("win")) { + document.head.append(Object.assign(document.createElement("style"), { + id: "vencord-native-titlebar-style", + textContent: "[class*=titleBar]{display: none!important}" + })); } }, { once: true }); diff --git a/src/webpack/webpack.ts b/src/webpack/webpack.ts index 7796827b..26d9c0d7 100644 --- a/src/webpack/webpack.ts +++ b/src/webpack/webpack.ts @@ -26,7 +26,7 @@ import { traceFunction } from "../debug/Tracer"; import { Flux } from "./common"; import { AnyModuleFactory, AnyWebpackRequire, ModuleExports, WebpackRequire } from "./wreq"; -export const logger = new Logger("Webpack"); +const logger = new Logger("Webpack"); export let _resolveReady: () => void; /**