diff --git a/src-tauri/src/proxy.rs b/src-tauri/src/proxy.rs index b622b4b..ed8c5f4 100644 --- a/src-tauri/src/proxy.rs +++ b/src-tauri/src/proxy.rs @@ -1154,6 +1154,16 @@ async fn get_admin_config_handler() -> Response { async fn save_admin_config_handler(axum::extract::Json(payload): axum::extract::Json) -> Response { let config_path = get_admin_config_path(); + + // Create parent directory if it doesn't exist + if let Some(parent) = config_path.parent() { + if !parent.exists() { + if let Err(e) = std::fs::create_dir_all(parent) { + return (StatusCode::INTERNAL_SERVER_ERROR, format!("Create dir failed: {}", e)).into_response(); + } + } + } + match serde_json::to_string_pretty(&payload) { Ok(formatted) => { match std::fs::write(&config_path, formatted) {