Merge branch 'dev' into main

This commit is contained in:
thororen 2025-03-17 01:39:41 -04:00 committed by GitHub
commit 865e7ce2ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 89 additions and 21 deletions

View file

@ -30,6 +30,7 @@ import "./utils/quickCss";
import "./webpack/patchWebpack"; import "./webpack/patchWebpack";
import { openUpdaterModal } from "@components/VencordSettings/UpdaterTab"; import { openUpdaterModal } from "@components/VencordSettings/UpdaterTab";
import { Logger } from "@utils/Logger";
import { StartAt } from "@utils/types"; import { StartAt } from "@utils/types";
import { get as dsGet } from "./api/DataStore"; import { get as dsGet } from "./api/DataStore";
@ -48,6 +49,37 @@ if (IS_REPORTER) {
Settings.plugins.CharacterCounter.enabled = false; 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() { async function syncSettings() {
// pre-check for local shared settings // pre-check for local shared settings
if ( if (
@ -94,6 +126,8 @@ async function init() {
syncSettings(); syncSettings();
logger.info("Completed Equicord initialization.");
if (!IS_WEB && !IS_UPDATER_DISABLED) { if (!IS_WEB && !IS_UPDATER_DISABLED) {
try { try {
const isOutdated = await checkForUpdates(); const isOutdated = await checkForUpdates();
@ -139,16 +173,25 @@ async function init() {
} }
} }
startAllPlugins(StartAt.Init); safeInit();
init();
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", () => {
startAllPlugins(StartAt.DOMContentLoaded); try {
startAllPlugins(StartAt.DOMContentLoaded);
if (IS_DISCORD_DESKTOP && Settings.winNativeTitleBar && navigator.platform.toLowerCase().startsWith("win")) { if (IS_DISCORD_DESKTOP && Settings.winNativeTitleBar && navigator.platform.toLowerCase().startsWith("win")) {
document.head.append(Object.assign(document.createElement("style"), { document.head.append(Object.assign(document.createElement("style"), {
id: "vencord-native-titlebar-style", id: "vencord-native-titlebar-style",
textContent: "[class*=titleBar]{display: none!important}" 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 }); }, { once: true });

View file

@ -130,7 +130,20 @@ function generatePluginList() {
} }
if (enabledPlugins.length > 100 && !(isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id))) { 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: <div>
<style>
{'[class*="backdrop_"][style*="backdrop-filter"]{backdrop-filter:blur(16px) brightness(0.25) !important;}'}
</style>
<img src="https://media.tenor.com/QtGqjwBpRzwAAAAi/wumpus-dancing.gif" />
<Forms.FormText>Before you ask for help,</Forms.FormText>
<Forms.FormText>We do not handle support for users who use 100+ plugins</Forms.FormText>
<Forms.FormText>issue could be plugin confliction</Forms.FormText>
<Forms.FormText>try removing some plugins and see if it fixes!</Forms.FormText>
</div>,
cancelText: "Okay continue"
});
} }
return content; return content;
@ -174,7 +187,10 @@ export default definePlugin({
description: "Send Equicord plugin list", description: "Send Equicord plugin list",
// @ts-ignore // @ts-ignore
predicate: ctx => isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id) || GUILD_ID === ctx?.guild?.id, 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({
</div>, </div>,
confirmText: "Go to Equicord Support", confirmText: "Go to Equicord Support",
cancelText: "Okay continue", 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: <div> body: <div>
<Forms.FormText>You are using an externally updated Equicord version, the ability to help you here may be limited.</Forms.FormText> <Forms.FormText>You are using an externally updated Equicord version, the ability to help you here may be limited.</Forms.FormText>
<Forms.FormText className={Margins.top8}> <Forms.FormText className={Margins.top8}>
Please join the <Link href="https://discord.gg/5Xh2W87egW">Equicord Server</Link> for support, Please join the <Link href="https://discord.gg/equicord">Equicord Server</Link> for support,
or if this issue persists on Vencord, continue on. or if this issue persists on Vencord, continue on.
</Forms.FormText> </Forms.FormText>
</div> </div>
@ -306,7 +322,12 @@ export default definePlugin({
</Button>, </Button>,
<Button <Button
key="vc-plg-list" key="vc-plg-list"
onClick={async () => sendMessage(props.channel.id, { content: generatePluginList() })} onClick={async () => {
const pluginList = generatePluginList();
if (typeof pluginList === "string") {
sendMessage(props.channel.id, { content: pluginList });
}
}}
> >
Run /equicord-plugins Run /equicord-plugins
</Button> </Button>

View file

@ -76,6 +76,11 @@ export const settings = definePluginSettings({
description: "Close other folders when opening a folder", description: "Close other folders when opening a folder",
default: false default: false
}, },
closeServerFolder: {
type: OptionType.BOOLEAN,
description: "Close folder when selecting a server in that folder",
default: false,
},
forceOpen: { forceOpen: {
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,
description: "Force a folder to open when switching to a server of that folder", description: "Force a folder to open when switching to a server of that folder",
@ -218,7 +223,7 @@ export default definePlugin({
flux: { flux: {
CHANNEL_SELECT(data) { CHANNEL_SELECT(data) {
if (!settings.store.closeAllFolders && !settings.store.forceOpen) if (!settings.store.closeAllFolders && !settings.store.forceOpen && !settings.store.closeServerFolder)
return; return;
if (lastGuildId !== data.guildId) { if (lastGuildId !== data.guildId) {
@ -229,6 +234,9 @@ export default definePlugin({
if (settings.store.forceOpen && !ExpandedGuildFolderStore.isFolderExpanded(guildFolder.folderId)) { if (settings.store.forceOpen && !ExpandedGuildFolderStore.isFolderExpanded(guildFolder.folderId)) {
FolderUtils.toggleGuildFolderExpand(guildFolder.folderId); FolderUtils.toggleGuildFolderExpand(guildFolder.folderId);
} }
if (settings.store.closeServerFolder && ExpandedGuildFolderStore.isFolderExpanded(guildFolder.folderId)) {
FolderUtils.toggleGuildFolderExpand(guildFolder.folderId);
}
} else if (settings.store.closeAllFolders) { } else if (settings.store.closeAllFolders) {
closeFolders(); closeFolders();
} }

View file

@ -17,7 +17,7 @@
*/ */
import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, OptionalMessageOption, RequiredMessageOption, sendBotMessage } from "@api/Commands"; 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"; import definePlugin from "@utils/types";
@ -32,7 +32,7 @@ function mock(input: string): string {
export default definePlugin({ export default definePlugin({
name: "MoreCommands", name: "MoreCommands",
description: "Echo, Lenny, Mock, and More", description: "Echo, Lenny, Mock, and More",
authors: [Devs.Arjix, Devs.echo, Devs.Samu, EquicordDevs.ExoDev], authors: [Devs.Arjix, Devs.echo, Devs.Samu],
commands: [ commands: [
{ {
name: "echo", name: "echo",

View file

@ -984,10 +984,6 @@ export const EquicordDevs = Object.freeze({
name: "vappstar", name: "vappstar",
id: 747192967311261748n id: 747192967311261748n
}, },
ExoDev: {
name: "ExoDev",
id: 1325655837003223137n
},
voidbbg: { voidbbg: {
name: "voidbbg", name: "voidbbg",
id: 117126234588184582n id: 117126234588184582n

View file

@ -26,7 +26,7 @@ import { traceFunction } from "../debug/Tracer";
import { Flux } from "./common"; import { Flux } from "./common";
import { AnyModuleFactory, AnyWebpackRequire, ModuleExports, WebpackRequire } from "./wreq"; import { AnyModuleFactory, AnyWebpackRequire, ModuleExports, WebpackRequire } from "./wreq";
const logger = new Logger("Webpack"); export const logger = new Logger("Webpack");
export let _resolveReady: () => void; export let _resolveReady: () => void;
/** /**