Well, it doesnt crash at least

This commit is contained in:
Igor Katson 2024-03-30 17:55:43 +00:00
parent 276a1e175e
commit efcffdd072
6 changed files with 101 additions and 21 deletions

View file

@ -181,6 +181,21 @@ impl HttpApi {
state.api_torrent_action_delete(idx).map(axum::Json)
}
#[derive(Deserialize)]
struct UpdateOnlyFilesRequest {
only_files: Vec<usize>,
}
async fn torrent_action_update_only_files(
State(state): State<ApiState>,
Path(idx): Path<usize>,
axum::Json(req): axum::Json<UpdateOnlyFilesRequest>,
) -> Result<impl IntoResponse> {
state
.api_torrent_action_update_only_files(idx, &req.only_files.into_iter().collect())
.map(axum::Json)
}
async fn set_rust_log(
State(state): State<ApiState>,
new_value: String,
@ -215,7 +230,11 @@ impl HttpApi {
.route("/torrents/:id/pause", post(torrent_action_pause))
.route("/torrents/:id/start", post(torrent_action_start))
.route("/torrents/:id/forget", post(torrent_action_forget))
.route("/torrents/:id/delete", post(torrent_action_delete));
.route("/torrents/:id/delete", post(torrent_action_delete))
.route(
"/torrents/:id/update_only_files",
post(torrent_action_update_only_files),
);
}
#[cfg(feature = "webui")]