()
| 4012 | } |
| 4013 | |
| 4014 | pub async fn fetch_admin_comment_runtime_config() -> Result<CommentRuntimeConfig, String> { |
| 4015 | #[cfg(feature = "mock")] |
| 4016 | { |
| 4017 | Ok(CommentRuntimeConfig { |
| 4018 | submit_rate_limit_seconds: 60, |
| 4019 | list_default_limit: 20, |
| 4020 | cleanup_retention_days: -1, |
| 4021 | }) |
| 4022 | } |
| 4023 | |
| 4024 | #[cfg(not(feature = "mock"))] |
| 4025 | { |
| 4026 | let url = format!("{}/admin/comment-config", admin_base()); |
| 4027 | let response = api_get(&url) |
| 4028 | .send() |
| 4029 | .await |
| 4030 | .map_err(|e| format!("Network error: {:?}", e))?; |
| 4031 | if !response.ok() { |
| 4032 | return Err(format!("HTTP error: {}", response.status())); |
| 4033 | } |
| 4034 | response |
| 4035 | .json() |
| 4036 | .await |
| 4037 | .map_err(|e| format!("Parse error: {:?}", e)) |
| 4038 | } |
| 4039 | } |
| 4040 | |
| 4041 | pub async fn update_admin_comment_runtime_config( |
| 4042 | config: &CommentRuntimeConfig, |
no test coverage detected