aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2018-06-22 16:29:01 +0200
committerChocobozzz <me@florianbigard.com>2018-06-24 17:42:05 +0200
commit5511da6289e80f91daf5dcb3b632068c02a24ccb (patch)
tree342f4af7cce4433874aab73a18d3cc7ca205c7c9 /client/src/app/videos
parent92d83c6a78e86c66a55958f8e36a7f2e123efdf8 (diff)
downloadPeerTube-5511da6289e80f91daf5dcb3b632068c02a24ccb.tar.gz
PeerTube-5511da6289e80f91daf5dcb3b632068c02a24ccb.tar.zst
PeerTube-5511da6289e80f91daf5dcb3b632068c02a24ccb.zip
Fix #639 providing magnet URI in player and download modal
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-watch/modal/video-download.component.html5
-rw-r--r--client/src/app/videos/+video-watch/modal/video-download.component.ts16
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}