diff options
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r-- | server/initializers/constants.ts | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index ae3d671bb..d4496bc34 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -61,6 +61,7 @@ const OAUTH_LIFETIME = { | |||
61 | const ROUTE_CACHE_LIFETIME = { | 61 | const ROUTE_CACHE_LIFETIME = { |
62 | FEEDS: '15 minutes', | 62 | FEEDS: '15 minutes', |
63 | ROBOTS: '2 hours', | 63 | ROBOTS: '2 hours', |
64 | SITEMAP: '1 day', | ||
64 | SECURITYTXT: '2 hours', | 65 | SECURITYTXT: '2 hours', |
65 | NODEINFO: '10 minutes', | 66 | NODEINFO: '10 minutes', |
66 | DNT_POLICY: '1 week', | 67 | DNT_POLICY: '1 week', |
@@ -102,7 +103,8 @@ const JOB_ATTEMPTS: { [ id in JobType ]: number } = { | |||
102 | 'video-file': 1, | 103 | 'video-file': 1, |
103 | 'video-import': 1, | 104 | 'video-import': 1, |
104 | 'email': 5, | 105 | 'email': 5, |
105 | 'videos-views': 1 | 106 | 'videos-views': 1, |
107 | 'activitypub-refresher': 1 | ||
106 | } | 108 | } |
107 | const JOB_CONCURRENCY: { [ id in JobType ]: number } = { | 109 | const JOB_CONCURRENCY: { [ id in JobType ]: number } = { |
108 | 'activitypub-http-broadcast': 1, | 110 | 'activitypub-http-broadcast': 1, |
@@ -113,7 +115,8 @@ const JOB_CONCURRENCY: { [ id in JobType ]: number } = { | |||
113 | 'video-file': 1, | 115 | 'video-file': 1, |
114 | 'video-import': 1, | 116 | 'video-import': 1, |
115 | 'email': 5, | 117 | 'email': 5, |
116 | 'videos-views': 1 | 118 | 'videos-views': 1, |
119 | 'activitypub-refresher': 1 | ||
117 | } | 120 | } |
118 | const JOB_TTL: { [ id in JobType ]: number } = { | 121 | const JOB_TTL: { [ id in JobType ]: number } = { |
119 | 'activitypub-http-broadcast': 60000 * 10, // 10 minutes | 122 | 'activitypub-http-broadcast': 60000 * 10, // 10 minutes |
@@ -124,11 +127,12 @@ const JOB_TTL: { [ id in JobType ]: number } = { | |||
124 | 'video-file': 1000 * 3600 * 48, // 2 days, transcoding could be long | 127 | 'video-file': 1000 * 3600 * 48, // 2 days, transcoding could be long |
125 | 'video-import': 1000 * 3600 * 2, // hours | 128 | 'video-import': 1000 * 3600 * 2, // hours |
126 | 'email': 60000 * 10, // 10 minutes | 129 | 'email': 60000 * 10, // 10 minutes |
127 | 'videos-views': undefined // Unlimited | 130 | 'videos-views': undefined, // Unlimited |
131 | 'activitypub-refresher': 60000 * 10 // 10 minutes | ||
128 | } | 132 | } |
129 | const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = { | 133 | const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = { |
130 | 'videos-views': { | 134 | 'videos-views': { |
131 | cron: '1 * * * *' // At 1 minutes past the hour | 135 | cron: '1 * * * *' // At 1 minute past the hour |
132 | } | 136 | } |
133 | } | 137 | } |
134 | 138 | ||
@@ -182,9 +186,11 @@ const CONFIG = { | |||
182 | FROM_ADDRESS: config.get<string>('smtp.from_address') | 186 | FROM_ADDRESS: config.get<string>('smtp.from_address') |
183 | }, | 187 | }, |
184 | STORAGE: { | 188 | STORAGE: { |
189 | TMP_DIR: buildPath(config.get<string>('storage.tmp')), | ||
185 | AVATARS_DIR: buildPath(config.get<string>('storage.avatars')), | 190 | AVATARS_DIR: buildPath(config.get<string>('storage.avatars')), |
186 | LOG_DIR: buildPath(config.get<string>('storage.logs')), | 191 | LOG_DIR: buildPath(config.get<string>('storage.logs')), |
187 | VIDEOS_DIR: buildPath(config.get<string>('storage.videos')), | 192 | VIDEOS_DIR: buildPath(config.get<string>('storage.videos')), |
193 | REDUNDANCY_DIR: buildPath(config.get<string>('storage.redundancy')), | ||
188 | THUMBNAILS_DIR: buildPath(config.get<string>('storage.thumbnails')), | 194 | THUMBNAILS_DIR: buildPath(config.get<string>('storage.thumbnails')), |
189 | PREVIEWS_DIR: buildPath(config.get<string>('storage.previews')), | 195 | PREVIEWS_DIR: buildPath(config.get<string>('storage.previews')), |
190 | CAPTIONS_DIR: buildPath(config.get<string>('storage.captions')), | 196 | CAPTIONS_DIR: buildPath(config.get<string>('storage.captions')), |
@@ -294,9 +300,9 @@ const CONFIG = { | |||
294 | 300 | ||
295 | const CONSTRAINTS_FIELDS = { | 301 | const CONSTRAINTS_FIELDS = { |
296 | USERS: { | 302 | USERS: { |
297 | NAME: { min: 3, max: 120 }, // Length | 303 | NAME: { min: 1, max: 50 }, // Length |
298 | DESCRIPTION: { min: 3, max: 1000 }, // Length | 304 | DESCRIPTION: { min: 3, max: 1000 }, // Length |
299 | USERNAME: { min: 3, max: 20 }, // Length | 305 | USERNAME: { min: 1, max: 50 }, // Length |
300 | PASSWORD: { min: 6, max: 255 }, // Length | 306 | PASSWORD: { min: 6, max: 255 }, // Length |
301 | VIDEO_QUOTA: { min: -1 }, | 307 | VIDEO_QUOTA: { min: -1 }, |
302 | VIDEO_QUOTA_DAILY: { min: -1 }, | 308 | VIDEO_QUOTA_DAILY: { min: -1 }, |
@@ -310,7 +316,7 @@ const CONSTRAINTS_FIELDS = { | |||
310 | REASON: { min: 2, max: 300 } // Length | 316 | REASON: { min: 2, max: 300 } // Length |
311 | }, | 317 | }, |
312 | VIDEO_CHANNELS: { | 318 | VIDEO_CHANNELS: { |
313 | NAME: { min: 3, max: 120 }, // Length | 319 | NAME: { min: 1, max: 50 }, // Length |
314 | DESCRIPTION: { min: 3, max: 1000 }, // Length | 320 | DESCRIPTION: { min: 3, max: 1000 }, // Length |
315 | SUPPORT: { min: 3, max: 1000 }, // Length | 321 | SUPPORT: { min: 3, max: 1000 }, // Length |
316 | URL: { min: 3, max: 2000 } // Length | 322 | URL: { min: 3, max: 2000 } // Length |
@@ -543,7 +549,7 @@ const HTTP_SIGNATURE = { | |||
543 | 549 | ||
544 | // --------------------------------------------------------------------------- | 550 | // --------------------------------------------------------------------------- |
545 | 551 | ||
546 | const PRIVATE_RSA_KEY_SIZE = 2048 | 552 | let PRIVATE_RSA_KEY_SIZE = 2048 |
547 | 553 | ||
548 | // Password encryption | 554 | // Password encryption |
549 | const BCRYPT_SALT_SIZE = 10 | 555 | const BCRYPT_SALT_SIZE = 10 |
@@ -566,6 +572,7 @@ const STATIC_PATHS = { | |||
566 | THUMBNAILS: '/static/thumbnails/', | 572 | THUMBNAILS: '/static/thumbnails/', |
567 | TORRENTS: '/static/torrents/', | 573 | TORRENTS: '/static/torrents/', |
568 | WEBSEED: '/static/webseed/', | 574 | WEBSEED: '/static/webseed/', |
575 | REDUNDANCY: '/static/redundancy/', | ||
569 | AVATARS: '/static/avatars/', | 576 | AVATARS: '/static/avatars/', |
570 | VIDEO_CAPTIONS: '/static/video-captions/' | 577 | VIDEO_CAPTIONS: '/static/video-captions/' |
571 | } | 578 | } |
@@ -647,6 +654,8 @@ const TRACKER_RATE_LIMITS = { | |||
647 | 654 | ||
648 | // Special constants for a test instance | 655 | // Special constants for a test instance |
649 | if (isTestInstance() === true) { | 656 | if (isTestInstance() === true) { |
657 | PRIVATE_RSA_KEY_SIZE = 1024 | ||
658 | |||
650 | ACTOR_FOLLOW_SCORE.BASE = 20 | 659 | ACTOR_FOLLOW_SCORE.BASE = 20 |
651 | 660 | ||
652 | REMOTE_SCHEME.HTTP = 'http' | 661 | REMOTE_SCHEME.HTTP = 'http' |
@@ -768,7 +777,7 @@ function buildVideosRedundancy (objs: any[]): VideosRedundancy[] { | |||
768 | if (!objs) return [] | 777 | if (!objs) return [] |
769 | 778 | ||
770 | return objs.map(obj => { | 779 | return objs.map(obj => { |
771 | return Object.assign(obj, { | 780 | return Object.assign({}, obj, { |
772 | minLifetime: parseDuration(obj.min_lifetime), | 781 | minLifetime: parseDuration(obj.min_lifetime), |
773 | size: bytes.parse(obj.size), | 782 | size: bytes.parse(obj.size), |
774 | minViews: obj.min_views | 783 | minViews: obj.min_views |