diff options
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r-- | server/initializers/constants.ts | 163 |
1 files changed, 87 insertions, 76 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 13e32b6d2..134560717 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -4,7 +4,7 @@ import { ActivityPubActorType } from '../../shared/models/activitypub' | |||
4 | import { FollowState } from '../../shared/models/actors' | 4 | import { FollowState } from '../../shared/models/actors' |
5 | import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos' | 5 | import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos' |
6 | // Do not use barrels, remain constants as independent as possible | 6 | // Do not use barrels, remain constants as independent as possible |
7 | import { isTestInstance, sanitizeHost, sanitizeUrl, root, parseDurationToMs } from '../helpers/core-utils' | 7 | import { isTestInstance, sanitizeHost, sanitizeUrl, root } from '../helpers/core-utils' |
8 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' | 8 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' |
9 | import { invert } from 'lodash' | 9 | import { invert } from 'lodash' |
10 | import { CronRepeatOptions, EveryRepeatOptions } from 'bull' | 10 | import { CronRepeatOptions, EveryRepeatOptions } from 'bull' |
@@ -14,7 +14,7 @@ import { CONFIG, registerConfigChangedHandler } from './config' | |||
14 | 14 | ||
15 | // --------------------------------------------------------------------------- | 15 | // --------------------------------------------------------------------------- |
16 | 16 | ||
17 | const LAST_MIGRATION_VERSION = 470 | 17 | const LAST_MIGRATION_VERSION = 505 |
18 | 18 | ||
19 | // --------------------------------------------------------------------------- | 19 | // --------------------------------------------------------------------------- |
20 | 20 | ||
@@ -59,9 +59,9 @@ const SORTABLE_COLUMNS = { | |||
59 | FOLLOWERS: [ 'createdAt', 'state', 'score' ], | 59 | FOLLOWERS: [ 'createdAt', 'state', 'score' ], |
60 | FOLLOWING: [ 'createdAt', 'redundancyAllowed', 'state' ], | 60 | FOLLOWING: [ 'createdAt', 'redundancyAllowed', 'state' ], |
61 | 61 | ||
62 | VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'views', 'likes', 'trending' ], | 62 | VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'originallyPublishedAt', 'views', 'likes', 'trending' ], |
63 | 63 | ||
64 | VIDEOS_SEARCH: [ 'name', 'duration', 'createdAt', 'publishedAt', 'views', 'likes', 'match' ], | 64 | VIDEOS_SEARCH: [ 'name', 'duration', 'createdAt', 'publishedAt', 'originallyPublishedAt', 'views', 'likes', 'match' ], |
65 | VIDEO_CHANNELS_SEARCH: [ 'match', 'displayName', 'createdAt' ], | 65 | VIDEO_CHANNELS_SEARCH: [ 'match', 'displayName', 'createdAt' ], |
66 | 66 | ||
67 | ACCOUNTS_BLOCKLIST: [ 'createdAt' ], | 67 | ACCOUNTS_BLOCKLIST: [ 'createdAt' ], |
@@ -73,7 +73,9 @@ const SORTABLE_COLUMNS = { | |||
73 | 73 | ||
74 | PLUGINS: [ 'name', 'createdAt', 'updatedAt' ], | 74 | PLUGINS: [ 'name', 'createdAt', 'updatedAt' ], |
75 | 75 | ||
76 | AVAILABLE_PLUGINS: [ 'npmName', 'popularity' ] | 76 | AVAILABLE_PLUGINS: [ 'npmName', 'popularity' ], |
77 | |||
78 | VIDEO_REDUNDANCIES: [ 'name' ] | ||
77 | } | 79 | } |
78 | 80 | ||
79 | const OAUTH_LIFETIME = { | 81 | const OAUTH_LIFETIME = { |
@@ -88,9 +90,6 @@ const ROUTE_CACHE_LIFETIME = { | |||
88 | SECURITYTXT: '2 hours', | 90 | SECURITYTXT: '2 hours', |
89 | NODEINFO: '10 minutes', | 91 | NODEINFO: '10 minutes', |
90 | DNT_POLICY: '1 week', | 92 | DNT_POLICY: '1 week', |
91 | OVERVIEWS: { | ||
92 | VIDEOS: '1 hour' | ||
93 | }, | ||
94 | ACTIVITY_PUB: { | 93 | ACTIVITY_PUB: { |
95 | VIDEOS: '1 second' // 1 second, cache concurrent requests after a broadcast for example | 94 | VIDEOS: '1 second' // 1 second, cache concurrent requests after a broadcast for example |
96 | }, | 95 | }, |
@@ -117,45 +116,44 @@ const REMOTE_SCHEME = { | |||
117 | WS: 'wss' | 116 | WS: 'wss' |
118 | } | 117 | } |
119 | 118 | ||
120 | // TODO: remove 'video-file' | 119 | const JOB_ATTEMPTS: { [id in JobType]: number } = { |
121 | const JOB_ATTEMPTS: { [id in (JobType | 'video-file')]: number } = { | ||
122 | 'activitypub-http-broadcast': 5, | 120 | 'activitypub-http-broadcast': 5, |
123 | 'activitypub-http-unicast': 5, | 121 | 'activitypub-http-unicast': 5, |
124 | 'activitypub-http-fetcher': 5, | 122 | 'activitypub-http-fetcher': 5, |
125 | 'activitypub-follow': 5, | 123 | 'activitypub-follow': 5, |
126 | 'video-file-import': 1, | 124 | 'video-file-import': 1, |
127 | 'video-transcoding': 1, | 125 | 'video-transcoding': 1, |
128 | 'video-file': 1, | ||
129 | 'video-import': 1, | 126 | 'video-import': 1, |
130 | 'email': 5, | 127 | 'email': 5, |
131 | 'videos-views': 1, | 128 | 'videos-views': 1, |
132 | 'activitypub-refresher': 1 | 129 | 'activitypub-refresher': 1, |
130 | 'video-redundancy': 1 | ||
133 | } | 131 | } |
134 | const JOB_CONCURRENCY: { [id in (JobType | 'video-file')]: number } = { | 132 | const JOB_CONCURRENCY: { [id in JobType]: number } = { |
135 | 'activitypub-http-broadcast': 1, | 133 | 'activitypub-http-broadcast': 1, |
136 | 'activitypub-http-unicast': 5, | 134 | 'activitypub-http-unicast': 5, |
137 | 'activitypub-http-fetcher': 1, | 135 | 'activitypub-http-fetcher': 1, |
138 | 'activitypub-follow': 1, | 136 | 'activitypub-follow': 1, |
139 | 'video-file-import': 1, | 137 | 'video-file-import': 1, |
140 | 'video-transcoding': 1, | 138 | 'video-transcoding': 1, |
141 | 'video-file': 1, | ||
142 | 'video-import': 1, | 139 | 'video-import': 1, |
143 | 'email': 5, | 140 | 'email': 5, |
144 | 'videos-views': 1, | 141 | 'videos-views': 1, |
145 | 'activitypub-refresher': 1 | 142 | 'activitypub-refresher': 1, |
143 | 'video-redundancy': 1 | ||
146 | } | 144 | } |
147 | const JOB_TTL: { [id in (JobType | 'video-file')]: number } = { | 145 | const JOB_TTL: { [id in JobType]: number } = { |
148 | 'activitypub-http-broadcast': 60000 * 10, // 10 minutes | 146 | 'activitypub-http-broadcast': 60000 * 10, // 10 minutes |
149 | 'activitypub-http-unicast': 60000 * 10, // 10 minutes | 147 | 'activitypub-http-unicast': 60000 * 10, // 10 minutes |
150 | 'activitypub-http-fetcher': 60000 * 10, // 10 minutes | 148 | 'activitypub-http-fetcher': 1000 * 3600 * 10, // 10 hours |
151 | 'activitypub-follow': 60000 * 10, // 10 minutes | 149 | 'activitypub-follow': 60000 * 10, // 10 minutes |
152 | 'video-file-import': 1000 * 3600, // 1 hour | 150 | 'video-file-import': 1000 * 3600, // 1 hour |
153 | 'video-transcoding': 1000 * 3600 * 48, // 2 days, transcoding could be long | 151 | 'video-transcoding': 1000 * 3600 * 48, // 2 days, transcoding could be long |
154 | 'video-file': 1000 * 3600 * 48, // 2 days, transcoding could be long | 152 | 'video-import': 1000 * 3600 * 2, // 2 hours |
155 | 'video-import': 1000 * 3600 * 2, // hours | ||
156 | 'email': 60000 * 10, // 10 minutes | 153 | 'email': 60000 * 10, // 10 minutes |
157 | 'videos-views': undefined, // Unlimited | 154 | 'videos-views': undefined, // Unlimited |
158 | 'activitypub-refresher': 60000 * 10 // 10 minutes | 155 | 'activitypub-refresher': 60000 * 10, // 10 minutes |
156 | 'video-redundancy': 1000 * 3600 * 3 // 3 hours | ||
159 | } | 157 | } |
160 | const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = { | 158 | const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = { |
161 | 'videos-views': { | 159 | 'videos-views': { |
@@ -285,7 +283,7 @@ const CONSTRAINTS_FIELDS = { | |||
285 | COUNT: { min: 0 } | 283 | COUNT: { min: 0 } |
286 | }, | 284 | }, |
287 | VIDEO_COMMENTS: { | 285 | VIDEO_COMMENTS: { |
288 | TEXT: { min: 1, max: 3000 }, // Length | 286 | TEXT: { min: 1, max: 10000 }, // Length |
289 | URL: { min: 3, max: 2000 } // Length | 287 | URL: { min: 3, max: 2000 } // Length |
290 | }, | 288 | }, |
291 | VIDEO_SHARE: { | 289 | VIDEO_SHARE: { |
@@ -309,6 +307,8 @@ let CONTACT_FORM_LIFETIME = 60000 * 60 // 1 hour | |||
309 | 307 | ||
310 | const VIDEO_TRANSCODING_FPS: VideoTranscodingFPS = { | 308 | const VIDEO_TRANSCODING_FPS: VideoTranscodingFPS = { |
311 | MIN: 10, | 309 | MIN: 10, |
310 | STANDARD: [ 24, 25, 30 ], | ||
311 | HD_STANDARD: [ 50, 60 ], | ||
312 | AVERAGE: 30, | 312 | AVERAGE: 30, |
313 | MAX: 60, | 313 | MAX: 60, |
314 | KEEP_ORIGIN_FPS_RESOLUTION_MIN: 720 // We keep the original FPS on high resolutions (720 minimum) | 314 | KEEP_ORIGIN_FPS_RESOLUTION_MIN: 720 // We keep the original FPS on high resolutions (720 minimum) |
@@ -358,42 +358,42 @@ const VIDEO_LICENCES = { | |||
358 | 7: 'Public Domain Dedication' | 358 | 7: 'Public Domain Dedication' |
359 | } | 359 | } |
360 | 360 | ||
361 | let VIDEO_LANGUAGES: { [id: string]: string } = {} | 361 | const VIDEO_LANGUAGES: { [id: string]: string } = {} |
362 | 362 | ||
363 | const VIDEO_PRIVACIES = { | 363 | const VIDEO_PRIVACIES = { |
364 | [ VideoPrivacy.PUBLIC ]: 'Public', | 364 | [VideoPrivacy.PUBLIC]: 'Public', |
365 | [ VideoPrivacy.UNLISTED ]: 'Unlisted', | 365 | [VideoPrivacy.UNLISTED]: 'Unlisted', |
366 | [ VideoPrivacy.PRIVATE ]: 'Private', | 366 | [VideoPrivacy.PRIVATE]: 'Private', |
367 | [ VideoPrivacy.INTERNAL ]: 'Internal' | 367 | [VideoPrivacy.INTERNAL]: 'Internal' |
368 | } | 368 | } |
369 | 369 | ||
370 | const VIDEO_STATES = { | 370 | const VIDEO_STATES = { |
371 | [ VideoState.PUBLISHED ]: 'Published', | 371 | [VideoState.PUBLISHED]: 'Published', |
372 | [ VideoState.TO_TRANSCODE ]: 'To transcode', | 372 | [VideoState.TO_TRANSCODE]: 'To transcode', |
373 | [ VideoState.TO_IMPORT ]: 'To import' | 373 | [VideoState.TO_IMPORT]: 'To import' |
374 | } | 374 | } |
375 | 375 | ||
376 | const VIDEO_IMPORT_STATES = { | 376 | const VIDEO_IMPORT_STATES = { |
377 | [ VideoImportState.FAILED ]: 'Failed', | 377 | [VideoImportState.FAILED]: 'Failed', |
378 | [ VideoImportState.PENDING ]: 'Pending', | 378 | [VideoImportState.PENDING]: 'Pending', |
379 | [ VideoImportState.SUCCESS ]: 'Success' | 379 | [VideoImportState.SUCCESS]: 'Success' |
380 | } | 380 | } |
381 | 381 | ||
382 | const VIDEO_ABUSE_STATES = { | 382 | const VIDEO_ABUSE_STATES = { |
383 | [ VideoAbuseState.PENDING ]: 'Pending', | 383 | [VideoAbuseState.PENDING]: 'Pending', |
384 | [ VideoAbuseState.REJECTED ]: 'Rejected', | 384 | [VideoAbuseState.REJECTED]: 'Rejected', |
385 | [ VideoAbuseState.ACCEPTED ]: 'Accepted' | 385 | [VideoAbuseState.ACCEPTED]: 'Accepted' |
386 | } | 386 | } |
387 | 387 | ||
388 | const VIDEO_PLAYLIST_PRIVACIES = { | 388 | const VIDEO_PLAYLIST_PRIVACIES = { |
389 | [ VideoPlaylistPrivacy.PUBLIC ]: 'Public', | 389 | [VideoPlaylistPrivacy.PUBLIC]: 'Public', |
390 | [ VideoPlaylistPrivacy.UNLISTED ]: 'Unlisted', | 390 | [VideoPlaylistPrivacy.UNLISTED]: 'Unlisted', |
391 | [ VideoPlaylistPrivacy.PRIVATE ]: 'Private' | 391 | [VideoPlaylistPrivacy.PRIVATE]: 'Private' |
392 | } | 392 | } |
393 | 393 | ||
394 | const VIDEO_PLAYLIST_TYPES = { | 394 | const VIDEO_PLAYLIST_TYPES = { |
395 | [ VideoPlaylistType.REGULAR ]: 'Regular', | 395 | [VideoPlaylistType.REGULAR]: 'Regular', |
396 | [ VideoPlaylistType.WATCH_LATER ]: 'Watch later' | 396 | [VideoPlaylistType.WATCH_LATER]: 'Watch later' |
397 | } | 397 | } |
398 | 398 | ||
399 | const MIMETYPES = { | 399 | const MIMETYPES = { |
@@ -419,7 +419,8 @@ const MIMETYPES = { | |||
419 | 'image/png': '.png', | 419 | 'image/png': '.png', |
420 | 'image/jpg': '.jpg', | 420 | 'image/jpg': '.jpg', |
421 | 'image/jpeg': '.jpg' | 421 | 'image/jpeg': '.jpg' |
422 | } | 422 | }, |
423 | EXT_MIMETYPE: null as { [ id: string ]: string } | ||
423 | }, | 424 | }, |
424 | VIDEO_CAPTIONS: { | 425 | VIDEO_CAPTIONS: { |
425 | MIMETYPE_EXT: { | 426 | MIMETYPE_EXT: { |
@@ -435,13 +436,14 @@ const MIMETYPES = { | |||
435 | } | 436 | } |
436 | } | 437 | } |
437 | MIMETYPES.AUDIO.EXT_MIMETYPE = invert(MIMETYPES.AUDIO.MIMETYPE_EXT) | 438 | MIMETYPES.AUDIO.EXT_MIMETYPE = invert(MIMETYPES.AUDIO.MIMETYPE_EXT) |
439 | MIMETYPES.IMAGE.EXT_MIMETYPE = invert(MIMETYPES.IMAGE.MIMETYPE_EXT) | ||
438 | 440 | ||
439 | // --------------------------------------------------------------------------- | 441 | // --------------------------------------------------------------------------- |
440 | 442 | ||
441 | const OVERVIEWS = { | 443 | const OVERVIEWS = { |
442 | VIDEOS: { | 444 | VIDEOS: { |
443 | SAMPLE_THRESHOLD: 6, | 445 | SAMPLE_THRESHOLD: 6, |
444 | SAMPLES_COUNT: 2 | 446 | SAMPLES_COUNT: 20 |
445 | } | 447 | } |
446 | } | 448 | } |
447 | 449 | ||
@@ -462,7 +464,7 @@ const ACTIVITY_PUB = { | |||
462 | ACCEPT_HEADER: 'application/activity+json, application/ld+json', | 464 | ACCEPT_HEADER: 'application/activity+json, application/ld+json', |
463 | PUBLIC: 'https://www.w3.org/ns/activitystreams#Public', | 465 | PUBLIC: 'https://www.w3.org/ns/activitystreams#Public', |
464 | COLLECTION_ITEMS_PER_PAGE: 10, | 466 | COLLECTION_ITEMS_PER_PAGE: 10, |
465 | FETCH_PAGE_LIMIT: 100, | 467 | FETCH_PAGE_LIMIT: 2000, |
466 | URL_MIME_TYPES: { | 468 | URL_MIME_TYPES: { |
467 | VIDEO: [] as string[], | 469 | VIDEO: [] as string[], |
468 | TORRENT: [ 'application/x-bittorrent' ], | 470 | TORRENT: [ 'application/x-bittorrent' ], |
@@ -497,6 +499,7 @@ let PRIVATE_RSA_KEY_SIZE = 2048 | |||
497 | const BCRYPT_SALT_SIZE = 10 | 499 | const BCRYPT_SALT_SIZE = 10 |
498 | 500 | ||
499 | const USER_PASSWORD_RESET_LIFETIME = 60000 * 60 // 60 minutes | 501 | const USER_PASSWORD_RESET_LIFETIME = 60000 * 60 // 60 minutes |
502 | const USER_PASSWORD_CREATE_LIFETIME = 60000 * 60 * 24 * 7 // 7 days | ||
500 | 503 | ||
501 | const USER_EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes | 504 | const USER_EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes |
502 | 505 | ||
@@ -533,7 +536,7 @@ const LAZY_STATIC_PATHS = { | |||
533 | } | 536 | } |
534 | 537 | ||
535 | // Cache control | 538 | // Cache control |
536 | let STATIC_MAX_AGE = { | 539 | const STATIC_MAX_AGE = { |
537 | SERVER: '2h', | 540 | SERVER: '2h', |
538 | CLIENT: '30d' | 541 | CLIENT: '30d' |
539 | } | 542 | } |
@@ -541,11 +544,13 @@ let STATIC_MAX_AGE = { | |||
541 | // Videos thumbnail size | 544 | // Videos thumbnail size |
542 | const THUMBNAILS_SIZE = { | 545 | const THUMBNAILS_SIZE = { |
543 | width: 223, | 546 | width: 223, |
544 | height: 122 | 547 | height: 122, |
548 | minWidth: 150 | ||
545 | } | 549 | } |
546 | const PREVIEWS_SIZE = { | 550 | const PREVIEWS_SIZE = { |
547 | width: 850, | 551 | width: 850, |
548 | height: 480 | 552 | height: 480, |
553 | minWidth: 400 | ||
549 | } | 554 | } |
550 | const AVATARS_SIZE = { | 555 | const AVATARS_SIZE = { |
551 | width: 120, | 556 | width: 120, |
@@ -640,6 +645,8 @@ const P2P_MEDIA_LOADER_PEER_VERSION = 2 | |||
640 | const PLUGIN_GLOBAL_CSS_FILE_NAME = 'plugins-global.css' | 645 | const PLUGIN_GLOBAL_CSS_FILE_NAME = 'plugins-global.css' |
641 | const PLUGIN_GLOBAL_CSS_PATH = join(CONFIG.STORAGE.TMP_DIR, PLUGIN_GLOBAL_CSS_FILE_NAME) | 646 | const PLUGIN_GLOBAL_CSS_PATH = join(CONFIG.STORAGE.TMP_DIR, PLUGIN_GLOBAL_CSS_FILE_NAME) |
642 | 647 | ||
648 | let PLUGIN_EXTERNAL_AUTH_TOKEN_LIFETIME = 1000 * 60 * 5 // 5 minutes | ||
649 | |||
643 | const DEFAULT_THEME_NAME = 'default' | 650 | const DEFAULT_THEME_NAME = 'default' |
644 | const DEFAULT_USER_THEME_NAME = 'instance-default' | 651 | const DEFAULT_USER_THEME_NAME = 'instance-default' |
645 | 652 | ||
@@ -669,18 +676,20 @@ if (isTestInstance() === true) { | |||
669 | SCHEDULER_INTERVALS_MS.removeOldViews = 5000 | 676 | SCHEDULER_INTERVALS_MS.removeOldViews = 5000 |
670 | SCHEDULER_INTERVALS_MS.updateVideos = 5000 | 677 | SCHEDULER_INTERVALS_MS.updateVideos = 5000 |
671 | SCHEDULER_INTERVALS_MS.autoFollowIndexInstances = 5000 | 678 | SCHEDULER_INTERVALS_MS.autoFollowIndexInstances = 5000 |
672 | REPEAT_JOBS[ 'videos-views' ] = { every: 5000 } | 679 | REPEAT_JOBS['videos-views'] = { every: 5000 } |
673 | 680 | ||
674 | REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1 | 681 | REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1 |
675 | 682 | ||
676 | VIDEO_VIEW_LIFETIME = 1000 // 1 second | 683 | VIDEO_VIEW_LIFETIME = 1000 // 1 second |
677 | CONTACT_FORM_LIFETIME = 1000 // 1 second | 684 | CONTACT_FORM_LIFETIME = 1000 // 1 second |
678 | 685 | ||
679 | JOB_ATTEMPTS[ 'email' ] = 1 | 686 | JOB_ATTEMPTS['email'] = 1 |
680 | 687 | ||
681 | FILES_CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000 | 688 | FILES_CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000 |
682 | MEMOIZE_TTL.OVERVIEWS_SAMPLE = 1 | 689 | MEMOIZE_TTL.OVERVIEWS_SAMPLE = 3000 |
683 | ROUTE_CACHE_LIFETIME.OVERVIEWS.VIDEOS = '0ms' | 690 | OVERVIEWS.VIDEOS.SAMPLE_THRESHOLD = 2 |
691 | |||
692 | PLUGIN_EXTERNAL_AUTH_TOKEN_LIFETIME = 5000 | ||
684 | } | 693 | } |
685 | 694 | ||
686 | updateWebserverUrls() | 695 | updateWebserverUrls() |
@@ -757,6 +766,7 @@ export { | |||
757 | LRU_CACHE, | 766 | LRU_CACHE, |
758 | JOB_REQUEST_TIMEOUT, | 767 | JOB_REQUEST_TIMEOUT, |
759 | USER_PASSWORD_RESET_LIFETIME, | 768 | USER_PASSWORD_RESET_LIFETIME, |
769 | USER_PASSWORD_CREATE_LIFETIME, | ||
760 | MEMOIZE_TTL, | 770 | MEMOIZE_TTL, |
761 | USER_EMAIL_VERIFY_LIFETIME, | 771 | USER_EMAIL_VERIFY_LIFETIME, |
762 | OVERVIEWS, | 772 | OVERVIEWS, |
@@ -772,6 +782,7 @@ export { | |||
772 | VIDEO_VIEW_LIFETIME, | 782 | VIDEO_VIEW_LIFETIME, |
773 | CONTACT_FORM_LIFETIME, | 783 | CONTACT_FORM_LIFETIME, |
774 | VIDEO_PLAYLIST_PRIVACIES, | 784 | VIDEO_PLAYLIST_PRIVACIES, |
785 | PLUGIN_EXTERNAL_AUTH_TOKEN_LIFETIME, | ||
775 | ASSETS_PATH, | 786 | ASSETS_PATH, |
776 | loadLanguages, | 787 | loadLanguages, |
777 | buildLanguages | 788 | buildLanguages |
@@ -837,42 +848,42 @@ function loadLanguages () { | |||
837 | function buildLanguages () { | 848 | function buildLanguages () { |
838 | const iso639 = require('iso-639-3') | 849 | const iso639 = require('iso-639-3') |
839 | 850 | ||
840 | const languages: { [ id: string ]: string } = {} | 851 | const languages: { [id: string]: string } = {} |
841 | 852 | ||
842 | const additionalLanguages = { | 853 | const additionalLanguages = { |
843 | 'sgn': true, // Sign languages (macro language) | 854 | sgn: true, // Sign languages (macro language) |
844 | 'ase': true, // American sign language | 855 | ase: true, // American sign language |
845 | 'sdl': true, // Arabian sign language | 856 | sdl: true, // Arabian sign language |
846 | 'bfi': true, // British sign language | 857 | bfi: true, // British sign language |
847 | 'bzs': true, // Brazilian sign language | 858 | bzs: true, // Brazilian sign language |
848 | 'csl': true, // Chinese sign language | 859 | csl: true, // Chinese sign language |
849 | 'cse': true, // Czech sign language | 860 | cse: true, // Czech sign language |
850 | 'dsl': true, // Danish sign language | 861 | dsl: true, // Danish sign language |
851 | 'fsl': true, // French sign language | 862 | fsl: true, // French sign language |
852 | 'gsg': true, // German sign language | 863 | gsg: true, // German sign language |
853 | 'pks': true, // Pakistan sign language | 864 | pks: true, // Pakistan sign language |
854 | 'jsl': true, // Japanese sign language | 865 | jsl: true, // Japanese sign language |
855 | 'sfs': true, // South African sign language | 866 | sfs: true, // South African sign language |
856 | 'swl': true, // Swedish sign language | 867 | swl: true, // Swedish sign language |
857 | 'rsl': true, // Russian sign language: true | 868 | rsl: true, // Russian sign language: true |
858 | 869 | ||
859 | 'epo': true, // Esperanto | 870 | epo: true, // Esperanto |
860 | 'tlh': true, // Klingon | 871 | tlh: true, // Klingon |
861 | 'jbo': true, // Lojban | 872 | jbo: true, // Lojban |
862 | 'avk': true // Kotava | 873 | avk: true // Kotava |
863 | } | 874 | } |
864 | 875 | ||
865 | // Only add ISO639-1 languages and some sign languages (ISO639-3) | 876 | // Only add ISO639-1 languages and some sign languages (ISO639-3) |
866 | iso639 | 877 | iso639 |
867 | .filter(l => { | 878 | .filter(l => { |
868 | return (l.iso6391 !== null && l.type === 'living') || | 879 | return (l.iso6391 !== undefined && l.type === 'living') || |
869 | additionalLanguages[ l.iso6393 ] === true | 880 | additionalLanguages[l.iso6393] === true |
870 | }) | 881 | }) |
871 | .forEach(l => languages[ l.iso6391 || l.iso6393 ] = l.name) | 882 | .forEach(l => { languages[l.iso6391 || l.iso6393] = l.name }) |
872 | 883 | ||
873 | // Override Occitan label | 884 | // Override Occitan label |
874 | languages[ 'oc' ] = 'Occitan' | 885 | languages['oc'] = 'Occitan' |
875 | languages[ 'el' ] = 'Greek' | 886 | languages['el'] = 'Greek' |
876 | 887 | ||
877 | return languages | 888 | return languages |
878 | } | 889 | } |