From: Chocobozzz Date: Tue, 27 Mar 2018 13:46:36 +0000 (+0200) Subject: Fix custom server configuration numbers X-Git-Tag: v1.0.0-beta.2~10 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=be1fc4bc50811df522cbfef299da6a7540589f65;p=oweals%2Fpeertube.git Fix custom server configuration numbers --- diff --git a/client/src/app/about/about.component.html b/client/src/app/about/about.component.html index bcb4ed2be..bad90d161 100644 --- a/client/src/app/about/about.component.html +++ b/client/src/app/about/about.component.html @@ -13,14 +13,26 @@
Terms
+ + +
+
Signup
+ +
+ User registration is allowed and + + + this instance provides a baseline quota of {{ userVideoQuota | bytes }} space for the videos of its users. + + + + this instance provides unlimited space for the videos of its users. + +
-
- This instance provides a baseline quota of {{ userVideoQuota | bytes: 0 }} space for the videos of its users. +
+ User registration is currently not allowed.
- - - This instance provides unlimited space for the videos of its users. -
diff --git a/client/src/app/about/about.component.scss b/client/src/app/about/about.component.scss index 09e9c68cb..2a22b9528 100644 --- a/client/src/app/about/about.component.scss +++ b/client/src/app/about/about.component.scss @@ -7,6 +7,6 @@ margin-bottom: 5px; } -.description, .terms { +.description, .terms, .signup { margin-bottom: 30px; } diff --git a/client/src/app/about/about.component.ts b/client/src/app/about/about.component.ts index 7edc013e1..2fd48f0d3 100644 --- a/client/src/app/about/about.component.ts +++ b/client/src/app/about/about.component.ts @@ -27,6 +27,10 @@ export class AboutComponent implements OnInit { return this.serverService.getConfig().user.videoQuota } + get isSignupAllowed () { + return this.serverService.getConfig().signup.allowed + } + ngOnInit () { this.serverService.getAbout() .subscribe( diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 8d7fc8cf1..88f047adc 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts @@ -117,14 +117,17 @@ async function deleteCustomConfig (req: express.Request, res: express.Response, async function updateCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { const toUpdate: CustomConfig = req.body - // Need to change the videoQuota key a little bit - const toUpdateJSON = omit(toUpdate, 'videoQuota') + // Force number conversion + toUpdate.cache.previews.size = parseInt('' + toUpdate.cache.previews.size, 10) + toUpdate.signup.limit = parseInt('' + toUpdate.signup.limit, 10) + toUpdate.user.videoQuota = parseInt('' + toUpdate.user.videoQuota, 10) + toUpdate.transcoding.threads = parseInt('' + toUpdate.transcoding.threads, 10) + + // camelCase to snake_case key + const toUpdateJSON = omit(toUpdate, 'user.videoQuota', 'instance.defaultClientRoute', 'instance.shortDescription') toUpdateJSON.user['video_quota'] = toUpdate.user.videoQuota toUpdateJSON.instance['default_client_route'] = toUpdate.instance.defaultClientRoute toUpdateJSON.instance['short_description'] = toUpdate.instance.shortDescription - delete toUpdate.user.videoQuota - delete toUpdate.instance.defaultClientRoute - delete toUpdate.instance.shortDescription await writeFilePromise(CONFIG.CUSTOM_FILE, JSON.stringify(toUpdateJSON, undefined, 2))