Browse Source

Add option to remove torrent files to the torrent REST API

dev
David Ludwig 4 years ago
parent
commit
fe50363134
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      services/torrent-rest/src/services/WebServer/routes/api.ts

+ 2
- 1
services/torrent-rest/src/services/WebServer/routes/api.ts View File

@ -71,9 +71,10 @@ export default function register(factory: RouteRegisterFactory<MiddlewareMethod<
* Remove a torrent from the client
*/
factory.delete("/remove/:torrentId", [torrent], async (request, reply) => {
let withData = (<any>request.query)["with_data"] === "1";
let torrent = request.middlewareParams.torrent;
try {
ipc.remove(torrent.infoHash);
ipc.remove(torrent.infoHash, withData);
} catch(e) {
if (e instanceof IpcConnectionError) {
return respond(reply, Status.InternalServerError);


Loading…
Cancel
Save