From 90dcfdd8b81948fa9aabf9ea36761e7d7bc1061b Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sat, 21 Mar 2026 18:44:56 +0800 Subject: Remove legacy modules and unused dependencies --- src/data/ipaddress_history.rs | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 src/data/ipaddress_history.rs (limited to 'src/data') diff --git a/src/data/ipaddress_history.rs b/src/data/ipaddress_history.rs deleted file mode 100644 index 142797d..0000000 --- a/src/data/ipaddress_history.rs +++ /dev/null @@ -1,34 +0,0 @@ -use just_enough_vcs::lib::env::current_cfg_dir; - -const IP_HISTORY_NAME: &str = "ip_history.txt"; - -pub struct IpAddressHistory { - pub recent_ip_address: Vec, -} - -pub async fn get_recent_ip_address() -> Vec { - if let Some(local) = current_cfg_dir() { - let path = local.join(IP_HISTORY_NAME); - match tokio::fs::read_to_string(path).await { - Ok(content) => content.lines().map(String::from).collect(), - Err(_) => Vec::new(), - } - } else { - Vec::new() - } -} - -pub async fn insert_recent_ip_address(ip: impl Into) { - let ip = ip.into(); - if let Some(local) = current_cfg_dir() { - let path = local.join(IP_HISTORY_NAME); - let mut recent_ips = get_recent_ip_address().await; - recent_ips.retain(|existing_ip| existing_ip != &ip); - recent_ips.insert(0, ip); - if recent_ips.len() > 8 { - recent_ips.truncate(8); - } - let content = recent_ips.join("\n"); - let _ = tokio::fs::write(path, content).await; - } -} -- cgit