X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fsearch.ts;h=ee732b15aa1f83b0a1253249d65a02f52e2b045d;hb=d5c8932a601c1854db0a2e399ccaf26e17385f1a;hp=2fde391602014aa33ee46726e7dddfa7c7c041fc;hpb=d525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/search.ts b/server/helpers/custom-validators/search.ts index 2fde39160..ee732b15a 100644 --- a/server/helpers/custom-validators/search.ts +++ b/server/helpers/custom-validators/search.ts @@ -1,6 +1,4 @@ import * as validator from 'validator' -import 'express-validator' - import { isArray } from './misc' function isNumberArray (value: any) { @@ -11,9 +9,14 @@ function isStringArray (value: any) { return isArray(value) && value.every(v => typeof v === 'string') } +function isNSFWQueryValid (value: any) { + return value === 'true' || value === 'false' || value === 'both' +} + // --------------------------------------------------------------------------- export { isNumberArray, - isStringArray + isStringArray, + isNSFWQueryValid }