diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-19 11:01:34 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-19 11:01:34 +0200 |
commit | 0883b3245bf0deb9106c4041e9afbd3521b79280 (patch) | |
tree | fcb73005e0b31a3b763ee5d22d5fc39c2da89907 /server/initializers/constants.ts | |
parent | 04ed10b21e8e1339514faae0bb690e4d97c23b0a (diff) | |
download | PeerTube-0883b3245bf0deb9106c4041e9afbd3521b79280.tar.gz PeerTube-0883b3245bf0deb9106c4041e9afbd3521b79280.tar.zst PeerTube-0883b3245bf0deb9106c4041e9afbd3521b79280.zip |
Add ability to choose what policy we have for NSFW videos
There is a global instance setting and a per user setting
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r-- | server/initializers/constants.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 5ee13389d..d1915586a 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -6,13 +6,14 @@ import { FollowState } from '../../shared/models/actors' | |||
6 | import { VideoPrivacy } from '../../shared/models/videos' | 6 | import { VideoPrivacy } from '../../shared/models/videos' |
7 | // Do not use barrels, remain constants as independent as possible | 7 | // Do not use barrels, remain constants as independent as possible |
8 | import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' | 8 | import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' |
9 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' | ||
9 | 10 | ||
10 | // Use a variable to reload the configuration if we need | 11 | // Use a variable to reload the configuration if we need |
11 | let config: IConfig = require('config') | 12 | let config: IConfig = require('config') |
12 | 13 | ||
13 | // --------------------------------------------------------------------------- | 14 | // --------------------------------------------------------------------------- |
14 | 15 | ||
15 | const LAST_MIGRATION_VERSION = 200 | 16 | const LAST_MIGRATION_VERSION = 205 |
16 | 17 | ||
17 | // --------------------------------------------------------------------------- | 18 | // --------------------------------------------------------------------------- |
18 | 19 | ||
@@ -167,6 +168,7 @@ const CONFIG = { | |||
167 | get DESCRIPTION () { return config.get<string>('instance.description') }, | 168 | get DESCRIPTION () { return config.get<string>('instance.description') }, |
168 | get TERMS () { return config.get<string>('instance.terms') }, | 169 | get TERMS () { return config.get<string>('instance.terms') }, |
169 | get DEFAULT_CLIENT_ROUTE () { return config.get<string>('instance.default_client_route') }, | 170 | get DEFAULT_CLIENT_ROUTE () { return config.get<string>('instance.default_client_route') }, |
171 | get DEFAULT_NSFW_POLICY () { return config.get<NSFWPolicyType>('instance.default_nsfw_policy') }, | ||
170 | CUSTOMIZATIONS: { | 172 | CUSTOMIZATIONS: { |
171 | get JAVASCRIPT () { return config.get<string>('instance.customizations.javascript') }, | 173 | get JAVASCRIPT () { return config.get<string>('instance.customizations.javascript') }, |
172 | get CSS () { return config.get<string>('instance.customizations.css') } | 174 | get CSS () { return config.get<string>('instance.customizations.css') } |
@@ -378,6 +380,12 @@ const BCRYPT_SALT_SIZE = 10 | |||
378 | 380 | ||
379 | const USER_PASSWORD_RESET_LIFETIME = 60000 * 5 // 5 minutes | 381 | const USER_PASSWORD_RESET_LIFETIME = 60000 * 5 // 5 minutes |
380 | 382 | ||
383 | const NSFW_POLICY_TYPES: { [ id: string]: NSFWPolicyType } = { | ||
384 | DO_NOT_LIST: 'do_not_list', | ||
385 | BLUR: 'blur', | ||
386 | DISPLAY: 'display' | ||
387 | } | ||
388 | |||
381 | // --------------------------------------------------------------------------- | 389 | // --------------------------------------------------------------------------- |
382 | 390 | ||
383 | // Express static paths (router) | 391 | // Express static paths (router) |
@@ -474,6 +482,7 @@ export { | |||
474 | PRIVATE_RSA_KEY_SIZE, | 482 | PRIVATE_RSA_KEY_SIZE, |
475 | SORTABLE_COLUMNS, | 483 | SORTABLE_COLUMNS, |
476 | FEEDS, | 484 | FEEDS, |
485 | NSFW_POLICY_TYPES, | ||
477 | STATIC_MAX_AGE, | 486 | STATIC_MAX_AGE, |
478 | STATIC_PATHS, | 487 | STATIC_PATHS, |
479 | ACTIVITY_PUB, | 488 | ACTIVITY_PUB, |