ui sync version

This commit is contained in:
2025-02-28 03:03:04 +08:00
parent f62fea3d2b
commit 82c5885781
18 changed files with 300 additions and 387 deletions

View File

@@ -1,13 +1,5 @@
use std::{io, path::Path};
use app::App;
use base64::{engine::general_purpose::STANDARD, Engine as _};
use session::{
connection::{Connection, ConnectionManager, Connections, ShConnection, SshConnection},
credential::{Credential, CredentialManager, CredentialType},
SessionManager,
};
use util::file;
use color_eyre::Result;
mod app;
mod global;
@@ -15,55 +7,10 @@ mod session;
mod util;
mod view;
fn main() -> io::Result<()> {
fn main() -> Result<()> {
color_eyre::install()?;
let mut terminal = ratatui::init();
let app_result = App::default().run(&mut terminal);
ratatui::restore();
app_result
}
// fn main() -> io::Result<()> {
// // let sh = ShConnection::new("zsh".to_string(), "/usr/bin/nu".to_string(), None);
// // let _ = sh.exec_cmd();
// let ssh = SshConnection::new("".to_string(), "myhost.fallen-angle.com".to_string(), 7044, "rainbus".to_string(), "".to_string());
// ssh.exec_cmd();
// Ok(())
// }
/* fn main() -> io::Result<()> {
let mut cnm = ConnectionManager::default();
let sh = Connections::Sh(ShConnection::new(
"zsh".to_string(),
"/usr/bin/zsh".to_string(),
None,
));
let ssh_sec = Connections::Ssh(SshConnection::new(
"Tencent".to_string(),
"myhost.fallen-angle.com".to_string(),
22,
"rainbus".to_string(),
"Server".to_string(),
));
let ssh_pwd = Connections::Ssh(SshConnection::new(
"Aliyun".to_string(),
"myweb.fallen-angle.com".to_string(),
22,
"rainbus".to_string(),
"AliPwd".to_string(),
));
cnm.connections().extend([sh, ssh_sec, ssh_pwd]);
let mut crm = CredentialManager::default();
let ser_crd = Credential::new(
"Server".to_string(),
CredentialType::Secret(STANDARD.encode(file::read_file(Path::new("")))),
);
let pwd_crd = Credential::new(
"Alipwd".to_string(),
CredentialType::Password("20001001".to_string()),
);
crm.credentials().extend([ser_crd, pwd_crd]);
let sem = SessionManager::new(cnm, crm);
// println!("{}", toml::to_string_pretty(&sem).unwrap());
file::write_file(&global::CONFIG_DIR.join("tethers.toml"), toml::to_string_pretty(&sem).unwrap().as_str());
Ok(())
} */