diff options
Diffstat (limited to 'client')
11 files changed, 34 insertions, 2 deletions
diff --git a/client/src/app/shared/video-import/video-import.service.ts b/client/src/app/shared/video-import/video-import.service.ts index 7ae66ddfc..2163eb905 100644 --- a/client/src/app/shared/video-import/video-import.service.ts +++ b/client/src/app/shared/video-import/video-import.service.ts | |||
@@ -81,6 +81,7 @@ export class VideoImportService { | |||
81 | nsfw: video.nsfw, | 81 | nsfw: video.nsfw, |
82 | waitTranscoding: video.waitTranscoding, | 82 | waitTranscoding: video.waitTranscoding, |
83 | commentsEnabled: video.commentsEnabled, | 83 | commentsEnabled: video.commentsEnabled, |
84 | downloadEnabled: video.downloadEnabled, | ||
84 | thumbnailfile: video.thumbnailfile, | 85 | thumbnailfile: video.thumbnailfile, |
85 | previewfile: video.previewfile, | 86 | previewfile: video.previewfile, |
86 | scheduleUpdate | 87 | scheduleUpdate |
diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts index f44b4138b..388357343 100644 --- a/client/src/app/shared/video/video-details.model.ts +++ b/client/src/app/shared/video/video-details.model.ts | |||
@@ -14,6 +14,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { | |||
14 | files: VideoFile[] | 14 | files: VideoFile[] |
15 | account: Account | 15 | account: Account |
16 | commentsEnabled: boolean | 16 | commentsEnabled: boolean |
17 | downloadEnabled: boolean | ||
17 | 18 | ||
18 | waitTranscoding: boolean | 19 | waitTranscoding: boolean |
19 | state: VideoConstant<VideoState> | 20 | state: VideoConstant<VideoState> |
@@ -35,6 +36,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { | |||
35 | this.tags = hash.tags | 36 | this.tags = hash.tags |
36 | this.support = hash.support | 37 | this.support = hash.support |
37 | this.commentsEnabled = hash.commentsEnabled | 38 | this.commentsEnabled = hash.commentsEnabled |
39 | this.downloadEnabled = hash.downloadEnabled | ||
38 | 40 | ||
39 | this.trackerUrls = hash.trackerUrls | 41 | this.trackerUrls = hash.trackerUrls |
40 | this.streamingPlaylists = hash.streamingPlaylists | 42 | this.streamingPlaylists = hash.streamingPlaylists |
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts index fc772a3cf..18c62a1f9 100644 --- a/client/src/app/shared/video/video-edit.model.ts +++ b/client/src/app/shared/video/video-edit.model.ts | |||
@@ -14,6 +14,7 @@ export class VideoEdit implements VideoUpdate { | |||
14 | tags: string[] | 14 | tags: string[] |
15 | nsfw: boolean | 15 | nsfw: boolean |
16 | commentsEnabled: boolean | 16 | commentsEnabled: boolean |
17 | downloadEnabled: boolean | ||
17 | waitTranscoding: boolean | 18 | waitTranscoding: boolean |
18 | channelId: number | 19 | channelId: number |
19 | privacy: VideoPrivacy | 20 | privacy: VideoPrivacy |
@@ -26,7 +27,15 @@ export class VideoEdit implements VideoUpdate { | |||
26 | id?: number | 27 | id?: number |
27 | scheduleUpdate?: VideoScheduleUpdate | 28 | scheduleUpdate?: VideoScheduleUpdate |
28 | 29 | ||
29 | constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) { | 30 | constructor ( |
31 | video?: Video & { | ||
32 | tags: string[], | ||
33 | commentsEnabled: boolean, | ||
34 | downloadEnabled: boolean, | ||
35 | support: string, | ||
36 | thumbnailUrl: string, | ||
37 | previewUrl: string | ||
38 | }) { | ||
30 | if (video) { | 39 | if (video) { |
31 | this.id = video.id | 40 | this.id = video.id |
32 | this.uuid = video.uuid | 41 | this.uuid = video.uuid |
@@ -38,6 +47,7 @@ export class VideoEdit implements VideoUpdate { | |||
38 | this.tags = video.tags | 47 | this.tags = video.tags |
39 | this.nsfw = video.nsfw | 48 | this.nsfw = video.nsfw |
40 | this.commentsEnabled = video.commentsEnabled | 49 | this.commentsEnabled = video.commentsEnabled |
50 | this.downloadEnabled = video.downloadEnabled | ||
41 | this.waitTranscoding = video.waitTranscoding | 51 | this.waitTranscoding = video.waitTranscoding |
42 | this.channelId = video.channel.id | 52 | this.channelId = video.channel.id |
43 | this.privacy = video.privacy.id | 53 | this.privacy = video.privacy.id |
@@ -80,6 +90,7 @@ export class VideoEdit implements VideoUpdate { | |||
80 | tags: this.tags, | 90 | tags: this.tags, |
81 | nsfw: this.nsfw, | 91 | nsfw: this.nsfw, |
82 | commentsEnabled: this.commentsEnabled, | 92 | commentsEnabled: this.commentsEnabled, |
93 | downloadEnabled: this.downloadEnabled, | ||
83 | waitTranscoding: this.waitTranscoding, | 94 | waitTranscoding: this.waitTranscoding, |
84 | channelId: this.channelId, | 95 | channelId: this.channelId, |
85 | privacy: this.privacy | 96 | privacy: this.privacy |
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 55844f988..565aad93b 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -95,6 +95,7 @@ export class VideoService implements VideosProvider { | |||
95 | nsfw: video.nsfw, | 95 | nsfw: video.nsfw, |
96 | waitTranscoding: video.waitTranscoding, | 96 | waitTranscoding: video.waitTranscoding, |
97 | commentsEnabled: video.commentsEnabled, | 97 | commentsEnabled: video.commentsEnabled, |
98 | downloadEnabled: video.downloadEnabled, | ||
98 | thumbnailfile: video.thumbnailfile, | 99 | thumbnailfile: video.thumbnailfile, |
99 | previewfile: video.previewfile, | 100 | previewfile: video.previewfile, |
100 | scheduleUpdate | 101 | scheduleUpdate |
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.html b/client/src/app/videos/+video-edit/shared/video-edit.component.html index 092c0e862..7fd9af208 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.html | |||
@@ -126,6 +126,11 @@ | |||
126 | ></my-peertube-checkbox> | 126 | ></my-peertube-checkbox> |
127 | 127 | ||
128 | <my-peertube-checkbox | 128 | <my-peertube-checkbox |
129 | inputName="downloadEnabled" formControlName="downloadEnabled" | ||
130 | i18n-labelText labelText="Download enabled" | ||
131 | ></my-peertube-checkbox> | ||
132 | |||
133 | <my-peertube-checkbox | ||
129 | *ngIf="waitTranscodingEnabled" | 134 | *ngIf="waitTranscodingEnabled" |
130 | inputName="waitTranscoding" formControlName="waitTranscoding" | 135 | inputName="waitTranscoding" formControlName="waitTranscoding" |
131 | i18n-labelText labelText="Wait transcoding before publishing the video" | 136 | i18n-labelText labelText="Wait transcoding before publishing the video" |
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts index 85e015901..3ed7a4a10 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts | |||
@@ -81,6 +81,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
81 | const defaultValues: any = { | 81 | const defaultValues: any = { |
82 | nsfw: 'false', | 82 | nsfw: 'false', |
83 | commentsEnabled: 'true', | 83 | commentsEnabled: 'true', |
84 | downloadEnabled: 'true', | ||
84 | waitTranscoding: 'true', | 85 | waitTranscoding: 'true', |
85 | tags: [] | 86 | tags: [] |
86 | } | 87 | } |
@@ -90,6 +91,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
90 | channelId: this.videoValidatorsService.VIDEO_CHANNEL, | 91 | channelId: this.videoValidatorsService.VIDEO_CHANNEL, |
91 | nsfw: null, | 92 | nsfw: null, |
92 | commentsEnabled: null, | 93 | commentsEnabled: null, |
94 | downloadEnabled: null, | ||
93 | waitTranscoding: null, | 95 | waitTranscoding: null, |
94 | category: this.videoValidatorsService.VIDEO_CATEGORY, | 96 | category: this.videoValidatorsService.VIDEO_CATEGORY, |
95 | licence: this.videoValidatorsService.VIDEO_LICENCE, | 97 | licence: this.videoValidatorsService.VIDEO_LICENCE, |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 307806bb9..c12a1d653 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts | |||
@@ -79,6 +79,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
79 | privacy: this.firstStepPrivacyId, | 79 | privacy: this.firstStepPrivacyId, |
80 | waitTranscoding: false, | 80 | waitTranscoding: false, |
81 | commentsEnabled: true, | 81 | commentsEnabled: true, |
82 | downloadEnabled: true, | ||
82 | channelId: this.firstStepChannelId | 83 | channelId: this.firstStepChannelId |
83 | } | 84 | } |
84 | 85 | ||
@@ -93,6 +94,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
93 | 94 | ||
94 | this.video = new VideoEdit(Object.assign(res.video, { | 95 | this.video = new VideoEdit(Object.assign(res.video, { |
95 | commentsEnabled: videoUpdate.commentsEnabled, | 96 | commentsEnabled: videoUpdate.commentsEnabled, |
97 | downloadEnabled: videoUpdate.downloadEnabled, | ||
96 | support: null, | 98 | support: null, |
97 | thumbnailUrl: null, | 99 | thumbnailUrl: null, |
98 | previewUrl: null | 100 | previewUrl: null |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts index 257c6e5db..d11685916 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts | |||
@@ -70,6 +70,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom | |||
70 | privacy: this.firstStepPrivacyId, | 70 | privacy: this.firstStepPrivacyId, |
71 | waitTranscoding: false, | 71 | waitTranscoding: false, |
72 | commentsEnabled: true, | 72 | commentsEnabled: true, |
73 | downloadEnabled: true, | ||
73 | channelId: this.firstStepChannelId | 74 | channelId: this.firstStepChannelId |
74 | } | 75 | } |
75 | 76 | ||
@@ -84,6 +85,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom | |||
84 | 85 | ||
85 | this.video = new VideoEdit(Object.assign(res.video, { | 86 | this.video = new VideoEdit(Object.assign(res.video, { |
86 | commentsEnabled: videoUpdate.commentsEnabled, | 87 | commentsEnabled: videoUpdate.commentsEnabled, |
88 | downloadEnabled: videoUpdate.downloadEnabled, | ||
87 | support: null, | 89 | support: null, |
88 | thumbnailUrl: null, | 90 | thumbnailUrl: null, |
89 | previewUrl: null | 91 | previewUrl: null |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts index e4d54b654..9cadf52cb 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts | |||
@@ -166,6 +166,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
166 | const nsfw = false | 166 | const nsfw = false |
167 | const waitTranscoding = true | 167 | const waitTranscoding = true |
168 | const commentsEnabled = true | 168 | const commentsEnabled = true |
169 | const downloadEnabled = true | ||
169 | const channelId = this.firstStepChannelId.toString() | 170 | const channelId = this.firstStepChannelId.toString() |
170 | 171 | ||
171 | const formData = new FormData() | 172 | const formData = new FormData() |
@@ -174,6 +175,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
174 | formData.append('privacy', VideoPrivacy.PRIVATE.toString()) | 175 | formData.append('privacy', VideoPrivacy.PRIVATE.toString()) |
175 | formData.append('nsfw', '' + nsfw) | 176 | formData.append('nsfw', '' + nsfw) |
176 | formData.append('commentsEnabled', '' + commentsEnabled) | 177 | formData.append('commentsEnabled', '' + commentsEnabled) |
178 | formData.append('downloadEnabled', '' + downloadEnabled) | ||
177 | formData.append('waitTranscoding', '' + waitTranscoding) | 179 | formData.append('waitTranscoding', '' + waitTranscoding) |
178 | formData.append('channelId', '' + channelId) | 180 | formData.append('channelId', '' + channelId) |
179 | formData.append('videofile', videofile) | 181 | formData.append('videofile', videofile) |
diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html index 709eb91a8..1875230d8 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.html +++ b/client/src/app/videos/+video-watch/video-watch.component.html | |||
@@ -82,7 +82,7 @@ | |||
82 | </div> | 82 | </div> |
83 | 83 | ||
84 | <div ngbDropdownMenu> | 84 | <div ngbDropdownMenu> |
85 | <a class="dropdown-item" i18n-title title="Download the video" href="#" (click)="showDownloadModal($event)"> | 85 | <a *ngIf="isVideoDownloadable()" class="dropdown-item" i18n-title title="Download the video" href="#" (click)="showDownloadModal($event)"> |
86 | <my-global-icon iconName="download"></my-global-icon> <ng-container i18n>Download</ng-container> | 86 | <my-global-icon iconName="download"></my-global-icon> <ng-container i18n>Download</ng-container> |
87 | </a> | 87 | </a> |
88 | 88 | ||
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index e801f03ad..4dbfa41e5 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -308,6 +308,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
308 | return this.video && this.video.state.id === VideoState.TO_TRANSCODE | 308 | return this.video && this.video.state.id === VideoState.TO_TRANSCODE |
309 | } | 309 | } |
310 | 310 | ||
311 | isVideoDownloadable () { | ||
312 | return this.video && this.video.downloadEnabled | ||
313 | } | ||
314 | |||
311 | isVideoToImport () { | 315 | isVideoToImport () { |
312 | return this.video && this.video.state.id === VideoState.TO_IMPORT | 316 | return this.video && this.video.state.id === VideoState.TO_IMPORT |
313 | } | 317 | } |