aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts17
-rw-r--r--server/initializers/installer.ts6
2 files changed, 16 insertions, 7 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 49809e64c..3837f7062 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -231,7 +231,7 @@ const CONSTRAINTS_FIELDS = {
231 }, 231 },
232 VIDEO_CAPTIONS: { 232 VIDEO_CAPTIONS: {
233 CAPTION_FILE: { 233 CAPTION_FILE: {
234 EXTNAME: [ '.vtt' ], 234 EXTNAME: [ '.vtt', '.srt' ],
235 FILE_SIZE: { 235 FILE_SIZE: {
236 max: 2 * 1024 * 1024 // 2MB 236 max: 2 * 1024 * 1024 // 2MB
237 } 237 }
@@ -364,7 +364,8 @@ const IMAGE_MIMETYPE_EXT = {
364} 364}
365 365
366const VIDEO_CAPTIONS_MIMETYPE_EXT = { 366const VIDEO_CAPTIONS_MIMETYPE_EXT = {
367 'text/vtt': '.vtt' 367 'text/vtt': '.vtt',
368 'application/x-subrip': '.srt'
368} 369}
369 370
370// --------------------------------------------------------------------------- 371// ---------------------------------------------------------------------------
@@ -451,9 +452,13 @@ const EMBED_SIZE = {
451 452
452// Sub folders of cache directory 453// Sub folders of cache directory
453const CACHE = { 454const CACHE = {
454 DIRECTORIES: { 455 PREVIEWS: {
455 PREVIEWS: join(CONFIG.STORAGE.CACHE_DIR, 'previews'), 456 DIRECTORY: join(CONFIG.STORAGE.CACHE_DIR, 'previews'),
456 VIDEO_CAPTIONS: join(CONFIG.STORAGE.CACHE_DIR, 'video-captions') 457 MAX_AGE: 1000 * 3600 * 3 // 3 hours
458 },
459 VIDEO_CAPTIONS: {
460 DIRECTORY: join(CONFIG.STORAGE.CACHE_DIR, 'video-captions'),
461 MAX_AGE: 1000 * 3600 * 3 // 3 hours
457 } 462 }
458} 463}
459 464
@@ -500,6 +505,8 @@ if (isTestInstance() === true) {
500 VIDEO_VIEW_LIFETIME = 1000 // 1 second 505 VIDEO_VIEW_LIFETIME = 1000 // 1 second
501 506
502 JOB_ATTEMPTS['email'] = 1 507 JOB_ATTEMPTS['email'] = 1
508
509 CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000
503} 510}
504 511
505updateWebserverConfig() 512updateWebserverConfig()
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts
index b0084b368..1f513a9c3 100644
--- a/server/initializers/installer.ts
+++ b/server/initializers/installer.ts
@@ -33,7 +33,8 @@ export {
33// --------------------------------------------------------------------------- 33// ---------------------------------------------------------------------------
34 34
35function removeCacheDirectories () { 35function removeCacheDirectories () {
36 const cacheDirectories = CACHE.DIRECTORIES 36 const cacheDirectories = Object.keys(CACHE)
37 .map(k => CACHE[k].DIRECTORY)
37 38
38 const tasks: Promise<any>[] = [] 39 const tasks: Promise<any>[] = []
39 40
@@ -48,7 +49,8 @@ function removeCacheDirectories () {
48 49
49function createDirectoriesIfNotExist () { 50function createDirectoriesIfNotExist () {
50 const storage = CONFIG.STORAGE 51 const storage = CONFIG.STORAGE
51 const cacheDirectories = CACHE.DIRECTORIES 52 const cacheDirectories = Object.keys(CACHE)
53 .map(k => CACHE[k].DIRECTORY)
52 54
53 const tasks = [] 55 const tasks = []
54 for (const key of Object.keys(storage)) { 56 for (const key of Object.keys(storage)) {