From 64cc5e8575fda47b281ae20abf0020e27fc8ce7c Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Fri, 5 Oct 2018 15:17:34 +0200 Subject: add webtorrent opt-out settings - add a key in localstorage to remember the opt-out - add a user setting --- server/helpers/custom-validators/users.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'server/helpers') 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 @@ import 'express-validator' import * as validator from 'validator' import { UserRole } from '../../../shared' -import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers' +import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES, WEBTORRENT_POLICY_TYPES } from '../../initializers' import { exists, isFileValid, isBooleanValid } from './misc' import { values } from 'lodash' @@ -42,6 +42,11 @@ function isUserNSFWPolicyValid (value: any) { return exists(value) && nsfwPolicies.indexOf(value) !== -1 } +const webTorrentPolicies = values(WEBTORRENT_POLICY_TYPES) +function isUserWebTorrentPolicyValid (value: any) { + return exists(value) && webTorrentPolicies.indexOf(value) !== -1 +} + function isUserAutoPlayVideoValid (value: any) { return isBooleanValid(value) } @@ -78,6 +83,7 @@ export { isUserUsernameValid, isUserEmailVerifiedValid, isUserNSFWPolicyValid, + isUserWebTorrentPolicyValid, isUserAutoPlayVideoValid, isUserDisplayNameValid, isUserDescriptionValid, -- cgit v1.2.3