Fix compilation errors after PostgreSQL removal
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled

Changes:
- Remove pg_conn field from SshServerConfig struct
- Remove pg_conn parameter from run_ssh_server function
- Remove pg_conn CLI argument from ssh-start command
- Remove non-existent user management API routes
- Add missing dependencies: sysinfo, dirs
- Fix CLI web.rs to pass home directory to server::run
- Fix SSH server stream type (tokio -> std TcpStream)

All compilation errors resolved.
This commit is contained in:
Warren
2026-10-24 20:12:23 +08:00
parent 0802a47a5f
commit 45ae7099d2
7 changed files with 77 additions and 53 deletions
+6 -14
View File
@@ -25,7 +25,6 @@ pub struct SshServerConfig {
pub port: u16,
pub bind_address: String,
pub security_config: SshSecurityConfig,
pub pg_conn: Option<String>,
pub upload_hook_config: crate::config::UploadHookSection,
}
@@ -35,7 +34,6 @@ impl Default for SshServerConfig {
port: 2024,
bind_address: "0.0.0.0".to_string(), // ⭐⭐⭐⭐⭐ Phase 8.3: Allow Docker container access
security_config: SshSecurityConfig::enterprise_default(),
pg_conn: None,
upload_hook_config: crate::config::UploadHookSection::default(),
}
}
@@ -49,7 +47,6 @@ impl SshServerConfig {
port: 2024,
bind_address: "0.0.0.0".to_string(), // ⭐⭐⭐⭐⭐ Phase 8.3: Allow Docker container access
security_config: config,
pg_conn: None,
upload_hook_config: crate::config::UploadHookSection::default(),
})
}
@@ -84,7 +81,6 @@ impl SshServer {
);
let security_config = self.security_config.clone();
let pg_conn = self.config.pg_conn.clone();
let upload_hook_config = self.config.upload_hook_config.clone();
loop {
@@ -93,7 +89,6 @@ impl SshServer {
info!("New SSH connection from {}", addr);
let security_config_clone = security_config.clone();
let pg_conn_clone = pg_conn.clone();
let upload_hook_config_clone = upload_hook_config.clone();
// ⭐⭐⭐⭐⭐ Convert tokio TcpStream to std TcpStream for blocking handler
@@ -104,12 +99,11 @@ impl SshServer {
tokio::spawn(async move {
// Run the existing sync connection handler in a blocking thread
if let Err(e) = tokio::task::spawn_blocking(move || {
handle_connection_complete(
std_stream,
security_config_clone,
pg_conn_clone,
upload_hook_config_clone,
)
handle_connection_complete(
std_stream,
security_config_clone,
upload_hook_config_clone,
)
}).await.unwrap_or(Err(anyhow!("Task join error")))
{
error!("SSH connection error: {}", e);
@@ -128,7 +122,6 @@ impl SshServer {
fn handle_connection_complete(
stream: TcpStream,
security_config: Arc<Mutex<SshSecurityConfig>>,
pg_conn: Option<String>,
upload_hook_config: crate::config::UploadHookSection,
) -> Result<()> {
info!("Handling client connection (Phase 1-13 complete flow with port forwarding)");
@@ -783,12 +776,11 @@ fn extract_username_from_auth_request(
}
/// SSH服务器CLI入口
pub async fn run_ssh_server(port: Option<u16>, pg_conn: Option<&str>) -> Result<()> {
pub async fn run_ssh_server(port: Option<u16>) -> Result<()> {
let config = SshServerConfig {
port: port.unwrap_or(2024),
bind_address: "0.0.0.0".to_string(), // ⭐⭐⭐⭐⭐ Phase 8.3: Allow Docker container access
security_config: SshSecurityConfig::enterprise_default(),
pg_conn: pg_conn.map(|s| s.to_string()),
upload_hook_config: crate::config::UploadHookSection::default(),
};