(json: &serde_json::Value)
| 356 | } |
| 357 | |
| 358 | fn parse_wp_plugins(json: &serde_json::Value) -> Vec<WPPlugin> { |
| 359 | let mut plugins = Vec::new(); |
| 360 | |
| 361 | if let Some(plugins_obj) = json.get("plugins").and_then(|p| p.as_object()) { |
| 362 | for (slug, plugin_data) in plugins_obj { |
| 363 | let version = plugin_data |
| 364 | .get("version") |
| 365 | .and_then(|v| v.as_str()) |
| 366 | .map(|s| s.to_string()); |
| 367 | |
| 368 | let outdated = plugin_data |
| 369 | .get("outdated") |
| 370 | .and_then(|v| v.as_bool()) |
| 371 | .unwrap_or(false); |
| 372 | |
| 373 | let vulnerabilities = parse_vulns_array( |
| 374 | plugin_data.get("vulnerabilities"), |
| 375 | slug, |
| 376 | ); |
| 377 | |
| 378 | plugins.push(WPPlugin { |
| 379 | slug: slug.clone(), |
| 380 | version, |
| 381 | outdated, |
| 382 | vulnerabilities, |
| 383 | }); |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | plugins |
| 388 | } |
| 389 | |
| 390 | fn parse_wp_themes(json: &serde_json::Value) -> Vec<WPTheme> { |
| 391 | let mut themes = Vec::new(); |
no test coverage detected