1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Implement daily upload limit (#956)

* Implement daily upload limit (ref #652)

* remove duplicate code

* review fixes

* fix tests?

* whitespace fixes, finish leftover todo

* fix tests

* added some new tests

* use different config value for tests

* remove todo
This commit is contained in:
Felix Ableitner 2018-08-28 02:01:35 -05:00 committed by Chocobozzz
parent c907c2fa3f
commit bee0abffff
32 changed files with 273 additions and 45 deletions

View file

@ -103,7 +103,8 @@ async function getConfig (req: express.Request, res: express.Response, next: exp
}
},
user: {
videoQuota: CONFIG.USER.VIDEO_QUOTA
videoQuota: CONFIG.USER.VIDEO_QUOTA,
videoQuotaDaily: CONFIG.USER.VIDEO_QUOTA_DAILY
}
}
@ -154,6 +155,7 @@ async function updateCustomConfig (req: express.Request, res: express.Response,
toUpdate.cache.captions.size = parseInt('' + toUpdate.cache.captions.size, 10)
toUpdate.signup.limit = parseInt('' + toUpdate.signup.limit, 10)
toUpdate.user.videoQuota = parseInt('' + toUpdate.user.videoQuota, 10)
toUpdate.user.videoQuotaDaily = parseInt('' + toUpdate.user.videoQuotaDaily, 10)
toUpdate.transcoding.threads = parseInt('' + toUpdate.transcoding.threads, 10)
// camelCase to snake_case key
@ -223,7 +225,8 @@ function customConfig (): CustomConfig {
email: CONFIG.ADMIN.EMAIL
},
user: {
videoQuota: CONFIG.USER.VIDEO_QUOTA
videoQuota: CONFIG.USER.VIDEO_QUOTA,
videoQuotaDaily: CONFIG.USER.VIDEO_QUOTA_DAILY
},
transcoding: {
enabled: CONFIG.TRANSCODING.ENABLED,