fix: init background

This commit is contained in:
hamster1963
2025-01-20 00:45:35 +08:00
parent 38be1e9a10
commit 561513e6e1
2 changed files with 33 additions and 15 deletions
+5 -5
View File
@@ -28,11 +28,6 @@ const App: React.FC = () => {
const [isCustomCodeInjected, setIsCustomCodeInjected] = useState(false)
const { backgroundImage: customBackgroundImage } = useBackground()
// 检测是否强制指定了主题颜色
const forceTheme =
// @ts-expect-error ForceTheme is a global variable
(window.ForceTheme as string) !== "" ? window.ForceTheme : undefined
useEffect(() => {
if (settingData?.data?.config?.custom_code) {
InjectContext(settingData?.data?.config?.custom_code)
@@ -40,6 +35,11 @@ const App: React.FC = () => {
}
}, [settingData?.data?.config?.custom_code])
// 检测是否强制指定了主题颜色
const forceTheme =
// @ts-expect-error ForceTheme is a global variable
(window.ForceTheme as string) !== "" ? window.ForceTheme : undefined
useEffect(() => {
if (forceTheme === "dark" || forceTheme === "light") {
setTheme(forceTheme)