aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/constants.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-31 16:56:52 +0100
committerChocobozzz <me@florianbigard.com>2020-02-03 08:31:02 +0100
commita15871560f80e07386c1dabb8370cd2664ecfd1f (patch)
tree44440e140c9e43b0d7f97ade777a76e649e0553d /server/initializers/constants.ts
parenta22046d166805222ca76060e471b6cb3d419a32d (diff)
downloadPeerTube-a15871560f80e07386c1dabb8370cd2664ecfd1f.tar.gz
PeerTube-a15871560f80e07386c1dabb8370cd2664ecfd1f.tar.zst
PeerTube-a15871560f80e07386c1dabb8370cd2664ecfd1f.zip
Move to eslintcontain
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r--server/initializers/constants.ts100
1 files changed, 50 insertions, 50 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 3a9946bba..fb8ae7cd6 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -4,7 +4,7 @@ import { ActivityPubActorType } from '../../shared/models/activitypub'
4import { FollowState } from '../../shared/models/actors' 4import { FollowState } from '../../shared/models/actors'
5import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos' 5import { 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
7import { isTestInstance, sanitizeHost, sanitizeUrl, root, parseDurationToMs } from '../helpers/core-utils' 7import { isTestInstance, sanitizeHost, sanitizeUrl, root } from '../helpers/core-utils'
8import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' 8import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
9import { invert } from 'lodash' 9import { invert } from 'lodash'
10import { CronRepeatOptions, EveryRepeatOptions } from 'bull' 10import { CronRepeatOptions, EveryRepeatOptions } from 'bull'
@@ -310,8 +310,8 @@ let CONTACT_FORM_LIFETIME = 60000 * 60 // 1 hour
310 310
311const VIDEO_TRANSCODING_FPS: VideoTranscodingFPS = { 311const VIDEO_TRANSCODING_FPS: VideoTranscodingFPS = {
312 MIN: 10, 312 MIN: 10,
313 STANDARD: [24, 25, 30], 313 STANDARD: [ 24, 25, 30 ],
314 HD_STANDARD: [50, 60], 314 HD_STANDARD: [ 50, 60 ],
315 AVERAGE: 30, 315 AVERAGE: 30,
316 MAX: 60, 316 MAX: 60,
317 KEEP_ORIGIN_FPS_RESOLUTION_MIN: 720 // We keep the original FPS on high resolutions (720 minimum) 317 KEEP_ORIGIN_FPS_RESOLUTION_MIN: 720 // We keep the original FPS on high resolutions (720 minimum)
@@ -361,42 +361,42 @@ const VIDEO_LICENCES = {
361 7: 'Public Domain Dedication' 361 7: 'Public Domain Dedication'
362} 362}
363 363
364let VIDEO_LANGUAGES: { [id: string]: string } = {} 364const VIDEO_LANGUAGES: { [id: string]: string } = {}
365 365
366const VIDEO_PRIVACIES = { 366const VIDEO_PRIVACIES = {
367 [ VideoPrivacy.PUBLIC ]: 'Public', 367 [VideoPrivacy.PUBLIC]: 'Public',
368 [ VideoPrivacy.UNLISTED ]: 'Unlisted', 368 [VideoPrivacy.UNLISTED]: 'Unlisted',
369 [ VideoPrivacy.PRIVATE ]: 'Private', 369 [VideoPrivacy.PRIVATE]: 'Private',
370 [ VideoPrivacy.INTERNAL ]: 'Internal' 370 [VideoPrivacy.INTERNAL]: 'Internal'
371} 371}
372 372
373const VIDEO_STATES = { 373const VIDEO_STATES = {
374 [ VideoState.PUBLISHED ]: 'Published', 374 [VideoState.PUBLISHED]: 'Published',
375 [ VideoState.TO_TRANSCODE ]: 'To transcode', 375 [VideoState.TO_TRANSCODE]: 'To transcode',
376 [ VideoState.TO_IMPORT ]: 'To import' 376 [VideoState.TO_IMPORT]: 'To import'
377} 377}
378 378
379const VIDEO_IMPORT_STATES = { 379const VIDEO_IMPORT_STATES = {
380 [ VideoImportState.FAILED ]: 'Failed', 380 [VideoImportState.FAILED]: 'Failed',
381 [ VideoImportState.PENDING ]: 'Pending', 381 [VideoImportState.PENDING]: 'Pending',
382 [ VideoImportState.SUCCESS ]: 'Success' 382 [VideoImportState.SUCCESS]: 'Success'
383} 383}
384 384
385const VIDEO_ABUSE_STATES = { 385const VIDEO_ABUSE_STATES = {
386 [ VideoAbuseState.PENDING ]: 'Pending', 386 [VideoAbuseState.PENDING]: 'Pending',
387 [ VideoAbuseState.REJECTED ]: 'Rejected', 387 [VideoAbuseState.REJECTED]: 'Rejected',
388 [ VideoAbuseState.ACCEPTED ]: 'Accepted' 388 [VideoAbuseState.ACCEPTED]: 'Accepted'
389} 389}
390 390
391const VIDEO_PLAYLIST_PRIVACIES = { 391const VIDEO_PLAYLIST_PRIVACIES = {
392 [ VideoPlaylistPrivacy.PUBLIC ]: 'Public', 392 [VideoPlaylistPrivacy.PUBLIC]: 'Public',
393 [ VideoPlaylistPrivacy.UNLISTED ]: 'Unlisted', 393 [VideoPlaylistPrivacy.UNLISTED]: 'Unlisted',
394 [ VideoPlaylistPrivacy.PRIVATE ]: 'Private' 394 [VideoPlaylistPrivacy.PRIVATE]: 'Private'
395} 395}
396 396
397const VIDEO_PLAYLIST_TYPES = { 397const VIDEO_PLAYLIST_TYPES = {
398 [ VideoPlaylistType.REGULAR ]: 'Regular', 398 [VideoPlaylistType.REGULAR]: 'Regular',
399 [ VideoPlaylistType.WATCH_LATER ]: 'Watch later' 399 [VideoPlaylistType.WATCH_LATER]: 'Watch later'
400} 400}
401 401
402const MIMETYPES = { 402const MIMETYPES = {
@@ -533,7 +533,7 @@ const LAZY_STATIC_PATHS = {
533} 533}
534 534
535// Cache control 535// Cache control
536let STATIC_MAX_AGE = { 536const STATIC_MAX_AGE = {
537 SERVER: '2h', 537 SERVER: '2h',
538 CLIENT: '30d' 538 CLIENT: '30d'
539} 539}
@@ -671,14 +671,14 @@ if (isTestInstance() === true) {
671 SCHEDULER_INTERVALS_MS.removeOldViews = 5000 671 SCHEDULER_INTERVALS_MS.removeOldViews = 5000
672 SCHEDULER_INTERVALS_MS.updateVideos = 5000 672 SCHEDULER_INTERVALS_MS.updateVideos = 5000
673 SCHEDULER_INTERVALS_MS.autoFollowIndexInstances = 5000 673 SCHEDULER_INTERVALS_MS.autoFollowIndexInstances = 5000
674 REPEAT_JOBS[ 'videos-views' ] = { every: 5000 } 674 REPEAT_JOBS['videos-views'] = { every: 5000 }
675 675
676 REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1 676 REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1
677 677
678 VIDEO_VIEW_LIFETIME = 1000 // 1 second 678 VIDEO_VIEW_LIFETIME = 1000 // 1 second
679 CONTACT_FORM_LIFETIME = 1000 // 1 second 679 CONTACT_FORM_LIFETIME = 1000 // 1 second
680 680
681 JOB_ATTEMPTS[ 'email' ] = 1 681 JOB_ATTEMPTS['email'] = 1
682 682
683 FILES_CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000 683 FILES_CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000
684 MEMOIZE_TTL.OVERVIEWS_SAMPLE = 1 684 MEMOIZE_TTL.OVERVIEWS_SAMPLE = 1
@@ -838,42 +838,42 @@ function loadLanguages () {
838function buildLanguages () { 838function buildLanguages () {
839 const iso639 = require('iso-639-3') 839 const iso639 = require('iso-639-3')
840 840
841 const languages: { [ id: string ]: string } = {} 841 const languages: { [id: string]: string } = {}
842 842
843 const additionalLanguages = { 843 const additionalLanguages = {
844 'sgn': true, // Sign languages (macro language) 844 sgn: true, // Sign languages (macro language)
845 'ase': true, // American sign language 845 ase: true, // American sign language
846 'sdl': true, // Arabian sign language 846 sdl: true, // Arabian sign language
847 'bfi': true, // British sign language 847 bfi: true, // British sign language
848 'bzs': true, // Brazilian sign language 848 bzs: true, // Brazilian sign language
849 'csl': true, // Chinese sign language 849 csl: true, // Chinese sign language
850 'cse': true, // Czech sign language 850 cse: true, // Czech sign language
851 'dsl': true, // Danish sign language 851 dsl: true, // Danish sign language
852 'fsl': true, // French sign language 852 fsl: true, // French sign language
853 'gsg': true, // German sign language 853 gsg: true, // German sign language
854 'pks': true, // Pakistan sign language 854 pks: true, // Pakistan sign language
855 'jsl': true, // Japanese sign language 855 jsl: true, // Japanese sign language
856 'sfs': true, // South African sign language 856 sfs: true, // South African sign language
857 'swl': true, // Swedish sign language 857 swl: true, // Swedish sign language
858 'rsl': true, // Russian sign language: true 858 rsl: true, // Russian sign language: true
859 859
860 'epo': true, // Esperanto 860 epo: true, // Esperanto
861 'tlh': true, // Klingon 861 tlh: true, // Klingon
862 'jbo': true, // Lojban 862 jbo: true, // Lojban
863 'avk': true // Kotava 863 avk: true // Kotava
864 } 864 }
865 865
866 // Only add ISO639-1 languages and some sign languages (ISO639-3) 866 // Only add ISO639-1 languages and some sign languages (ISO639-3)
867 iso639 867 iso639
868 .filter(l => { 868 .filter(l => {
869 return (l.iso6391 !== null && l.type === 'living') || 869 return (l.iso6391 !== null && l.type === 'living') ||
870 additionalLanguages[ l.iso6393 ] === true 870 additionalLanguages[l.iso6393] === true
871 }) 871 })
872 .forEach(l => languages[ l.iso6391 || l.iso6393 ] = l.name) 872 .forEach(l => { languages[l.iso6391 || l.iso6393] = l.name })
873 873
874 // Override Occitan label 874 // Override Occitan label
875 languages[ 'oc' ] = 'Occitan' 875 languages['oc'] = 'Occitan'
876 languages[ 'el' ] = 'Greek' 876 languages['el'] = 'Greek'
877 877
878 return languages 878 return languages
879} 879}