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