diff options
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r-- | server/initializers/constants.ts | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 0e56f0c9f..992c86ed2 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -6,6 +6,7 @@ import { randomInt, root } from '@shared/core-utils' | |||
6 | import { | 6 | import { |
7 | AbuseState, | 7 | AbuseState, |
8 | JobType, | 8 | JobType, |
9 | UserRegistrationState, | ||
9 | VideoChannelSyncState, | 10 | VideoChannelSyncState, |
10 | VideoImportState, | 11 | VideoImportState, |
11 | VideoPrivacy, | 12 | VideoPrivacy, |
@@ -25,7 +26,7 @@ import { CONFIG, registerConfigChangedHandler } from './config' | |||
25 | 26 | ||
26 | // --------------------------------------------------------------------------- | 27 | // --------------------------------------------------------------------------- |
27 | 28 | ||
28 | const LAST_MIGRATION_VERSION = 745 | 29 | const LAST_MIGRATION_VERSION = 755 |
29 | 30 | ||
30 | // --------------------------------------------------------------------------- | 31 | // --------------------------------------------------------------------------- |
31 | 32 | ||
@@ -78,6 +79,8 @@ const SORTABLE_COLUMNS = { | |||
78 | ACCOUNT_FOLLOWERS: [ 'createdAt' ], | 79 | ACCOUNT_FOLLOWERS: [ 'createdAt' ], |
79 | CHANNEL_FOLLOWERS: [ 'createdAt' ], | 80 | CHANNEL_FOLLOWERS: [ 'createdAt' ], |
80 | 81 | ||
82 | USER_REGISTRATIONS: [ 'createdAt', 'state' ], | ||
83 | |||
81 | VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'originallyPublishedAt', 'views', 'likes', 'trending', 'hot', 'best' ], | 84 | VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'originallyPublishedAt', 'views', 'likes', 'trending', 'hot', 'best' ], |
82 | 85 | ||
83 | // Don't forget to update peertube-search-index with the same values | 86 | // Don't forget to update peertube-search-index with the same values |
@@ -101,11 +104,6 @@ const SORTABLE_COLUMNS = { | |||
101 | VIDEO_REDUNDANCIES: [ 'name' ] | 104 | VIDEO_REDUNDANCIES: [ 'name' ] |
102 | } | 105 | } |
103 | 106 | ||
104 | const OAUTH_LIFETIME = { | ||
105 | ACCESS_TOKEN: 3600 * 24, // 1 day, for upload | ||
106 | REFRESH_TOKEN: 1209600 // 2 weeks | ||
107 | } | ||
108 | |||
109 | const ROUTE_CACHE_LIFETIME = { | 107 | const ROUTE_CACHE_LIFETIME = { |
110 | FEEDS: '15 minutes', | 108 | FEEDS: '15 minutes', |
111 | ROBOTS: '2 hours', | 109 | ROBOTS: '2 hours', |
@@ -295,6 +293,10 @@ const CONSTRAINTS_FIELDS = { | |||
295 | ABUSE_MESSAGES: { | 293 | ABUSE_MESSAGES: { |
296 | MESSAGE: { min: 2, max: 3000 } // Length | 294 | MESSAGE: { min: 2, max: 3000 } // Length |
297 | }, | 295 | }, |
296 | USER_REGISTRATIONS: { | ||
297 | REASON_MESSAGE: { min: 2, max: 3000 }, // Length | ||
298 | MODERATOR_MESSAGE: { min: 2, max: 3000 } // Length | ||
299 | }, | ||
298 | VIDEO_BLACKLIST: { | 300 | VIDEO_BLACKLIST: { |
299 | REASON: { min: 2, max: 300 } // Length | 301 | REASON: { min: 2, max: 300 } // Length |
300 | }, | 302 | }, |
@@ -521,6 +523,12 @@ const ABUSE_STATES: { [ id in AbuseState ]: string } = { | |||
521 | [AbuseState.ACCEPTED]: 'Accepted' | 523 | [AbuseState.ACCEPTED]: 'Accepted' |
522 | } | 524 | } |
523 | 525 | ||
526 | const USER_REGISTRATION_STATES: { [ id in UserRegistrationState ]: string } = { | ||
527 | [UserRegistrationState.PENDING]: 'Pending', | ||
528 | [UserRegistrationState.REJECTED]: 'Rejected', | ||
529 | [UserRegistrationState.ACCEPTED]: 'Accepted' | ||
530 | } | ||
531 | |||
524 | const VIDEO_PLAYLIST_PRIVACIES: { [ id in VideoPlaylistPrivacy ]: string } = { | 532 | const VIDEO_PLAYLIST_PRIVACIES: { [ id in VideoPlaylistPrivacy ]: string } = { |
525 | [VideoPlaylistPrivacy.PUBLIC]: 'Public', | 533 | [VideoPlaylistPrivacy.PUBLIC]: 'Public', |
526 | [VideoPlaylistPrivacy.UNLISTED]: 'Unlisted', | 534 | [VideoPlaylistPrivacy.UNLISTED]: 'Unlisted', |
@@ -665,7 +673,7 @@ const USER_PASSWORD_CREATE_LIFETIME = 60000 * 60 * 24 * 7 // 7 days | |||
665 | 673 | ||
666 | const TWO_FACTOR_AUTH_REQUEST_TOKEN_LIFETIME = 60000 * 10 // 10 minutes | 674 | const TWO_FACTOR_AUTH_REQUEST_TOKEN_LIFETIME = 60000 * 10 // 10 minutes |
667 | 675 | ||
668 | const USER_EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes | 676 | const EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes |
669 | 677 | ||
670 | const NSFW_POLICY_TYPES: { [ id: string ]: NSFWPolicyType } = { | 678 | const NSFW_POLICY_TYPES: { [ id: string ]: NSFWPolicyType } = { |
671 | DO_NOT_LIST: 'do_not_list', | 679 | DO_NOT_LIST: 'do_not_list', |
@@ -781,6 +789,9 @@ const LRU_CACHE = { | |||
781 | VIDEO_TOKENS: { | 789 | VIDEO_TOKENS: { |
782 | MAX_SIZE: 100_000, | 790 | MAX_SIZE: 100_000, |
783 | TTL: parseDurationToMs('8 hours') | 791 | TTL: parseDurationToMs('8 hours') |
792 | }, | ||
793 | TRACKER_IPS: { | ||
794 | MAX_SIZE: 100_000 | ||
784 | } | 795 | } |
785 | } | 796 | } |
786 | 797 | ||
@@ -884,7 +895,7 @@ const TRACKER_RATE_LIMITS = { | |||
884 | INTERVAL: 60000 * 5, // 5 minutes | 895 | INTERVAL: 60000 * 5, // 5 minutes |
885 | ANNOUNCES_PER_IP_PER_INFOHASH: 15, // maximum announces per torrent in the interval | 896 | ANNOUNCES_PER_IP_PER_INFOHASH: 15, // maximum announces per torrent in the interval |
886 | ANNOUNCES_PER_IP: 30, // maximum announces for all our torrents in the interval | 897 | ANNOUNCES_PER_IP: 30, // maximum announces for all our torrents in the interval |
887 | BLOCK_IP_LIFETIME: 60000 * 3 // 3 minutes | 898 | BLOCK_IP_LIFETIME: parseDurationToMs('3 minutes') |
888 | } | 899 | } |
889 | 900 | ||
890 | const P2P_MEDIA_LOADER_PEER_VERSION = 2 | 901 | const P2P_MEDIA_LOADER_PEER_VERSION = 2 |
@@ -1030,7 +1041,6 @@ export { | |||
1030 | JOB_ATTEMPTS, | 1041 | JOB_ATTEMPTS, |
1031 | AP_CLEANER, | 1042 | AP_CLEANER, |
1032 | LAST_MIGRATION_VERSION, | 1043 | LAST_MIGRATION_VERSION, |
1033 | OAUTH_LIFETIME, | ||
1034 | CUSTOM_HTML_TAG_COMMENTS, | 1044 | CUSTOM_HTML_TAG_COMMENTS, |
1035 | STATS_TIMESERIE, | 1045 | STATS_TIMESERIE, |
1036 | BROADCAST_CONCURRENCY, | 1046 | BROADCAST_CONCURRENCY, |
@@ -1072,13 +1082,14 @@ export { | |||
1072 | VIDEO_TRANSCODING_FPS, | 1082 | VIDEO_TRANSCODING_FPS, |
1073 | FFMPEG_NICE, | 1083 | FFMPEG_NICE, |
1074 | ABUSE_STATES, | 1084 | ABUSE_STATES, |
1085 | USER_REGISTRATION_STATES, | ||
1075 | LRU_CACHE, | 1086 | LRU_CACHE, |
1076 | REQUEST_TIMEOUTS, | 1087 | REQUEST_TIMEOUTS, |
1077 | MAX_LOCAL_VIEWER_WATCH_SECTIONS, | 1088 | MAX_LOCAL_VIEWER_WATCH_SECTIONS, |
1078 | USER_PASSWORD_RESET_LIFETIME, | 1089 | USER_PASSWORD_RESET_LIFETIME, |
1079 | USER_PASSWORD_CREATE_LIFETIME, | 1090 | USER_PASSWORD_CREATE_LIFETIME, |
1080 | MEMOIZE_TTL, | 1091 | MEMOIZE_TTL, |
1081 | USER_EMAIL_VERIFY_LIFETIME, | 1092 | EMAIL_VERIFY_LIFETIME, |
1082 | OVERVIEWS, | 1093 | OVERVIEWS, |
1083 | SCHEDULER_INTERVALS_MS, | 1094 | SCHEDULER_INTERVALS_MS, |
1084 | REPEAT_JOBS, | 1095 | REPEAT_JOBS, |