diff --git a/bun.lockb b/bun.lockb index 3517be0..79ddd81 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index a1800aa..8a361eb 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "next-build": "next build", "tauri": "tauri", "build": "tauri build", + "build-fast": "tauri build -b nsis -- --profile dev", "dev": "tauri dev", "lint": "next lint", "fix": "next lint --fix" @@ -36,7 +37,6 @@ "@types/throttle-debounce": "^5.0.2", "ahooks": "^3.8.4", "framer-motion": "^12.5.0", - "jotai": "^2.12.2", "next": "15.2.2", "next-themes": "^0.4.6", "react": "^19.0.0", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 1fd0d38..dd758e2 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -17,6 +17,10 @@ opt-level = "s" # Optimize for binary size strip = true # Remove debug symbols # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[profile.dev] +opt-level = 0 # 关闭优化 +debug = true # 保留调试信息 + [build-dependencies] tauri-build = { version = "2.1.0", features = [] } diff --git a/src/app/(main)/preference/path/page.tsx b/src/app/(main)/preference/path/page.tsx index 1521c07..e213c9d 100644 --- a/src/app/(main)/preference/path/page.tsx +++ b/src/app/(main)/preference/path/page.tsx @@ -10,7 +10,7 @@ export default function Page() {
游戏路径:{steam.state.cs2Dir}
Steam路径有效:{steam.state.steamDirValid ? "是" : "否"}
游戏路径有效:{steam.state.cs2DirValid ? "是" : "否"}
-Steam账号:{steam.currentUser().accountName}
+Steam账号:{steam.currentUser()?.accountName || " "}
) } diff --git a/src/app/prepare/page.tsx b/src/app/prepare/page.tsx index c9b6b1c..8207543 100644 --- a/src/app/prepare/page.tsx +++ b/src/app/prepare/page.tsx @@ -39,7 +39,7 @@ export default function Page() { steam.setCsDir(e.target.value) }} /> -当前用户64位SteamID:{steam.currentUser().steamID64}
+当前用户64位SteamID:{steam.currentUser()?.steamID64}
) diff --git a/src/components/cstb/Prepare.tsx b/src/components/cstb/Prepare.tsx index 18227c7..5bfde9d 100644 --- a/src/components/cstb/Prepare.tsx +++ b/src/components/cstb/Prepare.tsx @@ -32,6 +32,7 @@ export function Prepare() { const app = useAppStore() const router = useRouter() const [loading, setLoading] = useState(true) + const [inited, setInited] = useState(false) const [, setSteamDir] = useState(steam.state.steamDir) const [, setCs2Dir] = useState(steam.state.cs2Dir) @@ -41,31 +42,32 @@ export function Prepare() { await steam.store.start() await app.store.start() if (!app.state.inited) await autoGetPaths() + setInited(true) } void init() }, []) // valid变动后调整State - const debounceValid = useDebounce(steam.state.steamDirValid && steam.state.cs2DirValid, { - wait: 500, - leading: true, - trailing: true, - maxWait: 2500, - }) const [checkCount, setCheckCount] = useState(0) useEffect(() => { setCheckCount((prev) => (prev >= 10 ? 10 : prev + 1)) - // console.log(checkCount, "触发", debounceValid, steam.state.steamDir, steam.state.cs2Dir) - if (checkCount < 2 && debounceValid && app.state.inited) { - setTimeout(() => { - router.push("/home") - }, 800) + // console.log(checkCount, "触发", steam.state.steamDir, steam.state.cs2Dir, app.state.inited) + if (checkCount <= 2) { + if (steam.state.steamDir && steam.state.cs2Dir && app.state.inited) { + setTimeout(() => { + router.push("/home") + }, 300) + } else { + setTimeout(() => { + setLoading(false) + }, 1000) + } } else { setTimeout(() => { setLoading(false) - }, 1000) + }, 1200) } - }, [debounceValid]) + }, [inited]) const handleSelectSteamDir = async () => { const selected = await open({ diff --git a/src/components/window/Header.tsx b/src/components/window/Header.tsx index 7549f97..0a68314 100644 --- a/src/components/window/Header.tsx +++ b/src/components/window/Header.tsx @@ -6,10 +6,10 @@ const Header = () => { return (- {steam.currentUser().accountName || '本周使用CS工具箱 114 小时'} + {steam.currentUser()?.accountName || '本周使用CS工具箱 114 小时'}