From d61893f7236abbed30c25b1823e6ecad93a8e8dd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 25 Feb 2021 13:56:07 +0100 Subject: Async torrent creation --- server/models/video/video-file.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'server/models/video/video-file.ts') diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index 4df2c20bc..1ad796104 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts @@ -457,18 +457,26 @@ export class VideoFileModel extends Model { // We proxify torrent requests so use a local URL getTorrentUrl () { + if (!this.torrentFilename) return null + return WEBSERVER.URL + this.getTorrentStaticPath() } getTorrentStaticPath () { + if (!this.torrentFilename) return null + return join(LAZY_STATIC_PATHS.TORRENTS, this.torrentFilename) } getTorrentDownloadUrl () { + if (!this.torrentFilename) return null + return WEBSERVER.URL + join(STATIC_DOWNLOAD_PATHS.TORRENTS, this.torrentFilename) } removeTorrent () { + if (!this.torrentFilename) return null + const torrentPath = getTorrentFilePath(this) return remove(torrentPath) .catch(err => logger.warn('Cannot delete torrent %s.', torrentPath, { err })) -- cgit v1.2.3