aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/config.ts13
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,
117async function updateCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { 117async 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