mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Fix custom server configuration numbers
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user