diff --git a/src/models/response.rs b/src/models/response.rs index 8340c4f0..cbcb3c90 100644 --- a/src/models/response.rs +++ b/src/models/response.rs @@ -32,6 +32,7 @@ pub struct TokenResponse { #[derive(Serialize, Deserialize, Debug)] pub struct NewTorrentResponse { pub torrent_id: i64, + pub info_hash: String, } #[allow(clippy::module_name_repetitions)] diff --git a/src/routes/torrent.rs b/src/routes/torrent.rs index 0f121fd4..b9018bcd 100644 --- a/src/routes/torrent.rs +++ b/src/routes/torrent.rs @@ -133,7 +133,10 @@ pub async fn upload(req: HttpRequest, payload: Multipart, app_data: WebAppData) // respond with the newly uploaded torrent id Ok(HttpResponse::Ok().json(OkResponse { - data: NewTorrentResponse { torrent_id }, + data: NewTorrentResponse { + torrent_id, + info_hash: torrent_request.torrent.info_hash(), + }, })) } @@ -348,12 +351,13 @@ pub async fn delete(req: HttpRequest, app_data: WebAppData) -> ServiceResult