From 3a19a207f3871817a36df57b52a778b1a0e257fa Mon Sep 17 00:00:00 2001 From: syui Date: Sun, 18 Feb 2024 23:38:33 +0900 Subject: [PATCH] rm password --- src/data.rs | 12 +++--------- src/main.rs | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/data.rs b/src/data.rs index abf8816..97ae952 100644 --- a/src/data.rs +++ b/src/data.rs @@ -84,7 +84,6 @@ pub struct Token { #[allow(non_snake_case)] pub struct Data { pub host: String, - pub password: String, pub did: String, pub handle: String, pub access: String, @@ -130,7 +129,6 @@ pub fn url(s: &str) -> String { let data = Data::new().unwrap(); let data = Data { host: data.host, - password: data.password, handle: data.handle, did: data.did, access: data.access, @@ -196,7 +194,6 @@ pub fn data_toml(s: &str) -> String { let data = Data::new().unwrap(); let data = Data { host: data.host, - password: data.password, handle: data.handle, did: data.did, access: data.access, @@ -204,7 +201,6 @@ pub fn data_toml(s: &str) -> String { }; match &*s { "host" => data.handle, - "password" => data.password, "handle" => data.handle, "did" => data.did, "access" => data.access, @@ -230,17 +226,16 @@ pub fn data_refresh(s: &str) -> String { let data = Data::new().unwrap(); let data = Data { host: data.host, - password: data.password, handle: data.handle, did: data.did, access: data.access, refresh: data.refresh, }; - let mut _file = match Refresh::new() + let mut _file = match Refresh::new() { Err(_why) => c_refresh(&data.access, &data.refresh), - Ok(_) => println!("ok"), + Ok(_) => println!(""), }; let refresh = Refresh::new().unwrap(); let refresh = Refresh { @@ -521,7 +516,7 @@ pub fn c_char(i: String) -> String { return s; } -pub fn w_cfg(h: &str, res: &str, password: &str) { +pub fn w_cfg(h: &str, res: &str) { let f = data_file(&"json"); let ff = data_file(&"toml"); let mut f = fs::File::create(f.clone()).unwrap(); @@ -530,7 +525,6 @@ pub fn w_cfg(h: &str, res: &str, password: &str) { let json: Token = serde_json::from_str(&res).unwrap(); let datas = Data { host: h.to_string(), - password: password.to_string(), did: json.did.to_string(), handle: json.handle.to_string(), access: json.accessJwt.to_string(), diff --git a/src/main.rs b/src/main.rs index f07d783..bea1c57 100644 --- a/src/main.rs +++ b/src/main.rs @@ -282,13 +282,13 @@ fn token(c: &Context) { if let Ok(p) = c.string_flag("password") { if let Ok(s) = c.string_flag("server") { let res = token::post_request(m.to_string(), p.to_string(), s.to_string()).await; - w_cfg(&s, &res, &p); + w_cfg(&s, &res); w_refresh(&res); } else { let res = token::post_request(m.to_string(), p.to_string(), "bsky.social".to_string()) .await; - w_cfg(&"bsky.social", &res, &p); + w_cfg(&"bsky.social", &res); w_refresh(&res); } }