diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-27 15:46:36 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-27 15:46:36 +0200 |
commit | be1fc4bc50811df522cbfef299da6a7540589f65 (patch) | |
tree | 3e49a94b641e623bd23e71e8621c9c949bec2eca /server | |
parent | fc62e39c0b5d20b19916b2880a0f9a110fcc02e5 (diff) | |
download | PeerTube-be1fc4bc50811df522cbfef299da6a7540589f65.tar.gz PeerTube-be1fc4bc50811df522cbfef299da6a7540589f65.tar.zst PeerTube-be1fc4bc50811df522cbfef299da6a7540589f65.zip |
Fix custom server configuration numbers
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/api/config.ts | 13 |
1 files changed, 8 insertions, 5 deletions
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, | |||
117 | async function updateCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { | 117 | async function updateCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { |
118 | const toUpdate: CustomConfig = req.body | 118 | const toUpdate: CustomConfig = req.body |
119 | 119 | ||
120 | // Need to change the videoQuota key a little bit | 120 | // Force number conversion |
121 | const toUpdateJSON = omit(toUpdate, 'videoQuota') | 121 | toUpdate.cache.previews.size = parseInt('' + toUpdate.cache.previews.size, 10) |
122 | toUpdate.signup.limit = parseInt('' + toUpdate.signup.limit, 10) | ||
123 | toUpdate.user.videoQuota = parseInt('' + toUpdate.user.videoQuota, 10) | ||
124 | toUpdate.transcoding.threads = parseInt('' + toUpdate.transcoding.threads, 10) | ||
125 | |||
126 | // camelCase to snake_case key | ||
127 | const toUpdateJSON = omit(toUpdate, 'user.videoQuota', 'instance.defaultClientRoute', 'instance.shortDescription') | ||
122 | toUpdateJSON.user['video_quota'] = toUpdate.user.videoQuota | 128 | toUpdateJSON.user['video_quota'] = toUpdate.user.videoQuota |
123 | toUpdateJSON.instance['default_client_route'] = toUpdate.instance.defaultClientRoute | 129 | toUpdateJSON.instance['default_client_route'] = toUpdate.instance.defaultClientRoute |
124 | toUpdateJSON.instance['short_description'] = toUpdate.instance.shortDescription | 130 | toUpdateJSON.instance['short_description'] = toUpdate.instance.shortDescription |
125 | delete toUpdate.user.videoQuota | ||
126 | delete toUpdate.instance.defaultClientRoute | ||
127 | delete toUpdate.instance.shortDescription | ||
128 | 131 | ||
129 | await writeFilePromise(CONFIG.CUSTOM_FILE, JSON.stringify(toUpdateJSON, undefined, 2)) | 132 | await writeFilePromise(CONFIG.CUSTOM_FILE, JSON.stringify(toUpdateJSON, undefined, 2)) |
130 | 133 | ||