Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

feat: add GitHub proxy endpoints for faster update checks

t8y2198ac5435535
diff --git a/crates/dbx-core/src/update.rs b/crates/dbx-core/src/update.rs
index 4767d5ad53..49ce0e18ba 100644
--- a/crates/dbx-core/src/update.rs
+++ b/crates/dbx-core/src/update.rs
@@ -1,6 +1,10 @@
use serde::{Deserialize, Serialize};
-const LATEST_JSON_URL: &str = "https://github.com/t8y2/dbx/releases/latest/download/latest.json";
+const LATEST_JSON_URLS: &[&str] = &[
+ "https://update.hwdns.net/https://github.com/t8y2/dbx/releases/latest/download/latest.json",
+ "https://gh-proxy.org/https://github.com/t8y2/dbx/releases/latest/download/latest.json",
+ "https://github.com/t8y2/dbx/releases/latest/download/latest.json",
+];
const RELEASE_URL_PREFIX: &str = "https://github.com/t8y2/dbx/releases/tag/v";
#[derive(Debug, Deserialize)]
@@ -21,18 +25,28 @@ pub struct UpdateInfo {
}
pub async fn fetch_latest_release() -> Result<TauriRelease, String> {
- let client = reqwest::Client::new();
- client
- .get(LATEST_JSON_URL)
- .header(reqwest::header::USER_AGENT, "dbx-update-checker")
- .send()
- .await
- .map_err(|e| format!("Failed to check updates: {e}"))?
- .error_for_status()
- .map_err(|e| format!("Failed to check updates: {e}"))?
- .json::<TauriRelease>()
- .await
- .map_err(|e| format!("Failed to parse update response: {e}"))
+ let client = reqwest::Client::builder()
+ .timeout(std::time::Duration::from_secs(10))
+ .build()
+ .map_err(|e| format!("Failed to create HTTP client: {e}"))?;
+ let mut last_err = String::new();
+ for url in LATEST_JSON_URLS {
+ match client
+ .get(*url)
+ .header(reqwest::header::USER_AGENT, "dbx-update-checker")
+ .send()
+ .await
+ .and_then(|r| r.error_for_status())
+ {
+ Ok(resp) => {
+ return resp.json::<TauriRelease>().await.map_err(|e| format!("Failed to parse update response: {e}"));
+ }
+ Err(e) => {
+ last_err = format!("{e}");
+ }
+ }
+ }
+ Err(format!("Failed to check updates: {last_err}"))
}
pub fn build_update_info(release: TauriRelease, current_version: &str) -> UpdateInfo {
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 811ac26762..6e16b0b092 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -41,6 +41,8 @@
"updater": {
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDkxNEYyMzE3QkJCNkM3REYKUldUZng3YTdGeU5Qa1NnTUZCRVhJVkxsOWZKQWFPVCtacUgySlNlcjRDU2RmZElCQnphd25pYUMK",
"endpoints": [
+ "https://update.hwdns.net/https://github.com/t8y2/dbx/releases/latest/download/latest.json",
+ "https://gh-proxy.org/https://github.com/t8y2/dbx/releases/latest/download/latest.json",
"https://github.com/t8y2/dbx/releases/latest/download/latest.json"
]
}