Use -1 for max live duration unlimited
This commit is contained in:
parent
d1742ede65
commit
c9bc850e93
|
@ -697,7 +697,7 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container ngbNavItem="transcoding">
|
<ng-container ngbNavItem="transcoding">
|
||||||
<a ngbNavLink i18n>Transcoding</a>
|
<a ngbNavLink i18n>VOD Transcoding</a>
|
||||||
|
|
||||||
<ng-template ngbNavContent>
|
<ng-template ngbNavContent>
|
||||||
|
|
||||||
|
@ -924,15 +924,12 @@
|
||||||
|
|
||||||
<div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() }">
|
<div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() }">
|
||||||
<label i18n for="liveMaxDuration">Max live duration</label>
|
<label i18n for="liveMaxDuration">Max live duration</label>
|
||||||
<div>
|
|
||||||
<ng-select
|
<ng-select
|
||||||
labelForId="liveMaxDuration" [items]="liveMaxDurationOptions" formControlName="maxDuration"
|
labelForId="liveMaxDuration" [items]="liveMaxDurationOptions" formControlName="maxDuration"
|
||||||
bindLabel="label" bindValue="value"
|
bindLabel="label" bindValue="value" [clearable]="false" [searchable]="false"
|
||||||
[clearable]="false"
|
|
||||||
[searchable]="false"
|
|
||||||
></ng-select>
|
></ng-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</my-peertube-checkbox>
|
</my-peertube-checkbox>
|
||||||
|
|
|
@ -18,7 +18,8 @@ input[type=text] {
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=number] {
|
input[type=number] {
|
||||||
@include peertube-input-text(315px);
|
@include peertube-input-text($form-base-input-width);
|
||||||
|
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
|
||||||
]
|
]
|
||||||
|
|
||||||
this.liveMaxDurationOptions = [
|
this.liveMaxDurationOptions = [
|
||||||
{ value: null, label: $localize`No limit` },
|
{ value: -1, label: $localize`No limit` },
|
||||||
{ value: 1000 * 3600, label: $localize`1 hour` },
|
{ value: 1000 * 3600, label: $localize`1 hour` },
|
||||||
{ value: 1000 * 3600 * 3, label: $localize`3 hours` },
|
{ value: 1000 * 3600 * 3, label: $localize`3 hours` },
|
||||||
{ value: 1000 * 3600 * 5, label: $localize`5 hours` },
|
{ value: 1000 * 3600 * 5, label: $localize`5 hours` },
|
||||||
|
@ -359,10 +359,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
|
||||||
async formValidated () {
|
async formValidated () {
|
||||||
const value: CustomConfig = this.form.getRawValue()
|
const value: CustomConfig = this.form.getRawValue()
|
||||||
|
|
||||||
// Transform "null" to null
|
|
||||||
const maxDuration = value.live.maxDuration as any
|
|
||||||
if (maxDuration === 'null') value.live.maxDuration = null
|
|
||||||
|
|
||||||
this.configService.updateCustomConfig(value)
|
this.configService.updateCustomConfig(value)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
res => {
|
res => {
|
||||||
|
|
|
@ -307,7 +307,8 @@
|
||||||
|
|
||||||
|
|
||||||
@mixin ng-select ($width) {
|
@mixin ng-select ($width) {
|
||||||
::ng-deep ng-select {
|
::ng-deep &.ng-select,
|
||||||
|
::ng-deep .ng-select {
|
||||||
width: $width;
|
width: $width;
|
||||||
|
|
||||||
@media screen and (max-width: $width) {
|
@media screen and (max-width: $width) {
|
||||||
|
|
|
@ -247,8 +247,8 @@ live:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
# Limit lives duration
|
# Limit lives duration
|
||||||
# Set null to disable duration limit
|
# -1 == unlimited
|
||||||
max_duration: null # For example: '5 hours'
|
max_duration: -1 # For example: '5 hours'
|
||||||
|
|
||||||
# Limit max number of live videos created on your instance
|
# Limit max number of live videos created on your instance
|
||||||
# -1 == unlimited
|
# -1 == unlimited
|
||||||
|
|
|
@ -262,7 +262,7 @@ live:
|
||||||
|
|
||||||
# Limit lives duration
|
# Limit lives duration
|
||||||
# Set null to disable duration limit
|
# Set null to disable duration limit
|
||||||
max_duration: null # For example: '5 hours'
|
max_duration: -1 # For example: '5 hours'
|
||||||
|
|
||||||
# Limit max number of live videos created on your instance
|
# Limit max number of live videos created on your instance
|
||||||
# -1 == unlimited
|
# -1 == unlimited
|
||||||
|
|
|
@ -505,7 +505,7 @@ class LiveManager {
|
||||||
private isDurationConstraintValid (streamingStartTime: number) {
|
private isDurationConstraintValid (streamingStartTime: number) {
|
||||||
const maxDuration = CONFIG.LIVE.MAX_DURATION
|
const maxDuration = CONFIG.LIVE.MAX_DURATION
|
||||||
// No limit
|
// No limit
|
||||||
if (maxDuration === null) return true
|
if (maxDuration < 0) return true
|
||||||
|
|
||||||
const now = new Date().getTime()
|
const now = new Date().getTime()
|
||||||
const max = streamingStartTime + maxDuration
|
const max = streamingStartTime + maxDuration
|
||||||
|
|
|
@ -2,13 +2,13 @@ import * as express from 'express'
|
||||||
import { body } from 'express-validator'
|
import { body } from 'express-validator'
|
||||||
import { isIntOrNull } from '@server/helpers/custom-validators/misc'
|
import { isIntOrNull } from '@server/helpers/custom-validators/misc'
|
||||||
import { isEmailEnabled } from '@server/initializers/config'
|
import { isEmailEnabled } from '@server/initializers/config'
|
||||||
|
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
||||||
import { CustomConfig } from '../../../shared/models/server/custom-config.model'
|
import { CustomConfig } from '../../../shared/models/server/custom-config.model'
|
||||||
import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
|
import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
|
||||||
import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users'
|
import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users'
|
||||||
import { logger } from '../../helpers/logger'
|
import { logger } from '../../helpers/logger'
|
||||||
import { isThemeRegistered } from '../../lib/plugins/theme-utils'
|
import { isThemeRegistered } from '../../lib/plugins/theme-utils'
|
||||||
import { areValidationErrors } from './utils'
|
import { areValidationErrors } from './utils'
|
||||||
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
|
||||||
|
|
||||||
const customConfigUpdateValidator = [
|
const customConfigUpdateValidator = [
|
||||||
body('instance.name').exists().withMessage('Should have a valid instance name'),
|
body('instance.name').exists().withMessage('Should have a valid instance name'),
|
||||||
|
@ -65,7 +65,7 @@ const customConfigUpdateValidator = [
|
||||||
|
|
||||||
body('live.enabled').isBoolean().withMessage('Should have a valid live enabled boolean'),
|
body('live.enabled').isBoolean().withMessage('Should have a valid live enabled boolean'),
|
||||||
body('live.allowReplay').isBoolean().withMessage('Should have a valid live allow replay boolean'),
|
body('live.allowReplay').isBoolean().withMessage('Should have a valid live allow replay boolean'),
|
||||||
body('live.maxDuration').custom(isIntOrNull).withMessage('Should have a valid live max duration'),
|
body('live.maxDuration').isInt().withMessage('Should have a valid live max duration'),
|
||||||
body('live.maxInstanceLives').custom(isIntOrNull).withMessage('Should have a valid max instance lives'),
|
body('live.maxInstanceLives').custom(isIntOrNull).withMessage('Should have a valid max instance lives'),
|
||||||
body('live.maxUserLives').custom(isIntOrNull).withMessage('Should have a valid max user lives'),
|
body('live.maxUserLives').custom(isIntOrNull).withMessage('Should have a valid max user lives'),
|
||||||
body('live.transcoding.enabled').isBoolean().withMessage('Should have a valid live transcoding enabled boolean'),
|
body('live.transcoding.enabled').isBoolean().withMessage('Should have a valid live transcoding enabled boolean'),
|
||||||
|
|
|
@ -105,7 +105,7 @@ describe('Test config API validators', function () {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|
||||||
allowReplay: false,
|
allowReplay: false,
|
||||||
maxDuration: null,
|
maxDuration: 30,
|
||||||
maxInstanceLives: -1,
|
maxInstanceLives: -1,
|
||||||
maxUserLives: 50,
|
maxUserLives: 50,
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ describe('Permenant live', function () {
|
||||||
live: {
|
live: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowReplay: true,
|
allowReplay: true,
|
||||||
maxDuration: null,
|
maxDuration: -1,
|
||||||
transcoding: {
|
transcoding: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
resolutions: {
|
resolutions: {
|
||||||
|
@ -155,7 +155,7 @@ describe('Permenant live', function () {
|
||||||
live: {
|
live: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowReplay: true,
|
allowReplay: true,
|
||||||
maxDuration: null,
|
maxDuration: -1,
|
||||||
transcoding: {
|
transcoding: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
resolutions: {
|
resolutions: {
|
||||||
|
|
|
@ -90,7 +90,7 @@ describe('Save replay setting', function () {
|
||||||
live: {
|
live: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowReplay: true,
|
allowReplay: true,
|
||||||
maxDuration: null,
|
maxDuration: -1,
|
||||||
transcoding: {
|
transcoding: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
resolutions: {
|
resolutions: {
|
||||||
|
|
|
@ -348,7 +348,7 @@ describe('Test live', function () {
|
||||||
live: {
|
live: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowReplay: true,
|
allowReplay: true,
|
||||||
maxDuration: null,
|
maxDuration: -1,
|
||||||
transcoding: {
|
transcoding: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
resolutions: {
|
resolutions: {
|
||||||
|
|
|
@ -81,7 +81,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) {
|
||||||
|
|
||||||
expect(data.live.enabled).to.be.false
|
expect(data.live.enabled).to.be.false
|
||||||
expect(data.live.allowReplay).to.be.false
|
expect(data.live.allowReplay).to.be.false
|
||||||
expect(data.live.maxDuration).to.be.null
|
expect(data.live.maxDuration).to.equal(-1)
|
||||||
expect(data.live.maxInstanceLives).to.equal(20)
|
expect(data.live.maxInstanceLives).to.equal(20)
|
||||||
expect(data.live.maxUserLives).to.equal(3)
|
expect(data.live.maxUserLives).to.equal(3)
|
||||||
expect(data.live.transcoding.enabled).to.be.false
|
expect(data.live.transcoding.enabled).to.be.false
|
||||||
|
|
|
@ -129,7 +129,7 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
|
||||||
live: {
|
live: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowReplay: false,
|
allowReplay: false,
|
||||||
maxDuration: null,
|
maxDuration: -1,
|
||||||
maxInstanceLives: -1,
|
maxInstanceLives: -1,
|
||||||
maxUserLives: 50,
|
maxUserLives: 50,
|
||||||
transcoding: {
|
transcoding: {
|
||||||
|
|
Loading…
Reference in New Issue