diff --git a/src/components/ThemeSettings/ThemesTab.tsx b/src/components/ThemeSettings/ThemesTab.tsx index 8cd4e5b2..24056d1c 100644 --- a/src/components/ThemeSettings/ThemesTab.tsx +++ b/src/components/ThemeSettings/ThemesTab.tsx @@ -30,13 +30,13 @@ import { openInviteModal } from "@utils/discord"; import { openModal } from "@utils/modal"; import { showItemInFolder } from "@utils/native"; import { useAwaiter } from "@utils/react"; -import { ThemeHeader } from "@utils/themes"; +import type { ThemeHeader } from "@utils/themes"; import { getThemeInfo, stripBOM, type UserThemeHeader } from "@utils/themes/bd"; import { usercssParse } from "@utils/themes/usercss"; import { findByPropsLazy, findLazy } from "@webpack"; import { Button, Card, Forms, React, showToast, TabBar, TextInput, Tooltip, useEffect, useMemo, useRef, useState } from "@webpack/common"; import type { ComponentType, Ref, SyntheticEvent } from "react"; -import { UserstyleHeader } from "usercss-meta"; +import type { UserstyleHeader } from "usercss-meta"; import { isPluginEnabled } from "../../plugins"; import { UserCSSSettingsModal } from "./UserCSSModal"; diff --git a/src/utils/quickCss.ts b/src/utils/quickCss.ts index 49661191..5057087d 100644 --- a/src/utils/quickCss.ts +++ b/src/utils/quickCss.ts @@ -68,39 +68,15 @@ async function initThemes() { const links: string[] = [...enabledThemeLinks]; if (IS_WEB) { - for (let i = enabledThemes.length - 1; i >= 0; i--) { - const theme = enabledThemes[i]; - - try { - var themeData = await VencordNative.themes.getThemeData(theme); - } catch (e) { - logger.warn("Failed to get theme data for", theme, "(has it gone missing?)", e); - } - - if (!themeData) { - // disable the theme since it has problems - Settings.enabledThemes = enabledThemes.splice(enabledThemes.indexOf(theme), 1); - continue; - } + for (const theme of enabledThemes) { + const themeData = await VencordNative.themes.getThemeData(theme); + if (!themeData) continue; const blob = new Blob([themeData], { type: "text/css" }); links.push(URL.createObjectURL(blob)); } } else { - for (let i = enabledThemes.length - 1; i >= 0; i--) { - const theme = enabledThemes[i]; - - if (theme.endsWith(".user.css")) continue; - - try { - // whilst this is unnecessary here, we're doing it to make sure the theme is valid - await VencordNative.themes.getThemeData(theme); - } catch (e) { - logger.warn("Failed to get theme data for", theme, "(has it gone missing?)", e); - Settings.enabledThemes = enabledThemes.splice(enabledThemes.indexOf(theme), 1); - continue; - } - + for (const theme of enabledThemes) if (!theme.endsWith(".user.css")) { links.push(`vencord:///themes/${theme}?v=${Date.now()}`); } } diff --git a/src/utils/themes/usercss/compiler.ts b/src/utils/themes/usercss/compiler.ts index 059b789a..4758b476 100644 --- a/src/utils/themes/usercss/compiler.ts +++ b/src/utils/themes/usercss/compiler.ts @@ -55,11 +55,7 @@ const preprocessors: { [preprocessor: string]: (text: string, vars: Record