1
0
Fork 0

Add missing max fps config in admin

This commit is contained in:
Chocobozzz 2024-10-07 10:12:32 +02:00
parent 6f93dc041b
commit 7c3eaf868c
No known key found for this signature in database
GPG key ID: 583A612D890159BE
4 changed files with 44 additions and 3 deletions

View file

@ -22,6 +22,7 @@ import {
SERVICES_TWITTER_USERNAME_VALIDATOR, SERVICES_TWITTER_USERNAME_VALIDATOR,
SIGNUP_LIMIT_VALIDATOR, SIGNUP_LIMIT_VALIDATOR,
SIGNUP_MINIMUM_AGE_VALIDATOR, SIGNUP_MINIMUM_AGE_VALIDATOR,
TRANSCODING_MAX_FPS_VALIDATOR,
TRANSCODING_THREADS_VALIDATOR TRANSCODING_THREADS_VALIDATOR
} from '@app/shared/form-validators/custom-config-validators' } from '@app/shared/form-validators/custom-config-validators'
import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators' import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators'
@ -30,6 +31,7 @@ import { FormReactiveService } from '@app/shared/shared-forms/form-reactive.serv
import { CustomPageService } from '@app/shared/shared-main/custom-page/custom-page.service' import { CustomPageService } from '@app/shared/shared-main/custom-page/custom-page.service'
import { NgbNav, NgbNavContent, NgbNavItem, NgbNavLink, NgbNavLinkBase, NgbNavOutlet } from '@ng-bootstrap/ng-bootstrap' import { NgbNav, NgbNavContent, NgbNavItem, NgbNavLink, NgbNavLinkBase, NgbNavOutlet } from '@ng-bootstrap/ng-bootstrap'
import { CustomConfig, CustomPage, HTMLServerConfig } from '@peertube/peertube-models' import { CustomConfig, CustomPage, HTMLServerConfig } from '@peertube/peertube-models'
import merge from 'lodash-es/merge'
import omit from 'lodash-es/omit' import omit from 'lodash-es/omit'
import { forkJoin } from 'rxjs' import { forkJoin } from 'rxjs'
import { SelectOptionsItem } from 'src/types/select-options-item.model' import { SelectOptionsItem } from 'src/types/select-options-item.model'
@ -40,7 +42,6 @@ import { EditHomepageComponent } from './edit-homepage.component'
import { EditInstanceInformationComponent } from './edit-instance-information.component' import { EditInstanceInformationComponent } from './edit-instance-information.component'
import { EditLiveConfigurationComponent } from './edit-live-configuration.component' import { EditLiveConfigurationComponent } from './edit-live-configuration.component'
import { EditVODTranscodingComponent } from './edit-vod-transcoding.component' import { EditVODTranscodingComponent } from './edit-vod-transcoding.component'
import merge from 'lodash-es/merge'
type ComponentCustomConfig = CustomConfig & { type ComponentCustomConfig = CustomConfig & {
instanceCustomHomepage: CustomPage instanceCustomHomepage: CustomPage
@ -239,6 +240,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
}, },
remoteRunners: { remoteRunners: {
enabled: null enabled: null
},
fps: {
max: TRANSCODING_MAX_FPS_VALIDATOR
} }
}, },
live: { live: {
@ -260,6 +264,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
alwaysTranscodeOriginalResolution: null, alwaysTranscodeOriginalResolution: null,
remoteRunners: { remoteRunners: {
enabled: null enabled: null
},
fps: {
max: TRANSCODING_MAX_FPS_VALIDATOR
} }
} }
}, },

View file

@ -48,7 +48,7 @@
<div class="form-group" [ngClass]="getDisabledLiveClass()"> <div class="form-group" [ngClass]="getDisabledLiveClass()">
<label i18n for="liveMaxInstanceLives">Max simultaneous lives created on your instance</label> <label i18n for="liveMaxInstanceLives">Max simultaneous lives created on your instance</label>
<span class="ms-2 small muted">(-1 for "unlimited")</span> <span i18n class="ms-2 small muted">(-1 for "unlimited")</span>
<div class="number-with-unit"> <div class="number-with-unit">
<input type="number" name="liveMaxInstanceLives" formControlName="maxInstanceLives" /> <input type="number" name="liveMaxInstanceLives" formControlName="maxInstanceLives" />
@ -60,7 +60,7 @@
<div class="form-group" [ngClass]="getDisabledLiveClass()"> <div class="form-group" [ngClass]="getDisabledLiveClass()">
<label i18n for="liveMaxUserLives">Max simultaneous lives created per user</label> <label i18n for="liveMaxUserLives">Max simultaneous lives created per user</label>
<span class="ms-2 small muted">(-1 for "unlimited")</span> <span i18n class="ms-2 small muted">(-1 for "unlimited")</span>
<div class="number-with-unit"> <div class="number-with-unit">
<input type="number" name="liveMaxUserLives" formControlName="maxUserLives" /> <input type="number" name="liveMaxUserLives" formControlName="maxUserLives" />
@ -116,6 +116,19 @@
<div [ngClass]="getDisabledLiveTranscodingClass()"> <div [ngClass]="getDisabledLiveTranscodingClass()">
<div class="form-group" formGroupName="fps">
<label i18n for="liveTranscodingFPSMax">Max live FPS</label>
<span i18n class="ms-2 small muted">Cap transcoded live FPS. Max resolution stream still keeps the original FPS.</span>
<div class="number-with-unit">
<input type="number" name="liveTranscodingFPSMax" formControlName="max" />
<span>FPS</span>
</div>
<div *ngIf="formErrors.live.transcoding.fps.max" class="form-error" role="alert">{{ formErrors.live.transcoding.fps.max }}</div>
</div>
<div class="ms-2 mt-3"> <div class="ms-2 mt-3">
<h4 i18n>Live resolutions to generate</h4> <h4 i18n>Live resolutions to generate</h4>

View file

@ -141,6 +141,19 @@
</div> </div>
</ng-container> </ng-container>
<div class="form-group" formGroupName="fps" [ngClass]="getTranscodingDisabledClass()">
<label i18n for="transcodingFPSMax">Max video FPS</label>
<span i18n class="ms-2 small muted">Cap transcoded video FPS. Max resolution file still keeps the original FPS.</span>
<div class="number-with-unit">
<input type="number" name="transcodingFPSMax" formControlName="max" />
<span>FPS</span>
</div>
<div *ngIf="formErrors.transcoding.fps.max" class="form-error" role="alert">{{ formErrors.transcoding.fps.max }}</div>
</div>
<div class="form-group" [ngClass]="getTranscodingDisabledClass()"> <div class="form-group" [ngClass]="getTranscodingDisabledClass()">
<div class="mb-2 fw-bold" i18n>Resolutions to generate</div> <div class="mb-2 fw-bold" i18n>Resolutions to generate</div>

View file

@ -65,6 +65,14 @@ export const TRANSCODING_THREADS_VALIDATOR: BuildFormValidator = {
} }
} }
export const TRANSCODING_MAX_FPS_VALIDATOR: BuildFormValidator = {
VALIDATORS: [ Validators.required, Validators.min(1) ],
MESSAGES: {
required: $localize`Transcoding max FPS is required.`,
min: $localize`Transcoding max FPS must be greater or equal to 1.`
}
}
export const MAX_LIVE_DURATION_VALIDATOR: BuildFormValidator = { export const MAX_LIVE_DURATION_VALIDATOR: BuildFormValidator = {
VALIDATORS: [ Validators.required, Validators.min(-1) ], VALIDATORS: [ Validators.required, Validators.min(-1) ],
MESSAGES: { MESSAGES: {