style: cargo fmt

This commit is contained in:
2026-03-16 08:58:27 +00:00
parent a9996b6b54
commit b2be7102fe
2 changed files with 28 additions and 32 deletions

View File

@@ -179,35 +179,36 @@ async fn build_docker_index(storage: &Storage) -> Vec<RepoInfo> {
let name = rest[..manifests_pos].to_string(); let name = rest[..manifests_pos].to_string();
let after_manifests = &rest[manifests_pos + "/manifests/".len()..]; let after_manifests = &rest[manifests_pos + "/manifests/".len()..];
if !after_manifests.is_empty() && key.ends_with(".json") { if !after_manifests.is_empty() && key.ends_with(".json") {
let entry = repos.entry(name).or_insert((0, 0, 0)); let entry = repos.entry(name).or_insert((0, 0, 0));
entry.0 += 1; entry.0 += 1;
if let Ok(data) = storage.get(key).await { if let Ok(data) = storage.get(key).await {
if let Ok(m) = serde_json::from_slice::<serde_json::Value>(&data) { if let Ok(m) = serde_json::from_slice::<serde_json::Value>(&data) {
let cfg = m let cfg = m
.get("config") .get("config")
.and_then(|c| c.get("size")) .and_then(|c| c.get("size"))
.and_then(|s| s.as_u64()) .and_then(|s| s.as_u64())
.unwrap_or(0); .unwrap_or(0);
let layers: u64 = m let layers: u64 = m
.get("layers") .get("layers")
.and_then(|l| l.as_array()) .and_then(|l| l.as_array())
.map(|arr| { .map(|arr| {
arr.iter() arr.iter()
.filter_map(|l| l.get("size").and_then(|s| s.as_u64())) .filter_map(|l| l.get("size").and_then(|s| s.as_u64()))
.sum() .sum()
}) })
.unwrap_or(0); .unwrap_or(0);
entry.1 += cfg + layers; entry.1 += cfg + layers;
}
}
if let Some(meta) = storage.stat(key).await {
if meta.modified > entry.2 {
entry.2 = meta.modified;
}
} }
} }
}
if let Some(meta) = storage.stat(key).await {
if meta.modified > entry.2 {
entry.2 = meta.modified;
}
}
}}
} }
} }

View File

@@ -200,12 +200,7 @@ pub async fn api_dashboard(State(state): State<Arc<AppState>>) -> Json<Dashboard
MountPoint { MountPoint {
registry: "Docker".to_string(), registry: "Docker".to_string(),
mount_path: "/v2/".to_string(), mount_path: "/v2/".to_string(),
proxy_upstream: state proxy_upstream: state.config.docker.upstreams.first().map(|u| u.url.clone()),
.config
.docker
.upstreams
.first()
.map(|u| u.url.clone()),
}, },
MountPoint { MountPoint {
registry: "Maven".to_string(), registry: "Maven".to_string(),