From 5511da6289e80f91daf5dcb3b632068c02a24ccb Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Fri, 22 Jun 2018 16:29:01 +0200 Subject: Fix #639 providing magnet URI in player and download modal --- .../+video-watch/modal/video-download.component.html | 5 +++++ .../+video-watch/modal/video-download.component.ts | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'client/src/app/videos/+video-watch') diff --git a/client/src/app/videos/+video-watch/modal/video-download.component.html b/client/src/app/videos/+video-watch/modal/video-download.component.html index d30a49345..316bd635c 100644 --- a/client/src/app/videos/+video-watch/modal/video-download.component.html +++ b/client/src/app/videos/+video-watch/modal/video-download.component.html @@ -24,6 +24,11 @@ + +
+ + +
diff --git a/client/src/app/videos/+video-watch/modal/video-download.component.ts b/client/src/app/videos/+video-watch/modal/video-download.component.ts index 12f31b011..2de706e47 100644 --- a/client/src/app/videos/+video-watch/modal/video-download.component.ts +++ b/client/src/app/videos/+video-watch/modal/video-download.component.ts @@ -12,7 +12,7 @@ export class VideoDownloadComponent implements OnInit { @ViewChild('modal') modal: ModalDirective - downloadType: 'direct' | 'torrent' = 'torrent' + downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent' resolutionId: number | string = -1 constructor () { @@ -41,7 +41,19 @@ export class VideoDownloadComponent implements OnInit { return } - const link = this.downloadType === 'direct' ? file.fileDownloadUrl : file.torrentDownloadUrl + const link = (() => { + switch (this.downloadType) { + case 'direct': { + return file.fileDownloadUrl + } + case 'torrent': { + return file.torrentDownloadUrl + } + case 'magnet': { + return file.magnetUri + } + } + })() window.location.assign(link) } } -- cgit v1.2.3