From 1c9133be32345593b64cb4fff7fe28206adb3fb8 Mon Sep 17 00:00:00 2001 From: KunoiSayami Date: Fri, 30 Aug 2024 19:55:36 +0800 Subject: chore: Update crates Signed-off-by: KunoiSayami --- src/main.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index de94789..5b10e01 100644 --- a/src/main.rs +++ b/src/main.rs @@ -71,12 +71,12 @@ impl IOModule { if ret.unwrap_or(false) { let redis_conn = redis::Client::open("redis://127.0.0.1/")?; let cookie = Cookie::generate(data.get_user()); - let mut conn = redis_conn.get_async_connection().await?; + let mut conn = redis_conn.get_multiplexed_async_connection().await?; conn.set_ex::<_, _, String>( format!("cgit_auth_{}", cookie.get_key()), cookie.get_body(), - cfg.get_config().cookie_ttl as usize, + cfg.get_config().cookie_ttl as u64, ) .await?; @@ -143,7 +143,7 @@ async fn cmd_authenticate_cookie(matches: &ArgMatches, cfg: Config) -> Result Result( format!("cgit_auth_{}", cookie.get_key()), - cfg.cookie_ttl as usize, + cfg.cookie_ttl as i64, ) .await?; if cookie.eq_body(r.as_str()) { @@ -477,7 +477,7 @@ async fn cmd_repo_user_control(matches: &ArgMatches, cfg: Config, is_delete: boo let user = matches .get_one::("user") .map(|s| s.as_str()) - .unwrap_or(""); + .unwrap_or_default(); let clear_all = is_delete && matches.contains_id("clear-all"); @@ -489,7 +489,7 @@ async fn cmd_repo_user_control(matches: &ArgMatches, cfg: Config, is_delete: boo } let redis_client = redis::Client::open("redis://127.0.0.1/")?; - let mut redis_conn = redis_client.get_async_connection().await?; + let mut redis_conn = redis_client.get_multiplexed_async_connection().await?; let mut conn = SqliteConnection::connect(cfg.get_database_location()).await?; @@ -555,11 +555,9 @@ async fn cmd_repo_user_control(matches: &ArgMatches, cfg: Config, is_delete: boo if !clear_all { println!( - "{} user {} {} repository {} ACL successful", + "{} user {user} {} repository {repo} ACL successful", if is_delete { "Delete" } else { "Add" }, - user, if is_delete { "from" } else { "to" }, - repo, ); } else { println!("Clear all users from repository {} ACL", repo); -- cgit v1.3.1