diff --git a/src/App.tsx b/src/App.tsx
index c4da0e3..e647c21 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,10 +1,11 @@
import { useQuery } from "@tanstack/react-query"
-import React, { useCallback, useEffect } from "react"
+import React, { useCallback } from "react"
import { Route, BrowserRouter as Router, Routes } from "react-router-dom"
import Footer from "./components/Footer"
import Header from "./components/Header"
import { fetchSetting } from "./lib/nezha-api"
+import { cn } from "./lib/utils"
import ErrorPage from "./pages/ErrorPage"
import NotFound from "./pages/NotFound"
import Server from "./pages/Server"
@@ -52,12 +53,6 @@ const App: React.FC = () => {
})
}, [])
- useEffect(() => {
- if (settingData?.data?.custom_code) {
- InjectContext(settingData?.data?.custom_code)
- }
- }, [settingData?.data?.custom_code])
-
if (error) {
return
}
@@ -66,10 +61,28 @@ const App: React.FC = () => {
return null
}
+ if (settingData?.data?.custom_code) {
+ InjectContext(settingData?.data?.custom_code)
+ }
+
+ const customBackgroundImage =
+ // @ts-expect-error ShowNetTransfer is a global variable
+ (window.CustomBackgroundImage as string) !== "" ? window.CustomBackgroundImage : undefined
+
return (
-