]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
Check live duration and size
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / config / edit-custom-config / edit-custom-config.component.ts
index de800c87ef06aa6ef00be6be5103a339c157dd92..745238647637bcb44ec2b08cb9cb035991941891 100644 (file)
@@ -36,6 +36,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
   resolutions: { id: string, label: string, description?: string }[] = []
   liveResolutions: { id: string, label: string, description?: string }[] = []
   transcodingThreadOptions: { label: string, value: number }[] = []
+  liveMaxDurationOptions: { label: string, value: number }[] = []
 
   languageItems: SelectOptionsItem[] = []
   categoryItems: SelectOptionsItem[] = []
@@ -92,6 +93,14 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
       { value: 4, label: '4' },
       { value: 8, label: '8' }
     ]
+
+    this.liveMaxDurationOptions = [
+      { value: 0, label: $localize`No limit` },
+      { value: 1000 * 3600, label: $localize`1 hour` },
+      { value: 1000 * 3600 * 3, label: $localize`3 hours` },
+      { value: 1000 * 3600 * 5, label: $localize`5 hours` },
+      { value: 1000 * 3600 * 10, label: $localize`10 hours` }
+    ]
   }
 
   get videoQuotaOptions () {
@@ -114,7 +123,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
   ngOnInit () {
     this.serverConfig = this.serverService.getTmpConfig()
     this.serverService.getConfig()
-        .subscribe(config => this.serverConfig = config)
+        .subscribe(config => {
+          this.serverConfig = config
+        })
 
     const formGroupData: { [key in keyof CustomConfig ]: any } = {
       instance: {
@@ -204,6 +215,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
       live: {
         enabled: null,
 
+        maxDuration: null,
+        allowReplay: null,
+
         transcoding: {
           enabled: null,
           threads: TRANSCODING_THREADS_VALIDATOR,
@@ -341,6 +355,20 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
     }
   }
 
+  hasConsistentOptions () {
+    if (this.hasLiveAllowReplayConsistentOptions()) return true
+
+    return false
+  }
+
+  hasLiveAllowReplayConsistentOptions () {
+    if (this.isTranscodingEnabled() === false && this.isLiveEnabled() && this.form.value['live']['allowReplay'] === true) {
+      return false
+    }
+
+    return true
+  }
+
   private updateForm () {
     this.form.patchValue(this.customConfig)
   }