diff options
Diffstat (limited to 'client/src/app/videos')
-rw-r--r-- | client/src/app/videos/+video-watch/modal/video-download.component.html | 5 | ||||
-rw-r--r-- | client/src/app/videos/+video-watch/modal/video-download.component.ts | 16 |
2 files changed, 19 insertions, 2 deletions
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 @@ | |||
24 | <input type="radio" name="download" id="download-direct" [(ngModel)]="downloadType" value="direct"> | 24 | <input type="radio" name="download" id="download-direct" [(ngModel)]="downloadType" value="direct"> |
25 | <label i18n for="download-direct">Direct download</label> | 25 | <label i18n for="download-direct">Direct download</label> |
26 | </div> | 26 | </div> |
27 | |||
28 | <div class="peertube-radio-container"> | ||
29 | <input type="radio" name="download" id="download-magnet" [(ngModel)]="downloadType" value="magnet"> | ||
30 | <label i18n for="download-magnet">Torrent (magnet)</label> | ||
31 | </div> | ||
27 | </div> | 32 | </div> |
28 | 33 | ||
29 | <div class="form-group inputs"> | 34 | <div class="form-group inputs"> |
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 { | |||
12 | 12 | ||
13 | @ViewChild('modal') modal: ModalDirective | 13 | @ViewChild('modal') modal: ModalDirective |
14 | 14 | ||
15 | downloadType: 'direct' | 'torrent' = 'torrent' | 15 | downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent' |
16 | resolutionId: number | string = -1 | 16 | resolutionId: number | string = -1 |
17 | 17 | ||
18 | constructor () { | 18 | constructor () { |
@@ -41,7 +41,19 @@ export class VideoDownloadComponent implements OnInit { | |||
41 | return | 41 | return |
42 | } | 42 | } |
43 | 43 | ||
44 | const link = this.downloadType === 'direct' ? file.fileDownloadUrl : file.torrentDownloadUrl | 44 | const link = (() => { |
45 | switch (this.downloadType) { | ||
46 | case 'direct': { | ||
47 | return file.fileDownloadUrl | ||
48 | } | ||
49 | case 'torrent': { | ||
50 | return file.torrentDownloadUrl | ||
51 | } | ||
52 | case 'magnet': { | ||
53 | return file.magnetUri | ||
54 | } | ||
55 | } | ||
56 | })() | ||
45 | window.location.assign(link) | 57 | window.location.assign(link) |
46 | } | 58 | } |
47 | } | 59 | } |