diff options
author | Chocobozzz <me@florianbigard.com> | 2019-12-03 10:41:23 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-12-03 10:41:23 +0100 |
commit | eccf70f020cb8b0d9ceddc2561713ccfddb72095 (patch) | |
tree | bae9d9285a00c2958666becbb50427cabcea7aed /client/src/app/shared/video | |
parent | 3f6b7aa1cfa28ee02eec8c8ab16b623f2bbab928 (diff) | |
download | PeerTube-eccf70f020cb8b0d9ceddc2561713ccfddb72095.tar.gz PeerTube-eccf70f020cb8b0d9ceddc2561713ccfddb72095.tar.zst PeerTube-eccf70f020cb8b0d9ceddc2561713ccfddb72095.zip |
Fix private video download
Diffstat (limited to 'client/src/app/shared/video')
-rw-r--r-- | client/src/app/shared/video/modals/video-download.component.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/client/src/app/shared/video/modals/video-download.component.ts b/client/src/app/shared/video/modals/video-download.component.ts index 0e9e44de7..5849ee458 100644 --- a/client/src/app/shared/video/modals/video-download.component.ts +++ b/client/src/app/shared/video/modals/video-download.component.ts | |||
@@ -2,7 +2,8 @@ import { Component, ElementRef, ViewChild } from '@angular/core' | |||
2 | import { VideoDetails } from '../../../shared/video/video-details.model' | 2 | import { VideoDetails } from '../../../shared/video/video-details.model' |
3 | import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | 4 | import { I18n } from '@ngx-translate/i18n-polyfill' |
5 | import { Notifier } from '@app/core' | 5 | import { AuthService, Notifier } from '@app/core' |
6 | import { VideoPrivacy } from '@shared/models' | ||
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
8 | selector: 'my-video-download', | 9 | selector: 'my-video-download', |
@@ -21,6 +22,7 @@ export class VideoDownloadComponent { | |||
21 | constructor ( | 22 | constructor ( |
22 | private notifier: Notifier, | 23 | private notifier: Notifier, |
23 | private modalService: NgbModal, | 24 | private modalService: NgbModal, |
25 | private auth: AuthService, | ||
24 | private i18n: I18n | 26 | private i18n: I18n |
25 | ) { } | 27 | ) { } |
26 | 28 | ||
@@ -57,12 +59,16 @@ export class VideoDownloadComponent { | |||
57 | return | 59 | return |
58 | } | 60 | } |
59 | 61 | ||
62 | const suffix = this.video.privacy.id === VideoPrivacy.PRIVATE | ||
63 | ? '?access_token=' + this.auth.getAccessToken() | ||
64 | : '' | ||
65 | |||
60 | switch (this.downloadType) { | 66 | switch (this.downloadType) { |
61 | case 'direct': | 67 | case 'direct': |
62 | return file.fileDownloadUrl | 68 | return file.fileDownloadUrl + suffix |
63 | 69 | ||
64 | case 'torrent': | 70 | case 'torrent': |
65 | return file.torrentDownloadUrl | 71 | return file.torrentDownloadUrl + suffix |
66 | } | 72 | } |
67 | } | 73 | } |
68 | 74 | ||