aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-09-25 16:19:35 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitfb7194043d0486ce0a6a40b2ffbdf32878c33a6f (patch)
tree6ed304a5d730a75da0a4460b3009df88684fa598 /client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
parenta5cf76afa378aae81af2a9b0ce548e5d2582f832 (diff)
downloadPeerTube-fb7194043d0486ce0a6a40b2ffbdf32878c33a6f.tar.gz
PeerTube-fb7194043d0486ce0a6a40b2ffbdf32878c33a6f.tar.zst
PeerTube-fb7194043d0486ce0a6a40b2ffbdf32878c33a6f.zip
Check live duration and size
Diffstat (limited to 'client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts30
1 files changed, 29 insertions, 1 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
index de800c87e..745238647 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
@@ -36,6 +36,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
36 resolutions: { id: string, label: string, description?: string }[] = [] 36 resolutions: { id: string, label: string, description?: string }[] = []
37 liveResolutions: { id: string, label: string, description?: string }[] = [] 37 liveResolutions: { id: string, label: string, description?: string }[] = []
38 transcodingThreadOptions: { label: string, value: number }[] = [] 38 transcodingThreadOptions: { label: string, value: number }[] = []
39 liveMaxDurationOptions: { label: string, value: number }[] = []
39 40
40 languageItems: SelectOptionsItem[] = [] 41 languageItems: SelectOptionsItem[] = []
41 categoryItems: SelectOptionsItem[] = [] 42 categoryItems: SelectOptionsItem[] = []
@@ -92,6 +93,14 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
92 { value: 4, label: '4' }, 93 { value: 4, label: '4' },
93 { value: 8, label: '8' } 94 { value: 8, label: '8' }
94 ] 95 ]
96
97 this.liveMaxDurationOptions = [
98 { value: 0, label: $localize`No limit` },
99 { value: 1000 * 3600, label: $localize`1 hour` },
100 { value: 1000 * 3600 * 3, label: $localize`3 hours` },
101 { value: 1000 * 3600 * 5, label: $localize`5 hours` },
102 { value: 1000 * 3600 * 10, label: $localize`10 hours` }
103 ]
95 } 104 }
96 105
97 get videoQuotaOptions () { 106 get videoQuotaOptions () {
@@ -114,7 +123,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
114 ngOnInit () { 123 ngOnInit () {
115 this.serverConfig = this.serverService.getTmpConfig() 124 this.serverConfig = this.serverService.getTmpConfig()
116 this.serverService.getConfig() 125 this.serverService.getConfig()
117 .subscribe(config => this.serverConfig = config) 126 .subscribe(config => {
127 this.serverConfig = config
128 })
118 129
119 const formGroupData: { [key in keyof CustomConfig ]: any } = { 130 const formGroupData: { [key in keyof CustomConfig ]: any } = {
120 instance: { 131 instance: {
@@ -204,6 +215,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
204 live: { 215 live: {
205 enabled: null, 216 enabled: null,
206 217
218 maxDuration: null,
219 allowReplay: null,
220
207 transcoding: { 221 transcoding: {
208 enabled: null, 222 enabled: null,
209 threads: TRANSCODING_THREADS_VALIDATOR, 223 threads: TRANSCODING_THREADS_VALIDATOR,
@@ -341,6 +355,20 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
341 } 355 }
342 } 356 }
343 357
358 hasConsistentOptions () {
359 if (this.hasLiveAllowReplayConsistentOptions()) return true
360
361 return false
362 }
363
364 hasLiveAllowReplayConsistentOptions () {
365 if (this.isTranscodingEnabled() === false && this.isLiveEnabled() && this.form.value['live']['allowReplay'] === true) {
366 return false
367 }
368
369 return true
370 }
371
344 private updateForm () { 372 private updateForm () {
345 this.form.patchValue(this.customConfig) 373 this.form.patchValue(this.customConfig)
346 } 374 }