mirror of
https://github.com/getnora-io/nora.git
synced 2026-04-12 12:40:31 +00:00
style: cargo fmt
DevITWay
This commit is contained in:
@@ -51,7 +51,9 @@ async fn download(
|
||||
"cargo",
|
||||
"LOCAL",
|
||||
));
|
||||
state.audit.log(AuditEntry::new("pull", "api", "", "cargo", ""));
|
||||
state
|
||||
.audit
|
||||
.log(AuditEntry::new("pull", "api", "", "cargo", ""));
|
||||
(StatusCode::OK, data).into_response()
|
||||
}
|
||||
Err(_) => StatusCode::NOT_FOUND.into_response(),
|
||||
|
||||
@@ -312,7 +312,10 @@ async fn upload_blob(
|
||||
StatusCode::CREATED,
|
||||
[
|
||||
(header::LOCATION, location),
|
||||
(HeaderName::from_static("docker-content-digest"), digest.to_string()),
|
||||
(
|
||||
HeaderName::from_static("docker-content-digest"),
|
||||
digest.to_string(),
|
||||
),
|
||||
],
|
||||
)
|
||||
.into_response()
|
||||
@@ -489,7 +492,13 @@ async fn put_manifest(
|
||||
"docker",
|
||||
"LOCAL",
|
||||
));
|
||||
state.audit.log(AuditEntry::new("push", "api", &format!("{}:{}", name, reference), "docker", "manifest"));
|
||||
state.audit.log(AuditEntry::new(
|
||||
"push",
|
||||
"api",
|
||||
&format!("{}:{}", name, reference),
|
||||
"docker",
|
||||
"manifest",
|
||||
));
|
||||
state.repo_index.invalidate("docker");
|
||||
|
||||
let location = format!("/v2/{}/manifests/{}", name, reference);
|
||||
|
||||
@@ -43,7 +43,9 @@ async fn download(State(state): State<Arc<AppState>>, Path(path): Path<String>)
|
||||
"maven",
|
||||
"CACHE",
|
||||
));
|
||||
state.audit.log(AuditEntry::new("cache_hit", "api", "", "maven", ""));
|
||||
state
|
||||
.audit
|
||||
.log(AuditEntry::new("cache_hit", "api", "", "maven", ""));
|
||||
return with_content_type(&path, data).into_response();
|
||||
}
|
||||
|
||||
@@ -60,7 +62,9 @@ async fn download(State(state): State<Arc<AppState>>, Path(path): Path<String>)
|
||||
"maven",
|
||||
"PROXY",
|
||||
));
|
||||
state.audit.log(AuditEntry::new("proxy_fetch", "api", "", "maven", ""));
|
||||
state
|
||||
.audit
|
||||
.log(AuditEntry::new("proxy_fetch", "api", "", "maven", ""));
|
||||
|
||||
let storage = state.storage.clone();
|
||||
let key_clone = key.clone();
|
||||
@@ -106,7 +110,9 @@ async fn upload(
|
||||
"maven",
|
||||
"LOCAL",
|
||||
));
|
||||
state.audit.log(AuditEntry::new("push", "api", "", "maven", ""));
|
||||
state
|
||||
.audit
|
||||
.log(AuditEntry::new("push", "api", "", "maven", ""));
|
||||
state.repo_index.invalidate("maven");
|
||||
StatusCode::CREATED
|
||||
}
|
||||
|
||||
@@ -49,7 +49,9 @@ async fn handle_request(State(state): State<Arc<AppState>>, Path(path): Path<Str
|
||||
"npm",
|
||||
"CACHE",
|
||||
));
|
||||
state.audit.log(AuditEntry::new("cache_hit", "api", "", "npm", ""));
|
||||
state
|
||||
.audit
|
||||
.log(AuditEntry::new("cache_hit", "api", "", "npm", ""));
|
||||
}
|
||||
return with_content_type(is_tarball, data).into_response();
|
||||
}
|
||||
@@ -69,7 +71,9 @@ async fn handle_request(State(state): State<Arc<AppState>>, Path(path): Path<Str
|
||||
"npm",
|
||||
"PROXY",
|
||||
));
|
||||
state.audit.log(AuditEntry::new("proxy_fetch", "api", "", "npm", ""));
|
||||
state
|
||||
.audit
|
||||
.log(AuditEntry::new("proxy_fetch", "api", "", "npm", ""));
|
||||
}
|
||||
|
||||
let storage = state.storage.clone();
|
||||
|
||||
@@ -116,7 +116,9 @@ async fn download_file(
|
||||
"pypi",
|
||||
"CACHE",
|
||||
));
|
||||
state.audit.log(AuditEntry::new("cache_hit", "api", "", "pypi", ""));
|
||||
state
|
||||
.audit
|
||||
.log(AuditEntry::new("cache_hit", "api", "", "pypi", ""));
|
||||
|
||||
let content_type = if filename.ends_with(".whl") {
|
||||
"application/zip"
|
||||
@@ -158,7 +160,9 @@ async fn download_file(
|
||||
"pypi",
|
||||
"PROXY",
|
||||
));
|
||||
state.audit.log(AuditEntry::new("proxy_fetch", "api", "", "pypi", ""));
|
||||
state
|
||||
.audit
|
||||
.log(AuditEntry::new("proxy_fetch", "api", "", "pypi", ""));
|
||||
|
||||
// Cache in local storage
|
||||
let storage = state.storage.clone();
|
||||
|
||||
@@ -36,7 +36,9 @@ async fn download(State(state): State<Arc<AppState>>, Path(path): Path<String>)
|
||||
state
|
||||
.activity
|
||||
.push(ActivityEntry::new(ActionType::Pull, path, "raw", "LOCAL"));
|
||||
state.audit.log(AuditEntry::new("pull", "api", "", "raw", ""));
|
||||
state
|
||||
.audit
|
||||
.log(AuditEntry::new("pull", "api", "", "raw", ""));
|
||||
|
||||
// Guess content type from extension
|
||||
let content_type = guess_content_type(&key);
|
||||
@@ -74,7 +76,9 @@ async fn upload(
|
||||
state
|
||||
.activity
|
||||
.push(ActivityEntry::new(ActionType::Push, path, "raw", "LOCAL"));
|
||||
state.audit.log(AuditEntry::new("push", "api", "", "raw", ""));
|
||||
state
|
||||
.audit
|
||||
.log(AuditEntry::new("push", "api", "", "raw", ""));
|
||||
StatusCode::CREATED.into_response()
|
||||
}
|
||||
Err(_) => StatusCode::INTERNAL_SERVER_ERROR.into_response(),
|
||||
|
||||
Reference in New Issue
Block a user