import { VideoDetails } from '../../../shared/video/video-details.model'
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { I18n } from '@ngx-translate/i18n-polyfill'
-import { Notifier } from '@app/core'
+import { AuthService, Notifier } from '@app/core'
+import { VideoPrivacy } from '@shared/models'
@Component({
selector: 'my-video-download',
constructor (
private notifier: Notifier,
private modalService: NgbModal,
+ private auth: AuthService,
private i18n: I18n
) { }
return
}
+ const suffix = this.video.privacy.id === VideoPrivacy.PRIVATE || this.video.privacy.id === VideoPrivacy.INTERNAL
+ ? '?access_token=' + this.auth.getAccessToken()
+ : ''
+
switch (this.downloadType) {
case 'direct':
- return file.fileDownloadUrl
+ return file.fileDownloadUrl + suffix
case 'torrent':
- return file.torrentDownloadUrl
+ return file.torrentDownloadUrl + suffix
}
}