diff options
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | 83 | ||||
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | 31 |
2 files changed, 113 insertions, 1 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 227137f48..8000f471f 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 | |||
@@ -699,6 +699,87 @@ | |||
699 | </ng-template> | 699 | </ng-template> |
700 | </ng-container> | 700 | </ng-container> |
701 | 701 | ||
702 | <ng-container ngbNavItem="live"> | ||
703 | <a ngbNavLink i18n>Live streaming</a> | ||
704 | |||
705 | <ng-template ngbNavContent> | ||
706 | |||
707 | <div class="form-row mt-5"> | ||
708 | <div class="form-group col-12 col-lg-4 col-xl-3"> | ||
709 | <div i18n class="inner-form-title">LIVE</div> | ||
710 | <div i18n class="inner-form-description"> | ||
711 | Add ability for your users to do live streaming on your instance. | ||
712 | </div> | ||
713 | </div> | ||
714 | |||
715 | <div class="form-group form-group-right col-12 col-lg-8 col-xl-9"> | ||
716 | |||
717 | <ng-container formGroupName="live"> | ||
718 | |||
719 | <div class="form-group"> | ||
720 | <my-peertube-checkbox inputName="liveEnabled" formControlName="enabled"> | ||
721 | <ng-template ptTemplate="label"> | ||
722 | <ng-container i18n>Allow live streaming</ng-container> | ||
723 | </ng-template> | ||
724 | |||
725 | <ng-template ptTemplate="help"> | ||
726 | <ng-container i18n>Enabling live streaming requires trust in your users and extra moderation work</ng-container> | ||
727 | </ng-template> | ||
728 | |||
729 | <ng-container ngProjectAs="extra" formGroupName="transcoding"> | ||
730 | |||
731 | <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() }"> | ||
732 | <my-peertube-checkbox | ||
733 | inputName="liveTranscodingEnabled" formControlName="enabled" | ||
734 | i18n-labelText labelText="Enable live transcoding" | ||
735 | > | ||
736 | <ng-container ngProjectAs="description"> | ||
737 | Requires a lot of CPU! | ||
738 | </ng-container> | ||
739 | </my-peertube-checkbox> | ||
740 | </div> | ||
741 | |||
742 | <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() || !isLiveTranscodingEnabled() }"> | ||
743 | <label i18n for="liveTranscodingThreads">Live transcoding threads</label> | ||
744 | <div class="peertube-select-container"> | ||
745 | <select id="liveTranscodingThreads" formControlName="threads" class="form-control"> | ||
746 | <option *ngFor="let transcodingThreadOption of transcodingThreadOptions" [value]="transcodingThreadOption.value"> | ||
747 | {{ transcodingThreadOption.label }} | ||
748 | </option> | ||
749 | </select> | ||
750 | </div> | ||
751 | <div *ngIf="formErrors.live.transcoding.threads" class="form-error">{{ formErrors.live.transcoding.threads }}</div> | ||
752 | </div> | ||
753 | |||
754 | <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isLiveEnabled() || !isLiveTranscodingEnabled() }"> | ||
755 | |||
756 | <label i18n for="liveTranscodingThreads">Live resolutions to generate</label> | ||
757 | |||
758 | <div class="ml-2 mt-2 d-flex flex-column"> | ||
759 | <ng-container formGroupName="resolutions"> | ||
760 | <div class="form-group" *ngFor="let resolution of liveResolutions"> | ||
761 | <my-peertube-checkbox | ||
762 | [inputName]="getResolutionKey(resolution.id)" [formControlName]="resolution.id" | ||
763 | labelText="{{resolution.label}}" | ||
764 | > | ||
765 | <ng-template *ngIf="resolution.description" ptTemplate="help"> | ||
766 | <div [innerHTML]="resolution.description"></div> | ||
767 | </ng-template> | ||
768 | </my-peertube-checkbox> | ||
769 | </div> | ||
770 | </ng-container> | ||
771 | </div> | ||
772 | </div> | ||
773 | </ng-container> | ||
774 | </my-peertube-checkbox> | ||
775 | </div> | ||
776 | </ng-container> | ||
777 | </div> | ||
778 | </div> | ||
779 | |||
780 | </ng-template> | ||
781 | </ng-container> | ||
782 | |||
702 | <ng-container ngbNavItem="advanced-configuration"> | 783 | <ng-container ngbNavItem="advanced-configuration"> |
703 | <a ngbNavLink i18n>Advanced configuration</a> | 784 | <a ngbNavLink i18n>Advanced configuration</a> |
704 | 785 | ||
@@ -814,7 +895,7 @@ | |||
814 | 895 | ||
815 | <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isTranscodingEnabled() }"> | 896 | <div class="form-group" [ngClass]="{ 'disabled-checkbox-extra': !isTranscodingEnabled() }"> |
816 | 897 | ||
817 | <label i18n for="transcodingThreads">Resolutions to generate</label> | 898 | <label i18n>Resolutions to generate</label> |
818 | 899 | ||
819 | <div class="ml-2 mt-2 d-flex flex-column"> | 900 | <div class="ml-2 mt-2 d-flex flex-column"> |
820 | <ng-container formGroupName="resolutions"> | 901 | <ng-container formGroupName="resolutions"> |
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 78e9dd5e5..de800c87e 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 | |||
@@ -34,6 +34,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
34 | customConfig: CustomConfig | 34 | customConfig: CustomConfig |
35 | 35 | ||
36 | resolutions: { id: string, label: string, description?: string }[] = [] | 36 | resolutions: { id: string, label: string, description?: string }[] = [] |
37 | liveResolutions: { id: string, label: string, description?: string }[] = [] | ||
37 | transcodingThreadOptions: { label: string, value: number }[] = [] | 38 | transcodingThreadOptions: { label: string, value: number }[] = [] |
38 | 39 | ||
39 | languageItems: SelectOptionsItem[] = [] | 40 | languageItems: SelectOptionsItem[] = [] |
@@ -82,6 +83,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
82 | } | 83 | } |
83 | ] | 84 | ] |
84 | 85 | ||
86 | this.liveResolutions = this.resolutions.filter(r => r.id !== '0p') | ||
87 | |||
85 | this.transcodingThreadOptions = [ | 88 | this.transcodingThreadOptions = [ |
86 | { value: 0, label: $localize`Auto (via ffmpeg)` }, | 89 | { value: 0, label: $localize`Auto (via ffmpeg)` }, |
87 | { value: 1, label: '1' }, | 90 | { value: 1, label: '1' }, |
@@ -198,6 +201,15 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
198 | enabled: null | 201 | enabled: null |
199 | } | 202 | } |
200 | }, | 203 | }, |
204 | live: { | ||
205 | enabled: null, | ||
206 | |||
207 | transcoding: { | ||
208 | enabled: null, | ||
209 | threads: TRANSCODING_THREADS_VALIDATOR, | ||
210 | resolutions: {} | ||
211 | } | ||
212 | }, | ||
201 | autoBlacklist: { | 213 | autoBlacklist: { |
202 | videos: { | 214 | videos: { |
203 | ofUsers: { | 215 | ofUsers: { |
@@ -245,13 +257,24 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
245 | const defaultValues = { | 257 | const defaultValues = { |
246 | transcoding: { | 258 | transcoding: { |
247 | resolutions: {} | 259 | resolutions: {} |
260 | }, | ||
261 | live: { | ||
262 | transcoding: { | ||
263 | resolutions: {} | ||
264 | } | ||
248 | } | 265 | } |
249 | } | 266 | } |
267 | |||
250 | for (const resolution of this.resolutions) { | 268 | for (const resolution of this.resolutions) { |
251 | defaultValues.transcoding.resolutions[resolution.id] = 'false' | 269 | defaultValues.transcoding.resolutions[resolution.id] = 'false' |
252 | formGroupData.transcoding.resolutions[resolution.id] = null | 270 | formGroupData.transcoding.resolutions[resolution.id] = null |
253 | } | 271 | } |
254 | 272 | ||
273 | for (const resolution of this.liveResolutions) { | ||
274 | defaultValues.live.transcoding.resolutions[resolution.id] = 'false' | ||
275 | formGroupData.live.transcoding.resolutions[resolution.id] = null | ||
276 | } | ||
277 | |||
255 | this.buildForm(formGroupData) | 278 | this.buildForm(formGroupData) |
256 | this.loadForm() | 279 | this.loadForm() |
257 | this.checkTranscodingFields() | 280 | this.checkTranscodingFields() |
@@ -268,6 +291,14 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
268 | return this.form.value['transcoding']['enabled'] === true | 291 | return this.form.value['transcoding']['enabled'] === true |
269 | } | 292 | } |
270 | 293 | ||
294 | isLiveEnabled () { | ||
295 | return this.form.value['live']['enabled'] === true | ||
296 | } | ||
297 | |||
298 | isLiveTranscodingEnabled () { | ||
299 | return this.form.value['live']['transcoding']['enabled'] === true | ||
300 | } | ||
301 | |||
271 | isSignupEnabled () { | 302 | isSignupEnabled () { |
272 | return this.form.value['signup']['enabled'] === true | 303 | return this.form.value['signup']['enabled'] === true |
273 | } | 304 | } |