aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/constants.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r--server/initializers/constants.ts35
1 files changed, 23 insertions, 12 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 50467f408..1802257df 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -24,12 +24,12 @@ import { CONFIG, registerConfigChangedHandler } from './config'
24 24
25// --------------------------------------------------------------------------- 25// ---------------------------------------------------------------------------
26 26
27const LAST_MIGRATION_VERSION = 612 27const LAST_MIGRATION_VERSION = 635
28 28
29// --------------------------------------------------------------------------- 29// ---------------------------------------------------------------------------
30 30
31const API_VERSION = 'v1' 31const API_VERSION = 'v1'
32const PEERTUBE_VERSION = require(join(root(), 'package.json')).version 32const PEERTUBE_VERSION: string = require(join(root(), 'package.json')).version
33 33
34const PAGINATION = { 34const PAGINATION = {
35 GLOBAL: { 35 GLOBAL: {
@@ -207,6 +207,7 @@ const SCHEDULER_INTERVALS_MS = {
207 updateVideos: 60000, // 1 minute 207 updateVideos: 60000, // 1 minute
208 youtubeDLUpdate: 60000 * 60 * 24, // 1 day 208 youtubeDLUpdate: 60000 * 60 * 24, // 1 day
209 checkPlugins: CONFIG.PLUGINS.INDEX.CHECK_LATEST_VERSIONS_INTERVAL, 209 checkPlugins: CONFIG.PLUGINS.INDEX.CHECK_LATEST_VERSIONS_INTERVAL,
210 checkPeerTubeVersion: 60000 * 60 * 24, // 1 day
210 autoFollowIndexInstances: 60000 * 60 * 24, // 1 day 211 autoFollowIndexInstances: 60000 * 60 * 24, // 1 day
211 removeOldViews: 60000 * 60 * 24, // 1 day 212 removeOldViews: 60000 * 60 * 24, // 1 day
212 removeOldHistory: 60000 * 60 * 24, // 1 day 213 removeOldHistory: 60000 * 60 * 24, // 1 day
@@ -304,7 +305,7 @@ const CONSTRAINTS_FIELDS = {
304 PUBLIC_KEY: { min: 10, max: 5000 }, // Length 305 PUBLIC_KEY: { min: 10, max: 5000 }, // Length
305 PRIVATE_KEY: { min: 10, max: 5000 }, // Length 306 PRIVATE_KEY: { min: 10, max: 5000 }, // Length
306 URL: { min: 3, max: 2000 }, // Length 307 URL: { min: 3, max: 2000 }, // Length
307 AVATAR: { 308 IMAGE: {
308 EXTNAME: [ '.png', '.jpeg', '.jpg', '.gif', '.webp' ], 309 EXTNAME: [ '.png', '.jpeg', '.jpg', '.gif', '.webp' ],
309 FILE_SIZE: { 310 FILE_SIZE: {
310 max: 2 * 1024 * 1024 // 2MB 311 max: 2 * 1024 * 1024 // 2MB
@@ -465,6 +466,8 @@ const MIMETYPES = {
465 IMAGE: { 466 IMAGE: {
466 MIMETYPE_EXT: { 467 MIMETYPE_EXT: {
467 'image/png': '.png', 468 'image/png': '.png',
469 'image/gif': '.gif',
470 'image/webp': '.webp',
468 'image/jpg': '.jpg', 471 'image/jpg': '.jpg',
469 'image/jpeg': '.jpg' 472 'image/jpeg': '.jpg'
470 }, 473 },
@@ -579,6 +582,7 @@ const STATIC_DOWNLOAD_PATHS = {
579 HLS_VIDEOS: '/download/streaming-playlists/hls/videos/' 582 HLS_VIDEOS: '/download/streaming-playlists/hls/videos/'
580} 583}
581const LAZY_STATIC_PATHS = { 584const LAZY_STATIC_PATHS = {
585 BANNERS: '/lazy-static/banners/',
582 AVATARS: '/lazy-static/avatars/', 586 AVATARS: '/lazy-static/avatars/',
583 PREVIEWS: '/lazy-static/previews/', 587 PREVIEWS: '/lazy-static/previews/',
584 VIDEO_CAPTIONS: '/lazy-static/video-captions/', 588 VIDEO_CAPTIONS: '/lazy-static/video-captions/',
@@ -594,8 +598,8 @@ const STATIC_MAX_AGE = {
594 598
595// Videos thumbnail size 599// Videos thumbnail size
596const THUMBNAILS_SIZE = { 600const THUMBNAILS_SIZE = {
597 width: 223, 601 width: 280,
598 height: 122, 602 height: 157,
599 minWidth: 150 603 minWidth: 150
600} 604}
601const PREVIEWS_SIZE = { 605const PREVIEWS_SIZE = {
@@ -603,9 +607,15 @@ const PREVIEWS_SIZE = {
603 height: 480, 607 height: 480,
604 minWidth: 400 608 minWidth: 400
605} 609}
606const AVATARS_SIZE = { 610const ACTOR_IMAGES_SIZE = {
607 width: 120, 611 AVATARS: {
608 height: 120 612 width: 120,
613 height: 120
614 },
615 BANNERS: {
616 width: 1920,
617 height: 317 // 6/1 ratio
618 }
609} 619}
610 620
611const EMBED_SIZE = { 621const EMBED_SIZE = {
@@ -633,7 +643,7 @@ const LRU_CACHE = {
633 USER_TOKENS: { 643 USER_TOKENS: {
634 MAX_SIZE: 1000 644 MAX_SIZE: 1000
635 }, 645 },
636 AVATAR_STATIC: { 646 ACTOR_IMAGE_STATIC: {
637 MAX_SIZE: 500 647 MAX_SIZE: 500
638 } 648 }
639} 649}
@@ -670,7 +680,7 @@ const MEMOIZE_LENGTH = {
670} 680}
671 681
672const QUEUE_CONCURRENCY = { 682const QUEUE_CONCURRENCY = {
673 AVATAR_PROCESS_IMAGE: 3 683 ACTOR_PROCESS_IMAGE: 3
674} 684}
675 685
676const REDUNDANCY = { 686const REDUNDANCY = {
@@ -753,7 +763,7 @@ if (isTestInstance() === true) {
753 ACTIVITY_PUB.VIDEO_REFRESH_INTERVAL = 10 * 1000 // 10 seconds 763 ACTIVITY_PUB.VIDEO_REFRESH_INTERVAL = 10 * 1000 // 10 seconds
754 ACTIVITY_PUB.VIDEO_PLAYLIST_REFRESH_INTERVAL = 10 * 1000 // 10 seconds 764 ACTIVITY_PUB.VIDEO_PLAYLIST_REFRESH_INTERVAL = 10 * 1000 // 10 seconds
755 765
756 CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB 766 CONSTRAINTS_FIELDS.ACTORS.IMAGE.FILE_SIZE.max = 100 * 1024 // 100KB
757 CONSTRAINTS_FIELDS.VIDEOS.IMAGE.FILE_SIZE.max = 400 * 1024 // 400KB 767 CONSTRAINTS_FIELDS.VIDEOS.IMAGE.FILE_SIZE.max = 400 * 1024 // 400KB
758 768
759 SCHEDULER_INTERVALS_MS.actorFollowScores = 1000 769 SCHEDULER_INTERVALS_MS.actorFollowScores = 1000
@@ -763,6 +773,7 @@ if (isTestInstance() === true) {
763 SCHEDULER_INTERVALS_MS.updateVideos = 5000 773 SCHEDULER_INTERVALS_MS.updateVideos = 5000
764 SCHEDULER_INTERVALS_MS.autoFollowIndexInstances = 5000 774 SCHEDULER_INTERVALS_MS.autoFollowIndexInstances = 5000
765 SCHEDULER_INTERVALS_MS.updateInboxStats = 5000 775 SCHEDULER_INTERVALS_MS.updateInboxStats = 5000
776 SCHEDULER_INTERVALS_MS.checkPeerTubeVersion = 2000
766 REPEAT_JOBS['videos-views'] = { every: 5000 } 777 REPEAT_JOBS['videos-views'] = { every: 5000 }
767 REPEAT_JOBS['activitypub-cleaner'] = { every: 5000 } 778 REPEAT_JOBS['activitypub-cleaner'] = { every: 5000 }
768 779
@@ -813,7 +824,7 @@ export {
813 SEARCH_INDEX, 824 SEARCH_INDEX,
814 HLS_REDUNDANCY_DIRECTORY, 825 HLS_REDUNDANCY_DIRECTORY,
815 P2P_MEDIA_LOADER_PEER_VERSION, 826 P2P_MEDIA_LOADER_PEER_VERSION,
816 AVATARS_SIZE, 827 ACTOR_IMAGES_SIZE,
817 ACCEPT_HEADERS, 828 ACCEPT_HEADERS,
818 BCRYPT_SALT_SIZE, 829 BCRYPT_SALT_SIZE,
819 TRACKER_RATE_LIMITS, 830 TRACKER_RATE_LIMITS,