mirror of
https://github.com/Equicord/Equicord.git
synced 2025-02-20 15:18:50 -05:00
Fixes
This commit is contained in:
parent
2960e9a74a
commit
5fbb3698f4
3 changed files with 7 additions and 35 deletions
|
@ -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";
|
||||
|
|
|
@ -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()}`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,11 +55,7 @@ const preprocessors: { [preprocessor: string]: (text: string, vars: Record<strin
|
|||
};
|
||||
|
||||
export async function compileUsercss(fileName: string) {
|
||||
try {
|
||||
var themeData = await VencordNative.themes.getThemeData(fileName);
|
||||
} catch (e) {
|
||||
UserCSSLogger.warn("Failed to get theme data for", fileName, "(has it gone missing?)", e);
|
||||
}
|
||||
const themeData = await VencordNative.themes.getThemeData(fileName);
|
||||
if (!themeData) return null;
|
||||
|
||||
// UserCSS preprocessor order look like this:
|
||||
|
|
Loading…
Add table
Reference in a new issue