diff --git a/src/Vencord.ts b/src/Vencord.ts index 0e64212d..a575cc59 100644 --- a/src/Vencord.ts +++ b/src/Vencord.ts @@ -30,6 +30,7 @@ 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"; @@ -48,6 +49,37 @@ 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 ( @@ -94,6 +126,8 @@ async function init() { syncSettings(); + logger.info("Completed Equicord initialization."); + if (!IS_WEB && !IS_UPDATER_DISABLED) { try { const isOutdated = await checkForUpdates(); @@ -139,16 +173,25 @@ async function init() { } } -startAllPlugins(StartAt.Init); -init(); +safeInit(); document.addEventListener("DOMContentLoaded", () => { - startAllPlugins(StartAt.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}" - })); + 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); } }, { once: true }); diff --git a/src/plugins/_core/supportHelper.tsx b/src/plugins/_core/supportHelper.tsx index d15d63b2..1a7a7aca 100644 --- a/src/plugins/_core/supportHelper.tsx +++ b/src/plugins/_core/supportHelper.tsx @@ -130,7 +130,20 @@ function generatePluginList() { } if (enabledPlugins.length > 100 && !(isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id))) { - content = "We don't support users with more than 100 plugins enabled. Please disable some and try again."; + return Alerts.show({ + title: "You are attempting to get support!", + body:
+ + + Before you ask for help, + We do not handle support for users who use 100+ plugins + issue could be plugin confliction + try removing some plugins and see if it fixes! +
, + cancelText: "Okay continue" + }); } return content; @@ -174,7 +187,10 @@ export default definePlugin({ description: "Send Equicord plugin list", // @ts-ignore predicate: ctx => isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id) || GUILD_ID === ctx?.guild?.id, - execute: () => ({ content: generatePluginList() }) + execute: () => { + const pluginList = generatePluginList(); + return { content: typeof pluginList === "string" ? pluginList : "Unable to generate plugin list." }; + } } ], @@ -199,7 +215,7 @@ export default definePlugin({ , confirmText: "Go to Equicord Support", cancelText: "Okay continue", - onConfirm: () => VencordNative.native.openExternal("https://discord.gg/npnv52UQwY"), + onConfirm: () => VencordNative.native.openExternal("https://discord.gg/equicord"), }); } @@ -234,7 +250,7 @@ export default definePlugin({ body:
You are using an externally updated Equicord version, the ability to help you here may be limited. - Please join the Equicord Server for support, + Please join the Equicord Server for support, or if this issue persists on Vencord, continue on.
@@ -306,7 +322,12 @@ export default definePlugin({ , diff --git a/src/plugins/betterFolders/index.tsx b/src/plugins/betterFolders/index.tsx index ded8b611..a4675095 100644 --- a/src/plugins/betterFolders/index.tsx +++ b/src/plugins/betterFolders/index.tsx @@ -76,6 +76,11 @@ export const settings = definePluginSettings({ description: "Close other folders when opening a folder", default: false }, + closeServerFolder: { + type: OptionType.BOOLEAN, + description: "Close folder when selecting a server in that folder", + default: false, + }, forceOpen: { type: OptionType.BOOLEAN, description: "Force a folder to open when switching to a server of that folder", @@ -218,7 +223,7 @@ export default definePlugin({ flux: { CHANNEL_SELECT(data) { - if (!settings.store.closeAllFolders && !settings.store.forceOpen) + if (!settings.store.closeAllFolders && !settings.store.forceOpen && !settings.store.closeServerFolder) return; if (lastGuildId !== data.guildId) { @@ -229,6 +234,9 @@ export default definePlugin({ if (settings.store.forceOpen && !ExpandedGuildFolderStore.isFolderExpanded(guildFolder.folderId)) { FolderUtils.toggleGuildFolderExpand(guildFolder.folderId); } + if (settings.store.closeServerFolder && ExpandedGuildFolderStore.isFolderExpanded(guildFolder.folderId)) { + FolderUtils.toggleGuildFolderExpand(guildFolder.folderId); + } } else if (settings.store.closeAllFolders) { closeFolders(); } diff --git a/src/plugins/moreCommands/index.tsx b/src/plugins/moreCommands/index.tsx index 88a8f22d..c167fe2f 100644 --- a/src/plugins/moreCommands/index.tsx +++ b/src/plugins/moreCommands/index.tsx @@ -17,7 +17,7 @@ */ import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, OptionalMessageOption, RequiredMessageOption, sendBotMessage } from "@api/Commands"; -import { Devs, EquicordDevs } from "@utils/constants"; +import { Devs } from "@utils/constants"; import definePlugin from "@utils/types"; @@ -32,7 +32,7 @@ function mock(input: string): string { export default definePlugin({ name: "MoreCommands", description: "Echo, Lenny, Mock, and More", - authors: [Devs.Arjix, Devs.echo, Devs.Samu, EquicordDevs.ExoDev], + authors: [Devs.Arjix, Devs.echo, Devs.Samu], commands: [ { name: "echo", diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 2410eab0..081f127f 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -984,10 +984,6 @@ export const EquicordDevs = Object.freeze({ name: "vappstar", id: 747192967311261748n }, - ExoDev: { - name: "ExoDev", - id: 1325655837003223137n - }, voidbbg: { name: "voidbbg", id: 117126234588184582n diff --git a/src/webpack/webpack.ts b/src/webpack/webpack.ts index 26d9c0d7..7796827b 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"; -const logger = new Logger("Webpack"); +export const logger = new Logger("Webpack"); export let _resolveReady: () => void; /**