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.ts23
1 files changed, 20 insertions, 3 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 7039ab457..cab61948a 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -1,5 +1,5 @@
1import { RepeatOptions } from 'bullmq' 1import { RepeatOptions } from 'bullmq'
2import { randomBytes } from 'crypto' 2import { Encoding, randomBytes } from 'crypto'
3import { invert } from 'lodash' 3import { invert } from 'lodash'
4import { join } from 'path' 4import { join } from 'path'
5import { randomInt, root } from '@shared/core-utils' 5import { randomInt, root } from '@shared/core-utils'
@@ -25,7 +25,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
25 25
26// --------------------------------------------------------------------------- 26// ---------------------------------------------------------------------------
27 27
28const LAST_MIGRATION_VERSION = 740 28const LAST_MIGRATION_VERSION = 745
29 29
30// --------------------------------------------------------------------------- 30// ---------------------------------------------------------------------------
31 31
@@ -116,7 +116,8 @@ const ROUTE_CACHE_LIFETIME = {
116 ACTIVITY_PUB: { 116 ACTIVITY_PUB: {
117 VIDEOS: '1 second' // 1 second, cache concurrent requests after a broadcast for example 117 VIDEOS: '1 second' // 1 second, cache concurrent requests after a broadcast for example
118 }, 118 },
119 STATS: '4 hours' 119 STATS: '4 hours',
120 WELL_KNOWN: '1 day'
120} 121}
121 122
122// --------------------------------------------------------------------------- 123// ---------------------------------------------------------------------------
@@ -636,9 +637,18 @@ let PRIVATE_RSA_KEY_SIZE = 2048
636// Password encryption 637// Password encryption
637const BCRYPT_SALT_SIZE = 10 638const BCRYPT_SALT_SIZE = 10
638 639
640const ENCRYPTION = {
641 ALGORITHM: 'aes-256-cbc',
642 IV: 16,
643 SALT: 'peertube',
644 ENCODING: 'hex' as Encoding
645}
646
639const USER_PASSWORD_RESET_LIFETIME = 60000 * 60 // 60 minutes 647const USER_PASSWORD_RESET_LIFETIME = 60000 * 60 // 60 minutes
640const USER_PASSWORD_CREATE_LIFETIME = 60000 * 60 * 24 * 7 // 7 days 648const USER_PASSWORD_CREATE_LIFETIME = 60000 * 60 * 24 * 7 // 7 days
641 649
650const TWO_FACTOR_AUTH_REQUEST_TOKEN_LIFETIME = 60000 * 10 // 10 minutes
651
642const USER_EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes 652const USER_EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes
643 653
644const NSFW_POLICY_TYPES: { [ id: string ]: NSFWPolicyType } = { 654const NSFW_POLICY_TYPES: { [ id: string ]: NSFWPolicyType } = {
@@ -804,6 +814,10 @@ const REDUNDANCY = {
804} 814}
805 815
806const ACCEPT_HEADERS = [ 'html', 'application/json' ].concat(ACTIVITY_PUB.POTENTIAL_ACCEPT_HEADERS) 816const ACCEPT_HEADERS = [ 'html', 'application/json' ].concat(ACTIVITY_PUB.POTENTIAL_ACCEPT_HEADERS)
817const OTP = {
818 HEADER_NAME: 'x-peertube-otp',
819 HEADER_REQUIRED_VALUE: 'required; app'
820}
807 821
808const ASSETS_PATH = { 822const ASSETS_PATH = {
809 DEFAULT_AUDIO_BACKGROUND: join(root(), 'dist', 'server', 'assets', 'default-audio-background.jpg'), 823 DEFAULT_AUDIO_BACKGROUND: join(root(), 'dist', 'server', 'assets', 'default-audio-background.jpg'),
@@ -952,6 +966,7 @@ const VIDEO_FILTERS = {
952export { 966export {
953 WEBSERVER, 967 WEBSERVER,
954 API_VERSION, 968 API_VERSION,
969 ENCRYPTION,
955 VIDEO_LIVE, 970 VIDEO_LIVE,
956 PEERTUBE_VERSION, 971 PEERTUBE_VERSION,
957 LAZY_STATIC_PATHS, 972 LAZY_STATIC_PATHS,
@@ -985,6 +1000,7 @@ export {
985 FOLLOW_STATES, 1000 FOLLOW_STATES,
986 DEFAULT_USER_THEME_NAME, 1001 DEFAULT_USER_THEME_NAME,
987 SERVER_ACTOR_NAME, 1002 SERVER_ACTOR_NAME,
1003 TWO_FACTOR_AUTH_REQUEST_TOKEN_LIFETIME,
988 PLUGIN_GLOBAL_CSS_FILE_NAME, 1004 PLUGIN_GLOBAL_CSS_FILE_NAME,
989 PLUGIN_GLOBAL_CSS_PATH, 1005 PLUGIN_GLOBAL_CSS_PATH,
990 PRIVATE_RSA_KEY_SIZE, 1006 PRIVATE_RSA_KEY_SIZE,
@@ -1040,6 +1056,7 @@ export {
1040 PLUGIN_EXTERNAL_AUTH_TOKEN_LIFETIME, 1056 PLUGIN_EXTERNAL_AUTH_TOKEN_LIFETIME,
1041 ASSETS_PATH, 1057 ASSETS_PATH,
1042 FILES_CONTENT_HASH, 1058 FILES_CONTENT_HASH,
1059 OTP,
1043 loadLanguages, 1060 loadLanguages,
1044 buildLanguages, 1061 buildLanguages,
1045 generateContentHash 1062 generateContentHash