mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-30 00:19:35 +00:00
feat(update): add API endpoint to retrieve app version and update client-side calls
This commit is contained in:
+7
-10
@@ -332,9 +332,9 @@ onMounted(async () => {
|
||||
}
|
||||
if (!needsAuth.value || authenticated.value) initApp();
|
||||
api
|
||||
.checkForUpdates()
|
||||
.then((info) => {
|
||||
appVersion.value = info.current_version;
|
||||
.getAppVersion()
|
||||
.then((v) => {
|
||||
appVersion.value = v;
|
||||
})
|
||||
.catch(() => {});
|
||||
return;
|
||||
@@ -342,13 +342,10 @@ onMounted(async () => {
|
||||
initApp();
|
||||
setupFileDrop().catch(() => {});
|
||||
checkUpdates({ silent: true });
|
||||
import("@tauri-apps/api/app")
|
||||
.then(({ getVersion }) => {
|
||||
getVersion()
|
||||
.then((v) => {
|
||||
appVersion.value = v;
|
||||
})
|
||||
.catch(() => {});
|
||||
api
|
||||
.getAppVersion()
|
||||
.then((v) => {
|
||||
appVersion.value = v;
|
||||
})
|
||||
.catch(() => {});
|
||||
setupTauriListeners();
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user