Skip to content

Commit 20a993b

Browse files
committed
fix: 关于页面版本号从后端获取,统一版本管理
- 移除前端硬编码的版本号 - 从 Cargo.toml 读取版本号,确保与 package.json/tauri.conf.json 同步 - 只需维护一处版本号(Cargo.toml)
1 parent cce3b8f commit 20a993b

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/components/settings/AboutSection.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interface ToolVersion {
2323

2424
export function AboutSection() {
2525
const [versionInfo, setVersionInfo] = useState<VersionInfo>({
26-
current: "0.14.0",
26+
current: "",
2727
latest: undefined,
2828
hasUpdate: false,
2929
downloadUrl: undefined,
@@ -33,6 +33,23 @@ export function AboutSection() {
3333
const [toolVersions, setToolVersions] = useState<ToolVersion[]>([]);
3434
const [loadingTools, setLoadingTools] = useState(true);
3535

36+
// 加载当前版本号(从后端获取,确保与 Cargo.toml 同步)
37+
useEffect(() => {
38+
const loadCurrentVersion = async () => {
39+
try {
40+
// check_for_updates 会返回当前版本号
41+
const result = await invoke<VersionInfo>("check_for_updates");
42+
setVersionInfo((prev) => ({
43+
...prev,
44+
current: result.current,
45+
}));
46+
} catch (error) {
47+
console.error("Failed to load version:", error);
48+
}
49+
};
50+
loadCurrentVersion();
51+
}, []);
52+
3653
// 加载本地工具版本
3754
useEffect(() => {
3855
const loadToolVersions = async () => {

0 commit comments

Comments
 (0)