|
|
@ -1,7 +1,7 @@ |
|
|
|
import { IpcClient as TorrentIpc } from "@autoplex-api/torrent"; |
|
|
|
import { IteratorNext, MiddlewareRequest, FastifyReply, Status, respond } from "@autoplex/webserver"; |
|
|
|
import { ISerializedTorrent } from "@autoplex-api/torrent"; |
|
|
|
import Application from "../../../Application"; |
|
|
|
import TorrentIpc from "../../TorrentIpc"; |
|
|
|
|
|
|
|
/** |
|
|
|
* The parameter types for the auth middleware |
|
|
@ -14,7 +14,7 @@ export interface ITorrentMiddleware { |
|
|
|
* Ensure that a valid authentication token is provided |
|
|
|
*/ |
|
|
|
export async function torrent<T extends ITorrentMiddleware>(request: MiddlewareRequest<T>, reply: FastifyReply, next: IteratorNext) { |
|
|
|
let ipc = Application.instance().service<TorrentIpc>("Torrent Client"); |
|
|
|
let ipc = Application.instance().service<TorrentIpc>("Torrent"); |
|
|
|
let torrentId: string|undefined = (<any>request.params)["torrentId"]; |
|
|
|
if (torrentId === undefined) { |
|
|
|
return respond(reply, Status.BadRequest); |
|
|
|