diff options
author | Chocobozzz <me@florianbigard.com> | 2022-09-28 13:59:23 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-09-28 14:04:06 +0200 |
commit | f67ac646a2c081e02b28a7ab1dc856db6ee20e2f (patch) | |
tree | 4bd19f2eb58d835aac0f58c44941197a402e5cab /client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts | |
parent | b0d6a800f84ac16fe541b1f098defe862d09069a (diff) | |
download | PeerTube-f67ac646a2c081e02b28a7ab1dc856db6ee20e2f.tar.gz PeerTube-f67ac646a2c081e02b28a7ab1dc856db6ee20e2f.tar.zst PeerTube-f67ac646a2c081e02b28a7ab1dc856db6ee20e2f.zip |
Put video quota info in its own component
Diffstat (limited to 'client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts')
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts | 26 |
1 files changed, 4 insertions, 22 deletions
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 dc7802b2c..f7de4c7de 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 | |||
@@ -60,6 +60,10 @@ export class EditBasicConfigurationComponent implements OnInit, OnChanges { | |||
60 | return !!enabled.find((e: string) => e === algorithm) | 60 | return !!enabled.find((e: string) => e === algorithm) |
61 | } | 61 | } |
62 | 62 | ||
63 | getUserVideoQuota () { | ||
64 | return this.form.value['user']['videoQuota'] | ||
65 | } | ||
66 | |||
63 | isSignupEnabled () { | 67 | isSignupEnabled () { |
64 | return this.form.value['signup']['enabled'] === true | 68 | return this.form.value['signup']['enabled'] === true |
65 | } | 69 | } |
@@ -92,28 +96,6 @@ export class EditBasicConfigurationComponent implements OnInit, OnChanges { | |||
92 | return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true | 96 | return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true |
93 | } | 97 | } |
94 | 98 | ||
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 | |||
117 | buildLandingPageOptions () { | 99 | buildLandingPageOptions () { |
118 | this.defaultLandingPageOptions = this.menuService.buildCommonLinks(this.serverConfig) | 100 | this.defaultLandingPageOptions = this.menuService.buildCommonLinks(this.serverConfig) |
119 | .links | 101 | .links |