1
0

rm password

This commit is contained in:
syui 2024-02-18 23:38:33 +09:00
parent 83c234e8af
commit 7a52198c72
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
2 changed files with 3 additions and 9 deletions

View File

@ -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,7 +226,6 @@ 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,
@ -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(),

View File

@ -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);
}
}