25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
feat(update): add API endpoint to retrieve app version and update client-side calls
t8y224537093adc2
diff --git a/src-web/src/main.rs b/src-web/src/main.rsindex aaf894d03b..1ef3761d21 100644--- a/src-web/src/main.rs+++ b/src-web/src/main.rs@@ -137,6 +137,7 @@ async fn main() {.route("/import/progress/{importId}", get(routes::table_import::import_progress)).route("/import/cancel", post(routes::table_import::cancel_import))// Update+ .route("/version", get(routes::update::get_version)).route("/update/check", get(routes::update::check_for_updates))// Layout.route("/layout/sidebar", post(routes::layout::save_sidebar_layout).get(routes::layout::load_sidebar_layout))diff --git a/src-web/src/routes/update.rs b/src-web/src/routes/update.rsindex 7c0a2b8e38..2cad13a620 100644--- a/src-web/src/routes/update.rs+++ b/src-web/src/routes/update.rs@@ -3,6 +3,10 @@ use dbx_core::update;use crate::error::AppError;+pub async fn get_version() -> Json<serde_json::Value> {+ Json(serde_json::json!({ "version": env!("CARGO_PKG_VERSION") }))+}+pub async fn check_for_updates() -> Result<Json<serde_json::Value>, AppError> {let release = update::fetch_latest_release().await.map_err(AppError)?;let info = update::build_update_info(release, env!("CARGO_PKG_VERSION"));diff --git a/src/App.vue b/src/App.vueindex 813c9f365a..e4c455250e 100644--- a/src/App.vue+++ b/src/App.vue@@ -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();diff --git a/src/lib/api.ts b/src/lib/api.tsindex 860c278458..a5af8a87db 100644--- a/src/lib/api.ts+++ b/src/lib/api.ts@@ -109,6 +109,7 @@ export const deleteHistoryEntry = forward("deleteHistoryEntry");// Updatesexport const checkForUpdates = forward("checkForUpdates");+export const getAppVersion = forward("getAppVersion");// Layoutexport const saveSidebarLayout = forward("saveSidebarLayout");diff --git a/src/lib/http.ts b/src/lib/http.tsindex 8ffcb27e9d..dc570df509 100644--- a/src/lib/http.ts+++ b/src/lib/http.ts@@ -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// ---------------------------------------------------------------------------diff --git a/src/lib/tauri.ts b/src/lib/tauri.tsindex b0d82aa4b2..1f959c079f 100644--- a/src/lib/tauri.ts+++ b/src/lib/tauri.ts@@ -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;