diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-10-05 15:17:34 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2018-10-13 11:53:42 +0200 |
commit | 64cc5e8575fda47b281ae20abf0020e27fc8ce7c (patch) | |
tree | c3ec40b03d3fdc5d3beee9ff089384c894d9efe9 /server/helpers/custom-validators | |
parent | 0e5ff97f6fdf9a4cebe5a15f5a390380465803ad (diff) | |
download | PeerTube-64cc5e8575fda47b281ae20abf0020e27fc8ce7c.tar.gz PeerTube-64cc5e8575fda47b281ae20abf0020e27fc8ce7c.tar.zst PeerTube-64cc5e8575fda47b281ae20abf0020e27fc8ce7c.zip |
add webtorrent opt-out settings
- add a key in localstorage to remember the opt-out
- add a user setting
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r-- | server/helpers/custom-validators/users.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts index 90fc74a48..2024d4a22 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import 'express-validator' | 1 | import 'express-validator' |
2 | import * as validator from 'validator' | 2 | import * as validator from 'validator' |
3 | import { UserRole } from '../../../shared' | 3 | import { UserRole } from '../../../shared' |
4 | import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers' | 4 | import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES, WEBTORRENT_POLICY_TYPES } from '../../initializers' |
5 | import { exists, isFileValid, isBooleanValid } from './misc' | 5 | import { exists, isFileValid, isBooleanValid } from './misc' |
6 | import { values } from 'lodash' | 6 | import { values } from 'lodash' |
7 | 7 | ||
@@ -42,6 +42,11 @@ function isUserNSFWPolicyValid (value: any) { | |||
42 | return exists(value) && nsfwPolicies.indexOf(value) !== -1 | 42 | return exists(value) && nsfwPolicies.indexOf(value) !== -1 |
43 | } | 43 | } |
44 | 44 | ||
45 | const webTorrentPolicies = values(WEBTORRENT_POLICY_TYPES) | ||
46 | function isUserWebTorrentPolicyValid (value: any) { | ||
47 | return exists(value) && webTorrentPolicies.indexOf(value) !== -1 | ||
48 | } | ||
49 | |||
45 | function isUserAutoPlayVideoValid (value: any) { | 50 | function isUserAutoPlayVideoValid (value: any) { |
46 | return isBooleanValid(value) | 51 | return isBooleanValid(value) |
47 | } | 52 | } |
@@ -78,6 +83,7 @@ export { | |||
78 | isUserUsernameValid, | 83 | isUserUsernameValid, |
79 | isUserEmailVerifiedValid, | 84 | isUserEmailVerifiedValid, |
80 | isUserNSFWPolicyValid, | 85 | isUserNSFWPolicyValid, |
86 | isUserWebTorrentPolicyValid, | ||
81 | isUserAutoPlayVideoValid, | 87 | isUserAutoPlayVideoValid, |
82 | isUserDisplayNameValid, | 88 | isUserDisplayNameValid, |
83 | isUserDescriptionValid, | 89 | isUserDescriptionValid, |