feat(update): add API endpoint to retrieve app version and update client-side calls

This commit is contained in:
t8y2 committed 2026-05-05 16:01:38 +08:00
1 parent 3acd9280ac
commit 24537093ad
6 files changed
+23 -10

No files matched your search

+1
View File
@@ -109,6 +109,7 @@ export const deleteHistoryEntry = forward("deleteHistoryEntry");
// Updates
export const checkForUpdates = forward("checkForUpdates");
export const getAppVersion = forward("getAppVersion");
// Layout
export const saveSidebarLayout = forward("saveSidebarLayout");
+5
View File
@@ -543,6 +543,11 @@ export async function checkForUpdates(): Promise<UpdateInfo> {
return get("/api/update/check");
}
export async function getAppVersion(): Promise<string> {
const res: { version: string } = await get("/api/version");
return res.version;
}
// ---------------------------------------------------------------------------
// Layout
// ---------------------------------------------------------------------------
+5
View File
@@ -230,6 +230,11 @@ export async function checkForUpdates(): Promise<UpdateInfo> {
return invoke("check_for_updates");
}
export async function getAppVersion(): Promise<string> {
const { getVersion } = await import("@tauri-apps/api/app");
return getVersion();
}
// --- Redis ---
export interface RedisKeyInfo {
key: string;