diff options
author | Chocobozzz <me@florianbigard.com> | 2020-12-15 09:23:28 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-12-15 09:26:37 +0100 |
commit | c9bc850e93295661e743255b8623ac8e2a95c391 (patch) | |
tree | 0dd03d2addfa03e0c92947b787af46414253a1c2 /server | |
parent | d1742ede65d2a42ffc02ab230287d83d432416f1 (diff) | |
download | PeerTube-c9bc850e93295661e743255b8623ac8e2a95c391.tar.gz PeerTube-c9bc850e93295661e743255b8623ac8e2a95c391.tar.zst PeerTube-c9bc850e93295661e743255b8623ac8e2a95c391.zip |
Use -1 for max live duration unlimited
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/live-manager.ts | 2 | ||||
-rw-r--r-- | server/middlewares/validators/config.ts | 4 | ||||
-rw-r--r-- | server/tests/api/check-params/config.ts | 2 | ||||
-rw-r--r-- | server/tests/api/live/live-permanent.ts | 4 | ||||
-rw-r--r-- | server/tests/api/live/live-save-replay.ts | 2 | ||||
-rw-r--r-- | server/tests/api/live/live.ts | 2 | ||||
-rw-r--r-- | server/tests/api/server/config.ts | 2 |
7 files changed, 9 insertions, 9 deletions
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' | |||
2 | import { body } from 'express-validator' | 2 | import { body } from 'express-validator' |
3 | import { isIntOrNull } from '@server/helpers/custom-validators/misc' | 3 | import { isIntOrNull } from '@server/helpers/custom-validators/misc' |
4 | import { isEmailEnabled } from '@server/initializers/config' | 4 | import { isEmailEnabled } from '@server/initializers/config' |
5 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
5 | import { CustomConfig } from '../../../shared/models/server/custom-config.model' | 6 | import { CustomConfig } from '../../../shared/models/server/custom-config.model' |
6 | import { isThemeNameValid } from '../../helpers/custom-validators/plugins' | 7 | import { isThemeNameValid } from '../../helpers/custom-validators/plugins' |
7 | import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users' | 8 | import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users' |
8 | import { logger } from '../../helpers/logger' | 9 | import { logger } from '../../helpers/logger' |
9 | import { isThemeRegistered } from '../../lib/plugins/theme-utils' | 10 | import { isThemeRegistered } from '../../lib/plugins/theme-utils' |
10 | import { areValidationErrors } from './utils' | 11 | import { areValidationErrors } from './utils' |
11 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
12 | 12 | ||
13 | const customConfigUpdateValidator = [ | 13 | const 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 |