diff options
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r-- | server/initializers/constants.ts | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index c5bc886d8..49809e64c 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -138,6 +138,7 @@ const CONFIG = { | |||
138 | VIDEOS_DIR: buildPath(config.get<string>('storage.videos')), | 138 | VIDEOS_DIR: buildPath(config.get<string>('storage.videos')), |
139 | THUMBNAILS_DIR: buildPath(config.get<string>('storage.thumbnails')), | 139 | THUMBNAILS_DIR: buildPath(config.get<string>('storage.thumbnails')), |
140 | PREVIEWS_DIR: buildPath(config.get<string>('storage.previews')), | 140 | PREVIEWS_DIR: buildPath(config.get<string>('storage.previews')), |
141 | CAPTIONS_DIR: buildPath(config.get<string>('storage.captions')), | ||
141 | TORRENTS_DIR: buildPath(config.get<string>('storage.torrents')), | 142 | TORRENTS_DIR: buildPath(config.get<string>('storage.torrents')), |
142 | CACHE_DIR: buildPath(config.get<string>('storage.cache')) | 143 | CACHE_DIR: buildPath(config.get<string>('storage.cache')) |
143 | }, | 144 | }, |
@@ -183,6 +184,9 @@ const CONFIG = { | |||
183 | CACHE: { | 184 | CACHE: { |
184 | PREVIEWS: { | 185 | PREVIEWS: { |
185 | get SIZE () { return config.get<number>('cache.previews.size') } | 186 | get SIZE () { return config.get<number>('cache.previews.size') } |
187 | }, | ||
188 | VIDEO_CAPTIONS: { | ||
189 | get SIZE () { return config.get<number>('cache.captions.size') } | ||
186 | } | 190 | } |
187 | }, | 191 | }, |
188 | INSTANCE: { | 192 | INSTANCE: { |
@@ -225,6 +229,14 @@ const CONSTRAINTS_FIELDS = { | |||
225 | SUPPORT: { min: 3, max: 500 }, // Length | 229 | SUPPORT: { min: 3, max: 500 }, // Length |
226 | URL: { min: 3, max: 2000 } // Length | 230 | URL: { min: 3, max: 2000 } // Length |
227 | }, | 231 | }, |
232 | VIDEO_CAPTIONS: { | ||
233 | CAPTION_FILE: { | ||
234 | EXTNAME: [ '.vtt' ], | ||
235 | FILE_SIZE: { | ||
236 | max: 2 * 1024 * 1024 // 2MB | ||
237 | } | ||
238 | } | ||
239 | }, | ||
228 | VIDEOS: { | 240 | VIDEOS: { |
229 | NAME: { min: 3, max: 120 }, // Length | 241 | NAME: { min: 3, max: 120 }, // Length |
230 | LANGUAGE: { min: 1, max: 10 }, // Length | 242 | LANGUAGE: { min: 1, max: 10 }, // Length |
@@ -351,6 +363,10 @@ const IMAGE_MIMETYPE_EXT = { | |||
351 | 'image/jpeg': '.jpg' | 363 | 'image/jpeg': '.jpg' |
352 | } | 364 | } |
353 | 365 | ||
366 | const VIDEO_CAPTIONS_MIMETYPE_EXT = { | ||
367 | 'text/vtt': '.vtt' | ||
368 | } | ||
369 | |||
354 | // --------------------------------------------------------------------------- | 370 | // --------------------------------------------------------------------------- |
355 | 371 | ||
356 | const SERVER_ACTOR_NAME = 'peertube' | 372 | const SERVER_ACTOR_NAME = 'peertube' |
@@ -403,7 +419,8 @@ const STATIC_PATHS = { | |||
403 | THUMBNAILS: '/static/thumbnails/', | 419 | THUMBNAILS: '/static/thumbnails/', |
404 | TORRENTS: '/static/torrents/', | 420 | TORRENTS: '/static/torrents/', |
405 | WEBSEED: '/static/webseed/', | 421 | WEBSEED: '/static/webseed/', |
406 | AVATARS: '/static/avatars/' | 422 | AVATARS: '/static/avatars/', |
423 | VIDEO_CAPTIONS: '/static/video-captions/' | ||
407 | } | 424 | } |
408 | const STATIC_DOWNLOAD_PATHS = { | 425 | const STATIC_DOWNLOAD_PATHS = { |
409 | TORRENTS: '/download/torrents/', | 426 | TORRENTS: '/download/torrents/', |
@@ -435,7 +452,8 @@ const EMBED_SIZE = { | |||
435 | // Sub folders of cache directory | 452 | // Sub folders of cache directory |
436 | const CACHE = { | 453 | const CACHE = { |
437 | DIRECTORIES: { | 454 | DIRECTORIES: { |
438 | PREVIEWS: join(CONFIG.STORAGE.CACHE_DIR, 'previews') | 455 | PREVIEWS: join(CONFIG.STORAGE.CACHE_DIR, 'previews'), |
456 | VIDEO_CAPTIONS: join(CONFIG.STORAGE.CACHE_DIR, 'video-captions') | ||
439 | } | 457 | } |
440 | } | 458 | } |
441 | 459 | ||
@@ -490,6 +508,7 @@ updateWebserverConfig() | |||
490 | 508 | ||
491 | export { | 509 | export { |
492 | API_VERSION, | 510 | API_VERSION, |
511 | VIDEO_CAPTIONS_MIMETYPE_EXT, | ||
493 | AVATARS_SIZE, | 512 | AVATARS_SIZE, |
494 | ACCEPT_HEADERS, | 513 | ACCEPT_HEADERS, |
495 | BCRYPT_SALT_SIZE, | 514 | BCRYPT_SALT_SIZE, |