diff options
author | The Cashew Trader <thecashewtrader@protonmail.com> | 2022-09-27 13:43:42 +0000 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-09-28 14:04:06 +0200 |
commit | b0d6a800f84ac16fe541b1f098defe862d09069a (patch) | |
tree | ab9650fb708724b2158623d496b95bc46c53e3d7 /client/src | |
parent | b105ea604286092b4e5fd5667f2957d113278dde (diff) | |
download | PeerTube-b0d6a800f84ac16fe541b1f098defe862d09069a.tar.gz PeerTube-b0d6a800f84ac16fe541b1f098defe862d09069a.tar.zst PeerTube-b0d6a800f84ac16fe541b1f098defe862d09069a.zip |
Add transcoding quota message to admin config page
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html | 5 | ||||
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts | 24 |
2 files changed, 28 insertions, 1 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html index 929ea3a90..728185195 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html | |||
@@ -218,6 +218,11 @@ | |||
218 | [clearable]="false" | 218 | [clearable]="false" |
219 | ></my-select-custom-value> | 219 | ></my-select-custom-value> |
220 | 220 | ||
221 | <div i18n class="transcoding-information" *ngIf="isTranscodingInformationDisplayed()"> | ||
222 | Transcoding is enabled. The video quota only takes into account <strong>original</strong> video size. <br /> | ||
223 | At most, a user could upload ~ {{ computeQuotaWithTranscoding() | bytes: 0 }}. | ||
224 | </div> | ||
225 | |||
221 | <div *ngIf="formErrors.user.videoQuota" class="form-error">{{ formErrors.user.videoQuota }}</div> | 226 | <div *ngIf="formErrors.user.videoQuota" class="form-error">{{ formErrors.user.videoQuota }}</div> |
222 | </div> | 227 | </div> |
223 | 228 | ||
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts index 90ed58c99..dc7802b2c 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts | |||
@@ -3,7 +3,7 @@ import { SelectOptionsItem } from 'src/types/select-options-item.model' | |||
3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' | 3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' |
4 | import { FormGroup } from '@angular/forms' | 4 | import { FormGroup } from '@angular/forms' |
5 | import { MenuService, ThemeService } from '@app/core' | 5 | import { MenuService, ThemeService } from '@app/core' |
6 | import { HTMLServerConfig } from '@shared/models' | 6 | import { HTMLServerConfig, VideoResolution } from '@shared/models' |
7 | import { ConfigService } from '../shared/config.service' | 7 | import { ConfigService } from '../shared/config.service' |
8 | 8 | ||
9 | @Component({ | 9 | @Component({ |
@@ -92,6 +92,28 @@ export class EditBasicConfigurationComponent implements OnInit, OnChanges { | |||
92 | return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true | 92 | return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true |
93 | } | 93 | } |
94 | 94 | ||
95 | computeQuotaWithTranscoding () { | ||
96 | const transcodingConfig = this.serverConfig.transcoding | ||
97 | |||
98 | const resolutions = transcodingConfig.enabledResolutions | ||
99 | const higherResolution = VideoResolution.H_4K | ||
100 | let multiplier = 0 | ||
101 | |||
102 | for (const resolution of resolutions) { | ||
103 | multiplier += resolution / higherResolution | ||
104 | } | ||
105 | |||
106 | if (transcodingConfig.hls.enabled) multiplier *= 2 | ||
107 | |||
108 | return multiplier * parseInt(this.form.value['user']['videoQuota'], 10) | ||
109 | } | ||
110 | |||
111 | isTranscodingInformationDisplayed () { | ||
112 | const formVideoQuota = parseInt(this.form.value['user']['videoQuota'], 10) | ||
113 | return this.serverConfig.transcoding.enabledResolutions.length !== 0 && | ||
114 | formVideoQuota > 0 | ||
115 | } | ||
116 | |||
95 | buildLandingPageOptions () { | 117 | buildLandingPageOptions () { |
96 | this.defaultLandingPageOptions = this.menuService.buildCommonLinks(this.serverConfig) | 118 | this.defaultLandingPageOptions = this.menuService.buildCommonLinks(this.serverConfig) |
97 | .links | 119 | .links |