aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts10
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.html2
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.ts21
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-send.ts13
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts5
-rw-r--r--client/src/app/videos/+video-edit/video-add.component.ts17
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts16
-rw-r--r--client/src/app/videos/video-list/video-most-liked.component.ts7
-rw-r--r--client/src/app/videos/video-list/video-trending.component.ts6
9 files changed, 63 insertions, 34 deletions
diff --git a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts
index 86c6e03e7..1a9bf5171 100644
--- a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts
+++ b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts
@@ -5,7 +5,7 @@ import { VideoCaptionsValidatorsService } from '@app/shared/forms/form-validator
5import { ServerService } from '@app/core' 5import { ServerService } from '@app/core'
6import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' 6import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
7import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' 7import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
8import { VideoConstant } from '../../../../../../shared' 8import { ServerConfig, VideoConstant } from '../../../../../../shared'
9 9
10@Component({ 10@Component({
11 selector: 'my-video-caption-add-modal', 11 selector: 'my-video-caption-add-modal',
@@ -15,6 +15,7 @@ import { VideoConstant } from '../../../../../../shared'
15 15
16export class VideoCaptionAddModalComponent extends FormReactive implements OnInit { 16export class VideoCaptionAddModalComponent extends FormReactive implements OnInit {
17 @Input() existingCaptions: string[] 17 @Input() existingCaptions: string[]
18 @Input() serverConfig: ServerConfig
18 19
19 @Output() captionAdded = new EventEmitter<VideoCaptionEdit>() 20 @Output() captionAdded = new EventEmitter<VideoCaptionEdit>()
20 21
@@ -35,15 +36,16 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni
35 } 36 }
36 37
37 get videoCaptionExtensions () { 38 get videoCaptionExtensions () {
38 return this.serverService.getConfig().videoCaption.file.extensions 39 return this.serverConfig.videoCaption.file.extensions
39 } 40 }
40 41
41 get videoCaptionMaxSize () { 42 get videoCaptionMaxSize () {
42 return this.serverService.getConfig().videoCaption.file.size.max 43 return this.serverConfig.videoCaption.file.size.max
43 } 44 }
44 45
45 ngOnInit () { 46 ngOnInit () {
46 this.videoCaptionLanguages = this.serverService.getVideoLanguages() 47 this.serverService.getVideoLanguages()
48 .subscribe(languages => this.videoCaptionLanguages = languages)
47 49
48 this.buildForm({ 50 this.buildForm({
49 language: this.videoCaptionsValidatorsService.VIDEO_CAPTION_LANGUAGE, 51 language: this.videoCaptionsValidatorsService.VIDEO_CAPTION_LANGUAGE,
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 e2a222037..e40649d95 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
@@ -269,5 +269,5 @@
269</div> 269</div>
270 270
271<my-video-caption-add-modal 271<my-video-caption-add-modal
272 #videoCaptionAddModal [existingCaptions]="existingCaptions" (captionAdded)="onCaptionAdded($event)" 272 #videoCaptionAddModal [existingCaptions]="existingCaptions" [serverConfig]="serverConfig" (captionAdded)="onCaptionAdded($event)"
273></my-video-caption-add-modal> 273></my-video-caption-add-modal>
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 d0d5e2a2b..982e071ad 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
@@ -12,7 +12,7 @@ import { VideoCaptionService } from '@app/shared/video-caption'
12import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component' 12import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component'
13import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' 13import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
14import { removeElementFromArray } from '@app/shared/misc/utils' 14import { removeElementFromArray } from '@app/shared/misc/utils'
15import { VideoConstant, VideoPrivacy } from '../../../../../../shared' 15import { ServerConfig, VideoConstant, VideoPrivacy } from '../../../../../../shared'
16import { VideoService } from '@app/shared/video/video.service' 16import { VideoService } from '@app/shared/video/video.service'
17 17
18@Component({ 18@Component({
@@ -51,6 +51,8 @@ export class VideoEditComponent implements OnInit, OnDestroy {
51 calendarTimezone: string 51 calendarTimezone: string
52 calendarDateFormat: string 52 calendarDateFormat: string
53 53
54 serverConfig: ServerConfig
55
54 private schedulerInterval: any 56 private schedulerInterval: any
55 private firstPatchDone = false 57 private firstPatchDone = false
56 private initialVideoCaptions: string[] = [] 58 private initialVideoCaptions: string[] = []
@@ -130,12 +132,19 @@ export class VideoEditComponent implements OnInit, OnDestroy {
130 ngOnInit () { 132 ngOnInit () {
131 this.updateForm() 133 this.updateForm()
132 134
133 this.videoCategories = this.serverService.getVideoCategories() 135 this.serverService.getVideoCategories()
134 this.videoLicences = this.serverService.getVideoLicences() 136 .subscribe(res => this.videoCategories = res)
135 this.videoLanguages = this.serverService.getVideoLanguages() 137 this.serverService.getVideoLicences()
138 .subscribe(res => this.videoLicences = res)
139 this.serverService.getVideoLanguages()
140 .subscribe(res => this.videoLanguages = res)
141
142 this.serverService.getVideoPrivacies()
143 .subscribe(privacies => this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies))
136 144
137 const privacies = this.serverService.getVideoPrivacies() 145 this.serverConfig = this.serverService.getTmpConfig()
138 this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies) 146 this.serverService.getConfig()
147 .subscribe(config => this.serverConfig = config)
139 148
140 this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id) 149 this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id)
141 150
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts
index 580c123a0..b32f16950 100644
--- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts
+++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts
@@ -3,7 +3,7 @@ import { LoadingBarService } from '@ngx-loading-bar/core'
3import { AuthService, Notifier, ServerService } from '@app/core' 3import { AuthService, Notifier, ServerService } from '@app/core'
4import { catchError, switchMap, tap } from 'rxjs/operators' 4import { catchError, switchMap, tap } from 'rxjs/operators'
5import { FormReactive } from '@app/shared' 5import { FormReactive } from '@app/shared'
6import { VideoConstant, VideoPrivacy } from '../../../../../../shared' 6import { ServerConfig, VideoConstant, VideoPrivacy } from '../../../../../../shared'
7import { VideoService } from '@app/shared/video/video.service' 7import { VideoService } from '@app/shared/video/video.service'
8import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' 8import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
9import { VideoCaptionService } from '@app/shared/video-caption' 9import { VideoCaptionService } from '@app/shared/video-caption'
@@ -29,6 +29,7 @@ export abstract class VideoSend extends FormReactive implements OnInit {
29 protected serverService: ServerService 29 protected serverService: ServerService
30 protected videoService: VideoService 30 protected videoService: VideoService
31 protected videoCaptionService: VideoCaptionService 31 protected videoCaptionService: VideoCaptionService
32 protected serverConfig: ServerConfig
32 33
33 abstract canDeactivate (): CanComponentDeactivateResult 34 abstract canDeactivate (): CanComponentDeactivateResult
34 35
@@ -38,10 +39,14 @@ export abstract class VideoSend extends FormReactive implements OnInit {
38 populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) 39 populateAsyncUserVideoChannels(this.authService, this.userVideoChannels)
39 .then(() => this.firstStepChannelId = this.userVideoChannels[ 0 ].id) 40 .then(() => this.firstStepChannelId = this.userVideoChannels[ 0 ].id)
40 41
41 this.serverService.videoPrivaciesLoaded 42 this.serverConfig = this.serverService.getTmpConfig()
43 this.serverService.getConfig()
44 .subscribe(config => this.serverConfig = config)
45
46 this.serverService.getVideoPrivacies()
42 .subscribe( 47 .subscribe(
43 () => { 48 privacies => {
44 this.videoPrivacies = this.serverService.getVideoPrivacies() 49 this.videoPrivacies = privacies
45 50
46 this.firstStepPrivacyId = this.DEFAULT_VIDEO_PRIVACY 51 this.firstStepPrivacyId = this.DEFAULT_VIDEO_PRIVACY
47 }) 52 })
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 23b79edd3..28e10e562 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
@@ -14,6 +14,7 @@ import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.
14import { FormValidatorService, UserService } from '@app/shared' 14import { FormValidatorService, UserService } from '@app/shared'
15import { VideoCaptionService } from '@app/shared/video-caption' 15import { VideoCaptionService } from '@app/shared/video-caption'
16import { scrollToTop } from '@app/shared/misc/utils' 16import { scrollToTop } from '@app/shared/misc/utils'
17import { ServerConfig } from '@shared/models'
17 18
18@Component({ 19@Component({
19 selector: 'my-video-upload', 20 selector: 'my-video-upload',
@@ -70,7 +71,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
70 } 71 }
71 72
72 get videoExtensions () { 73 get videoExtensions () {
73 return this.serverService.getConfig().video.file.extensions.join(',') 74 return this.serverConfig.video.file.extensions.join(',')
74 } 75 }
75 76
76 ngOnInit () { 77 ngOnInit () {
@@ -155,7 +156,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
155 } 156 }
156 157
157 const privacy = this.firstStepPrivacyId.toString() 158 const privacy = this.firstStepPrivacyId.toString()
158 const nsfw = this.serverService.getConfig().instance.isNSFW 159 const nsfw = this.serverConfig.instance.isNSFW
159 const waitTranscoding = true 160 const waitTranscoding = true
160 const commentsEnabled = true 161 const commentsEnabled = true
161 const downloadEnabled = true 162 const downloadEnabled = true
diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts
index 911bc884e..401d8a08f 100644
--- a/client/src/app/videos/+video-edit/video-add.component.ts
+++ b/client/src/app/videos/+video-edit/video-add.component.ts
@@ -1,28 +1,37 @@
1import { Component, HostListener, ViewChild } from '@angular/core' 1import { Component, HostListener, OnInit, ViewChild } from '@angular/core'
2import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' 2import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service'
3import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component' 3import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component'
4import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component' 4import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component'
5import { AuthService, ServerService } from '@app/core' 5import { AuthService, ServerService } from '@app/core'
6import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component' 6import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component'
7import { ServerConfig } from '@shared/models'
7 8
8@Component({ 9@Component({
9 selector: 'my-videos-add', 10 selector: 'my-videos-add',
10 templateUrl: './video-add.component.html', 11 templateUrl: './video-add.component.html',
11 styleUrls: [ './video-add.component.scss' ] 12 styleUrls: [ './video-add.component.scss' ]
12}) 13})
13export class VideoAddComponent implements CanComponentDeactivate { 14export class VideoAddComponent implements OnInit, CanComponentDeactivate {
14 @ViewChild('videoUpload', { static: false }) videoUpload: VideoUploadComponent 15 @ViewChild('videoUpload', { static: false }) videoUpload: VideoUploadComponent
15 @ViewChild('videoImportUrl', { static: false }) videoImportUrl: VideoImportUrlComponent 16 @ViewChild('videoImportUrl', { static: false }) videoImportUrl: VideoImportUrlComponent
16 @ViewChild('videoImportTorrent', { static: false }) videoImportTorrent: VideoImportTorrentComponent 17 @ViewChild('videoImportTorrent', { static: false }) videoImportTorrent: VideoImportTorrentComponent
17 18
18 secondStepType: 'upload' | 'import-url' | 'import-torrent' 19 secondStepType: 'upload' | 'import-url' | 'import-torrent'
19 videoName: string 20 videoName: string
21 serverConfig: ServerConfig
20 22
21 constructor ( 23 constructor (
22 private auth: AuthService, 24 private auth: AuthService,
23 private serverService: ServerService 25 private serverService: ServerService
24 ) {} 26 ) {}
25 27
28 ngOnInit () {
29 this.serverConfig = this.serverService.getTmpConfig()
30
31 this.serverService.getConfig()
32 .subscribe(config => this.serverConfig = config)
33 }
34
26 onFirstStepDone (type: 'upload' | 'import-url' | 'import-torrent', videoName: string) { 35 onFirstStepDone (type: 'upload' | 'import-url' | 'import-torrent', videoName: string) {
27 this.secondStepType = type 36 this.secondStepType = type
28 this.videoName = videoName 37 this.videoName = videoName
@@ -52,11 +61,11 @@ export class VideoAddComponent implements CanComponentDeactivate {
52 } 61 }
53 62
54 isVideoImportHttpEnabled () { 63 isVideoImportHttpEnabled () {
55 return this.serverService.getConfig().import.videos.http.enabled 64 return this.serverConfig.import.videos.http.enabled
56 } 65 }
57 66
58 isVideoImportTorrentEnabled () { 67 isVideoImportTorrentEnabled () {
59 return this.serverService.getConfig().import.videos.torrent.enabled 68 return this.serverConfig.import.videos.torrent.enabled
60 } 69 }
61 70
62 isInSecondStep () { 71 isInSecondStep () {
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 8cc1e8b58..626d0ca07 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -8,7 +8,7 @@ import { MetaService } from '@ngx-meta/core'
8import { AuthUser, Notifier, ServerService } from '@app/core' 8import { AuthUser, Notifier, ServerService } from '@app/core'
9import { forkJoin, Observable, Subscription } from 'rxjs' 9import { forkJoin, Observable, Subscription } from 'rxjs'
10import { Hotkey, HotkeysService } from 'angular2-hotkeys' 10import { Hotkey, HotkeysService } from 'angular2-hotkeys'
11import { UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared' 11import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared'
12import { AuthService, ConfirmService } from '../../core' 12import { AuthService, ConfirmService } from '../../core'
13import { RestExtractor, VideoBlacklistService } from '../../shared' 13import { RestExtractor, VideoBlacklistService } from '../../shared'
14import { VideoDetails } from '../../shared/video/video-details.model' 14import { VideoDetails } from '../../shared/video/video-details.model'
@@ -84,6 +84,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
84 private queryParamsSub: Subscription 84 private queryParamsSub: Subscription
85 private configSub: Subscription 85 private configSub: Subscription
86 86
87 private serverConfig: ServerConfig
88
87 constructor ( 89 constructor (
88 private elementRef: ElementRef, 90 private elementRef: ElementRef,
89 private changeDetector: ChangeDetectorRef, 91 private changeDetector: ChangeDetectorRef,
@@ -120,11 +122,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
120 } 122 }
121 123
122 async ngOnInit () { 124 async ngOnInit () {
123 this.configSub = this.serverService.configLoaded 125 this.serverConfig = this.serverService.getTmpConfig()
124 .subscribe(() => { 126
127 this.configSub = this.serverService.getConfig()
128 .subscribe(config => {
129 this.serverConfig = config
130
125 if ( 131 if (
126 isWebRTCDisabled() || 132 isWebRTCDisabled() ||
127 this.serverService.getConfig().tracker.enabled === false || 133 this.serverConfig.tracker.enabled === false ||
128 peertubeLocalStorage.getItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true' 134 peertubeLocalStorage.getItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true'
129 ) { 135 ) {
130 this.hasAlreadyAcceptedPrivacyConcern = true 136 this.hasAlreadyAcceptedPrivacyConcern = true
@@ -280,7 +286,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
280 } 286 }
281 287
282 isVideoBlur (video: Video) { 288 isVideoBlur (video: Video) {
283 return video.isVideoNSFWForUser(this.user, this.serverService.getConfig()) 289 return video.isVideoNSFWForUser(this.user, this.serverConfig)
284 } 290 }
285 291
286 isAutoPlayEnabled () { 292 isAutoPlayEnabled () {
diff --git a/client/src/app/videos/video-list/video-most-liked.component.ts b/client/src/app/videos/video-list/video-most-liked.component.ts
index aff8413eb..f94a7da04 100644
--- a/client/src/app/videos/video-list/video-most-liked.component.ts
+++ b/client/src/app/videos/video-list/video-most-liked.component.ts
@@ -40,11 +40,8 @@ export class VideoMostLikedComponent extends AbstractVideoList implements OnInit
40 40
41 this.generateSyndicationList() 41 this.generateSyndicationList()
42 42
43 this.serverService.configLoaded.subscribe( 43 this.titlePage = this.i18n('Most liked videos')
44 () => { 44 this.titleTooltip = this.i18n('Videos that have the higher number of likes.')
45 this.titlePage = this.i18n('Most liked videos')
46 this.titleTooltip = this.i18n('Videos that have the higher number of likes.')
47 })
48 } 45 }
49 46
50 getVideosObservable (page: number) { 47 getVideosObservable (page: number) {
diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts
index 19324da63..bc88679fa 100644
--- a/client/src/app/videos/video-list/video-trending.component.ts
+++ b/client/src/app/videos/video-list/video-trending.component.ts
@@ -40,9 +40,9 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit,
40 40
41 this.generateSyndicationList() 41 this.generateSyndicationList()
42 42
43 this.serverService.configLoaded.subscribe( 43 this.serverService.getConfig().subscribe(
44 () => { 44 config => {
45 const trendingDays = this.serverService.getConfig().trending.videos.intervalDays 45 const trendingDays = config.trending.videos.intervalDays
46 46
47 if (trendingDays === 1) { 47 if (trendingDays === 1) {
48 this.titlePage = this.i18n('Trending for the last 24 hours') 48 this.titlePage = this.i18n('Trending for the last 24 hours')