(auth_token: &str)
| 158 | } |
| 159 | |
| 160 | pub(crate) async fn store_auth_token(auth_token: &str) { |
| 161 | if let Some(auth_file) = |
| 162 | dirs::config_local_dir().map(|dir| dir.join("autokuma").join("auth.txt")) |
| 163 | { |
| 164 | _ = std::fs::create_dir_all(auth_file.parent().unwrap()); |
| 165 | |
| 166 | if let Err(err) = fs::write(auth_file, auth_token).await { |
| 167 | warn!("Failed to store auth token: {}", err); |
| 168 | } |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | pub(crate) async fn load_auth_token() -> Option<String> { |
| 173 | if let Some(auth_file) = |