aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/constants.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-03 11:10:40 +0100
committerChocobozzz <me@florianbigard.com>2018-01-03 11:10:40 +0100
commit01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea (patch)
tree9e01809f09adbcd512a8dedf73093a123f88e02c /server/initializers/constants.ts
parent47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04 (diff)
downloadPeerTube-01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea.tar.gz
PeerTube-01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea.tar.zst
PeerTube-01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea.zip
Add avatar max size limit
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r--server/initializers/constants.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 31bb6c981..aefb91537 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -133,9 +133,6 @@ const CONFIG = {
133 } 133 }
134} 134}
135 135
136const AVATARS_DIR = {
137 ACCOUNT: join(CONFIG.STORAGE.AVATARS_DIR, 'account')
138}
139// --------------------------------------------------------------------------- 136// ---------------------------------------------------------------------------
140 137
141const CONSTRAINTS_FIELDS = { 138const CONSTRAINTS_FIELDS = {
@@ -169,12 +166,15 @@ const CONSTRAINTS_FIELDS = {
169 FILE_SIZE: { min: 10 }, 166 FILE_SIZE: { min: 10 },
170 URL: { min: 3, max: 2000 } // Length 167 URL: { min: 3, max: 2000 } // Length
171 }, 168 },
172 ACTOR: { 169 ACTORS: {
173 PUBLIC_KEY: { min: 10, max: 5000 }, // Length 170 PUBLIC_KEY: { min: 10, max: 5000 }, // Length
174 PRIVATE_KEY: { min: 10, max: 5000 }, // Length 171 PRIVATE_KEY: { min: 10, max: 5000 }, // Length
175 URL: { min: 3, max: 2000 }, // Length 172 URL: { min: 3, max: 2000 }, // Length
176 AVATAR: { 173 AVATAR: {
177 EXTNAME: [ '.png', '.jpeg', '.jpg' ] 174 EXTNAME: [ '.png', '.jpeg', '.jpg' ],
175 FILE_SIZE: {
176 max: 2 * 1024 * 1024 // 2MB
177 }
178 } 178 }
179 }, 179 },
180 VIDEO_EVENTS: { 180 VIDEO_EVENTS: {
@@ -345,6 +345,7 @@ if (isTestInstance() === true) {
345 REMOTE_SCHEME.WS = 'ws' 345 REMOTE_SCHEME.WS = 'ws'
346 STATIC_MAX_AGE = '0' 346 STATIC_MAX_AGE = '0'
347 ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE = 2 347 ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE = 2
348 CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB
348} 349}
349 350
350CONFIG.WEBSERVER.URL = sanitizeUrl(CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT) 351CONFIG.WEBSERVER.URL = sanitizeUrl(CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT)
@@ -372,7 +373,6 @@ export {
372 PREVIEWS_SIZE, 373 PREVIEWS_SIZE,
373 REMOTE_SCHEME, 374 REMOTE_SCHEME,
374 FOLLOW_STATES, 375 FOLLOW_STATES,
375 AVATARS_DIR,
376 SERVER_ACTOR_NAME, 376 SERVER_ACTOR_NAME,
377 PRIVATE_RSA_KEY_SIZE, 377 PRIVATE_RSA_KEY_SIZE,
378 SORTABLE_COLUMNS, 378 SORTABLE_COLUMNS,