aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html15
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss3
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts6
-rw-r--r--client/src/sass/include/_mixins.scss3
-rw-r--r--config/default.yaml4
-rw-r--r--config/production.yaml.example2
-rw-r--r--server/lib/live-manager.ts2
-rw-r--r--server/middlewares/validators/config.ts4
-rw-r--r--server/tests/api/check-params/config.ts2
-rw-r--r--server/tests/api/live/live-permanent.ts4
-rw-r--r--server/tests/api/live/live-save-replay.ts2
-rw-r--r--server/tests/api/live/live.ts2
-rw-r--r--server/tests/api/server/config.ts2
-rw-r--r--shared/extra-utils/server/config.ts2
14 files changed, 24 insertions, 29 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
index bba7365f6..af8a4e18d 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
@@ -697,7 +697,7 @@
697 </ng-container> 697 </ng-container>
698 698
699 <ng-container ngbNavItem="transcoding"> 699 <ng-container ngbNavItem="transcoding">
700 <a ngbNavLink i18n>Transcoding</a> 700 <a ngbNavLink i18n>VOD Transcoding</a>
701 701
702 <ng-template ngbNavContent> 702 <ng-template ngbNavContent>
703 703
@@ -924,14 +924,11 @@
924 924
925 <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() }"> 925 <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() }">
926 <label i18n for="liveMaxDuration">Max live duration</label> 926 <label i18n for="liveMaxDuration">Max live duration</label>
927 <div> 927
928 <ng-select 928 <ng-select
929 labelForId="liveMaxDuration" [items]="liveMaxDurationOptions" formControlName="maxDuration" 929 labelForId="liveMaxDuration" [items]="liveMaxDurationOptions" formControlName="maxDuration"
930 bindLabel="label" bindValue="value" 930 bindLabel="label" bindValue="value" [clearable]="false" [searchable]="false"
931 [clearable]="false" 931 ></ng-select>
932 [searchable]="false"
933 ></ng-select>
934 </div>
935 </div> 932 </div>
936 933
937 </ng-container> 934 </ng-container>
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss
index 3d570f571..4c64bd2e0 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss
@@ -18,7 +18,8 @@ input[type=text] {
18} 18}
19 19
20input[type=number] { 20input[type=number] {
21 @include peertube-input-text(315px); 21 @include peertube-input-text($form-base-input-width);
22
22 display: block; 23 display: block;
23} 24}
24 25
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 7920600fc..c3a833843 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
@@ -98,7 +98,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
98 ] 98 ]
99 99
100 this.liveMaxDurationOptions = [ 100 this.liveMaxDurationOptions = [
101 { value: null, label: $localize`No limit` }, 101 { value: -1, label: $localize`No limit` },
102 { value: 1000 * 3600, label: $localize`1 hour` }, 102 { value: 1000 * 3600, label: $localize`1 hour` },
103 { value: 1000 * 3600 * 3, label: $localize`3 hours` }, 103 { value: 1000 * 3600 * 3, label: $localize`3 hours` },
104 { value: 1000 * 3600 * 5, label: $localize`5 hours` }, 104 { value: 1000 * 3600 * 5, label: $localize`5 hours` },
@@ -359,10 +359,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
359 async formValidated () { 359 async formValidated () {
360 const value: CustomConfig = this.form.getRawValue() 360 const value: CustomConfig = this.form.getRawValue()
361 361
362 // Transform "null" to null
363 const maxDuration = value.live.maxDuration as any
364 if (maxDuration === 'null') value.live.maxDuration = null
365
366 this.configService.updateCustomConfig(value) 362 this.configService.updateCustomConfig(value)
367 .subscribe( 363 .subscribe(
368 res => { 364 res => {
diff --git a/client/src/sass/include/_mixins.scss b/client/src/sass/include/_mixins.scss
index fecae9fbc..19b4e204f 100644
--- a/client/src/sass/include/_mixins.scss
+++ b/client/src/sass/include/_mixins.scss
@@ -307,7 +307,8 @@
307 307
308 308
309@mixin ng-select ($width) { 309@mixin ng-select ($width) {
310 ::ng-deep ng-select { 310 ::ng-deep &.ng-select,
311 ::ng-deep .ng-select {
311 width: $width; 312 width: $width;
312 313
313 @media screen and (max-width: $width) { 314 @media screen and (max-width: $width) {
diff --git a/config/default.yaml b/config/default.yaml
index 88821fe3c..9d428f764 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -247,8 +247,8 @@ live:
247 enabled: false 247 enabled: false
248 248
249 # Limit lives duration 249 # Limit lives duration
250 # Set null to disable duration limit 250 # -1 == unlimited
251 max_duration: null # For example: '5 hours' 251 max_duration: -1 # For example: '5 hours'
252 252
253 # Limit max number of live videos created on your instance 253 # Limit max number of live videos created on your instance
254 # -1 == unlimited 254 # -1 == unlimited
diff --git a/config/production.yaml.example b/config/production.yaml.example
index b71a494f9..bcf727d82 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -262,7 +262,7 @@ live:
262 262
263 # Limit lives duration 263 # Limit lives duration
264 # Set null to disable duration limit 264 # Set null to disable duration limit
265 max_duration: null # For example: '5 hours' 265 max_duration: -1 # For example: '5 hours'
266 266
267 # Limit max number of live videos created on your instance 267 # Limit max number of live videos created on your instance
268 # -1 == unlimited 268 # -1 == unlimited
diff --git a/server/lib/live-manager.ts b/server/lib/live-manager.ts
index 2fb4b774c..379f61bdf 100644
--- a/server/lib/live-manager.ts
+++ b/server/lib/live-manager.ts
@@ -505,7 +505,7 @@ class LiveManager {
505 private isDurationConstraintValid (streamingStartTime: number) { 505 private isDurationConstraintValid (streamingStartTime: number) {
506 const maxDuration = CONFIG.LIVE.MAX_DURATION 506 const maxDuration = CONFIG.LIVE.MAX_DURATION
507 // No limit 507 // No limit
508 if (maxDuration === null) return true 508 if (maxDuration < 0) return true
509 509
510 const now = new Date().getTime() 510 const now = new Date().getTime()
511 const max = streamingStartTime + maxDuration 511 const max = streamingStartTime + maxDuration
diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.ts
index 93de453a7..9c1cfa7e7 100644
--- a/server/middlewares/validators/config.ts
+++ b/server/middlewares/validators/config.ts
@@ -2,13 +2,13 @@ import * as express from 'express'
2import { body } from 'express-validator' 2import { body } from 'express-validator'
3import { isIntOrNull } from '@server/helpers/custom-validators/misc' 3import { isIntOrNull } from '@server/helpers/custom-validators/misc'
4import { isEmailEnabled } from '@server/initializers/config' 4import { isEmailEnabled } from '@server/initializers/config'
5import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
5import { CustomConfig } from '../../../shared/models/server/custom-config.model' 6import { CustomConfig } from '../../../shared/models/server/custom-config.model'
6import { isThemeNameValid } from '../../helpers/custom-validators/plugins' 7import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
7import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users' 8import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users'
8import { logger } from '../../helpers/logger' 9import { logger } from '../../helpers/logger'
9import { isThemeRegistered } from '../../lib/plugins/theme-utils' 10import { isThemeRegistered } from '../../lib/plugins/theme-utils'
10import { areValidationErrors } from './utils' 11import { areValidationErrors } from './utils'
11import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
12 12
13const customConfigUpdateValidator = [ 13const customConfigUpdateValidator = [
14 body('instance.name').exists().withMessage('Should have a valid instance name'), 14 body('instance.name').exists().withMessage('Should have a valid instance name'),
@@ -65,7 +65,7 @@ const customConfigUpdateValidator = [
65 65
66 body('live.enabled').isBoolean().withMessage('Should have a valid live enabled boolean'), 66 body('live.enabled').isBoolean().withMessage('Should have a valid live enabled boolean'),
67 body('live.allowReplay').isBoolean().withMessage('Should have a valid live allow replay boolean'), 67 body('live.allowReplay').isBoolean().withMessage('Should have a valid live allow replay boolean'),
68 body('live.maxDuration').custom(isIntOrNull).withMessage('Should have a valid live max duration'), 68 body('live.maxDuration').isInt().withMessage('Should have a valid live max duration'),
69 body('live.maxInstanceLives').custom(isIntOrNull).withMessage('Should have a valid max instance lives'), 69 body('live.maxInstanceLives').custom(isIntOrNull).withMessage('Should have a valid max instance lives'),
70 body('live.maxUserLives').custom(isIntOrNull).withMessage('Should have a valid max user lives'), 70 body('live.maxUserLives').custom(isIntOrNull).withMessage('Should have a valid max user lives'),
71 body('live.transcoding.enabled').isBoolean().withMessage('Should have a valid live transcoding enabled boolean'), 71 body('live.transcoding.enabled').isBoolean().withMessage('Should have a valid live transcoding enabled boolean'),
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index 08576c3ae..fab440fc5 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -105,7 +105,7 @@ describe('Test config API validators', function () {
105 enabled: true, 105 enabled: true,
106 106
107 allowReplay: false, 107 allowReplay: false,
108 maxDuration: null, 108 maxDuration: 30,
109 maxInstanceLives: -1, 109 maxInstanceLives: -1,
110 maxUserLives: 50, 110 maxUserLives: 50,
111 111
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts
index 9e6c6cf70..1128e993c 100644
--- a/server/tests/api/live/live-permanent.ts
+++ b/server/tests/api/live/live-permanent.ts
@@ -66,7 +66,7 @@ describe('Permenant live', function () {
66 live: { 66 live: {
67 enabled: true, 67 enabled: true,
68 allowReplay: true, 68 allowReplay: true,
69 maxDuration: null, 69 maxDuration: -1,
70 transcoding: { 70 transcoding: {
71 enabled: true, 71 enabled: true,
72 resolutions: { 72 resolutions: {
@@ -155,7 +155,7 @@ describe('Permenant live', function () {
155 live: { 155 live: {
156 enabled: true, 156 enabled: true,
157 allowReplay: true, 157 allowReplay: true,
158 maxDuration: null, 158 maxDuration: -1,
159 transcoding: { 159 transcoding: {
160 enabled: true, 160 enabled: true,
161 resolutions: { 161 resolutions: {
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index 6cd8cc23f..35fe4e7bd 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -90,7 +90,7 @@ describe('Save replay setting', function () {
90 live: { 90 live: {
91 enabled: true, 91 enabled: true,
92 allowReplay: true, 92 allowReplay: true,
93 maxDuration: null, 93 maxDuration: -1,
94 transcoding: { 94 transcoding: {
95 enabled: false, 95 enabled: false,
96 resolutions: { 96 resolutions: {
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index 918792081..939285ae8 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -348,7 +348,7 @@ describe('Test live', function () {
348 live: { 348 live: {
349 enabled: true, 349 enabled: true,
350 allowReplay: true, 350 allowReplay: true,
351 maxDuration: null, 351 maxDuration: -1,
352 transcoding: { 352 transcoding: {
353 enabled: true, 353 enabled: true,
354 resolutions: { 354 resolutions: {
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index a505b8ede..bfaad3688 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -81,7 +81,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) {
81 81
82 expect(data.live.enabled).to.be.false 82 expect(data.live.enabled).to.be.false
83 expect(data.live.allowReplay).to.be.false 83 expect(data.live.allowReplay).to.be.false
84 expect(data.live.maxDuration).to.be.null 84 expect(data.live.maxDuration).to.equal(-1)
85 expect(data.live.maxInstanceLives).to.equal(20) 85 expect(data.live.maxInstanceLives).to.equal(20)
86 expect(data.live.maxUserLives).to.equal(3) 86 expect(data.live.maxUserLives).to.equal(3)
87 expect(data.live.transcoding.enabled).to.be.false 87 expect(data.live.transcoding.enabled).to.be.false
diff --git a/shared/extra-utils/server/config.ts b/shared/extra-utils/server/config.ts
index 3b6afe9ff..8702659c4 100644
--- a/shared/extra-utils/server/config.ts
+++ b/shared/extra-utils/server/config.ts
@@ -129,7 +129,7 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
129 live: { 129 live: {
130 enabled: true, 130 enabled: true,
131 allowReplay: false, 131 allowReplay: false,
132 maxDuration: null, 132 maxDuration: -1,
133 maxInstanceLives: -1, 133 maxInstanceLives: -1,
134 maxUserLives: 50, 134 maxUserLives: 50,
135 transcoding: { 135 transcoding: {