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。

fix(windows-build): ssh-agent err when building on windows

Doracoinc7c71850d4ef
diff --git a/Cargo.lock b/Cargo.lock
index 7bf0316379..c2320b812f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1906,6 +1906,7 @@ dependencies = [
"log",
"mongodb",
"mysql_async",
+ "pageant",
"percent-encoding",
"portpicker",
"rayon",
diff --git a/crates/dbx-core/Cargo.toml b/crates/dbx-core/Cargo.toml
index 717298b8ca..1e7b2e75d9 100644
--- a/crates/dbx-core/Cargo.toml
+++ b/crates/dbx-core/Cargo.toml
@@ -39,6 +39,7 @@ futures = "0.3"
iana-time-zone = "0.1"
mongodb = "3.2.5"
russh = "0.60"
+pageant = "0.2"
portpicker = "0.1.1"
csv = "1"
calamine = "0.30.1"
diff --git a/crates/dbx-core/src/db/ssh_tunnel.rs b/crates/dbx-core/src/db/ssh_tunnel.rs
index fd87791d19..2b2f865422 100644
--- a/crates/dbx-core/src/db/ssh_tunnel.rs
+++ b/crates/dbx-core/src/db/ssh_tunnel.rs
@@ -112,6 +112,7 @@ async fn try_authenticate_with_agent(
ssh_user: &str,
connect_timeout: &Duration,
) -> Result<(), String> {
+ #[cfg(unix)]
let mut agent = match AgentClient::connect_env().await {
Ok(a) => a,
Err(e) => {
@@ -119,6 +120,14 @@ async fn try_authenticate_with_agent(
}
};
+ #[cfg(windows)]
+ let mut agent = {
+ let stream = pageant::PageantStream::new()
+ .await
+ .map_err(|e| format!("No SSH password or key provided, and ssh-agent (Pageant) is unavailable: {e}"))?;
+ AgentClient::connect(stream)
+ };
+
let identities = match agent.request_identities().await {
Ok(ids) if ids.is_empty() => {
return Err("No SSH password or key provided, and ssh-agent has no identities".to_string());
diff --git a/crates/dbx-core/src/plugins.rs b/crates/dbx-core/src/plugins.rs
index ecc80fb1f3..9d7d40761e 100644
--- a/crates/dbx-core/src/plugins.rs
+++ b/crates/dbx-core/src/plugins.rs
@@ -433,6 +433,7 @@ fn spawn_plugin_child(plugin: &InstalledPlugin, env: &PluginRuntimeEnv) -> Resul
#[cfg(windows)]
{
+ #[allow(unused_imports)]
use std::os::windows::process::CommandExt;
command.creation_flags(CREATE_NO_WINDOW);
}