Skip to content

Commit

Permalink
user-ingest: Accept list of salts
Browse files Browse the repository at this point in the history
  • Loading branch information
raimannma committed Oct 28, 2024
1 parent e92a32f commit a8aa770
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions user-ingest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,20 @@ pub struct SaltsResponse {

pub async fn post_salts(
State(state): State<AppState>,
Json(salts): Json<Salts>,
) -> Result<Json<SaltsResponse>, StatusCode> {
Json(salts): Json<Vec<Salts>>,
) -> Result<(), StatusCode> {
debug!("Received Salts: {:?}", salts);
let salts = match download::check_salts(salts.clone()).await {
Ok(salts) => salts,
Err(e) => {
error!("Failed to validate salts: {:?}", e);
for salt in salts {
let salts = match download::check_salts(salt.clone()).await {
Ok(salts) => salts,
Err(e) => {
error!("Failed to validate salts: {:?}", e);
return Err(StatusCode::INTERNAL_SERVER_ERROR);
}
};
if state.salts_channel.send(salts.clone()).await.is_err() {
return Err(StatusCode::INTERNAL_SERVER_ERROR);
}
};
if state.salts_channel.send(salts.clone()).await.is_err() {
return Err(StatusCode::INTERNAL_SERVER_ERROR);
}
Ok(Json(SaltsResponse {
meta: salts.metadata_salt.is_some(),
replay: salts.replay_salt.is_some(),
}))
Ok(())
}

0 comments on commit a8aa770

Please sign in to comment.