diff options
author | Chocobozzz <me@florianbigard.com> | 2020-02-28 16:03:39 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-02-28 16:21:34 +0100 |
commit | bdd428a6d9138d751f8cde82867022a93f1a76cc (patch) | |
tree | c2b671c3d6a34daddd20e30656f573cf59905f13 /server/helpers/custom-validators | |
parent | 9d94e5d7b96332d628ed835c67c2986289ead9b2 (diff) | |
download | PeerTube-bdd428a6d9138d751f8cde82867022a93f1a76cc.tar.gz PeerTube-bdd428a6d9138d751f8cde82867022a93f1a76cc.tar.zst PeerTube-bdd428a6d9138d751f8cde82867022a93f1a76cc.zip |
Update dependencies
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r-- | server/helpers/custom-validators/activitypub/actor.ts | 4 | ||||
-rw-r--r-- | server/helpers/custom-validators/activitypub/videos.ts | 6 | ||||
-rw-r--r-- | server/helpers/custom-validators/feeds.ts | 2 | ||||
-rw-r--r-- | server/helpers/custom-validators/logs.ts | 2 | ||||
-rw-r--r-- | server/helpers/custom-validators/users.ts | 2 | ||||
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 2 |
6 files changed, 9 insertions, 9 deletions
diff --git a/server/helpers/custom-validators/activitypub/actor.ts b/server/helpers/custom-validators/activitypub/actor.ts index fec67823d..2f44522a5 100644 --- a/server/helpers/custom-validators/activitypub/actor.ts +++ b/server/helpers/custom-validators/activitypub/actor.ts | |||
@@ -28,7 +28,7 @@ function isActorPublicKeyValid (publicKey: string) { | |||
28 | return exists(publicKey) && | 28 | return exists(publicKey) && |
29 | typeof publicKey === 'string' && | 29 | typeof publicKey === 'string' && |
30 | publicKey.startsWith('-----BEGIN PUBLIC KEY-----') && | 30 | publicKey.startsWith('-----BEGIN PUBLIC KEY-----') && |
31 | publicKey.indexOf('-----END PUBLIC KEY-----') !== -1 && | 31 | publicKey.includes('-----END PUBLIC KEY-----') && |
32 | validator.isLength(publicKey, CONSTRAINTS_FIELDS.ACTORS.PUBLIC_KEY) | 32 | validator.isLength(publicKey, CONSTRAINTS_FIELDS.ACTORS.PUBLIC_KEY) |
33 | } | 33 | } |
34 | 34 | ||
@@ -43,7 +43,7 @@ function isActorPrivateKeyValid (privateKey: string) { | |||
43 | typeof privateKey === 'string' && | 43 | typeof privateKey === 'string' && |
44 | privateKey.startsWith('-----BEGIN RSA PRIVATE KEY-----') && | 44 | privateKey.startsWith('-----BEGIN RSA PRIVATE KEY-----') && |
45 | // Sometimes there is a \n at the end, so just assert the string contains the end mark | 45 | // Sometimes there is a \n at the end, so just assert the string contains the end mark |
46 | privateKey.indexOf('-----END RSA PRIVATE KEY-----') !== -1 && | 46 | privateKey.includes('-----END RSA PRIVATE KEY-----') && |
47 | validator.isLength(privateKey, CONSTRAINTS_FIELDS.ACTORS.PRIVATE_KEY) | 47 | validator.isLength(privateKey, CONSTRAINTS_FIELDS.ACTORS.PRIVATE_KEY) |
48 | } | 48 | } |
49 | 49 | ||
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index 22b5e14a2..af8c8a0c8 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts | |||
@@ -84,19 +84,19 @@ function sanitizeAndCheckVideoTorrentObject (video: any) { | |||
84 | function isRemoteVideoUrlValid (url: any) { | 84 | function isRemoteVideoUrlValid (url: any) { |
85 | return url.type === 'Link' && | 85 | return url.type === 'Link' && |
86 | ( | 86 | ( |
87 | ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.indexOf(url.mediaType) !== -1 && | 87 | ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.includes(url.mediaType) && |
88 | isActivityPubUrlValid(url.href) && | 88 | isActivityPubUrlValid(url.href) && |
89 | validator.isInt(url.height + '', { min: 0 }) && | 89 | validator.isInt(url.height + '', { min: 0 }) && |
90 | validator.isInt(url.size + '', { min: 0 }) && | 90 | validator.isInt(url.size + '', { min: 0 }) && |
91 | (!url.fps || validator.isInt(url.fps + '', { min: -1 })) | 91 | (!url.fps || validator.isInt(url.fps + '', { min: -1 })) |
92 | ) || | 92 | ) || |
93 | ( | 93 | ( |
94 | ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.indexOf(url.mediaType) !== -1 && | 94 | ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.includes(url.mediaType) && |
95 | isActivityPubUrlValid(url.href) && | 95 | isActivityPubUrlValid(url.href) && |
96 | validator.isInt(url.height + '', { min: 0 }) | 96 | validator.isInt(url.height + '', { min: 0 }) |
97 | ) || | 97 | ) || |
98 | ( | 98 | ( |
99 | ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.indexOf(url.mediaType) !== -1 && | 99 | ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.includes(url.mediaType) && |
100 | validator.isLength(url.href, { min: 5 }) && | 100 | validator.isLength(url.href, { min: 5 }) && |
101 | validator.isInt(url.height + '', { min: 0 }) | 101 | validator.isInt(url.height + '', { min: 0 }) |
102 | ) || | 102 | ) || |
diff --git a/server/helpers/custom-validators/feeds.ts b/server/helpers/custom-validators/feeds.ts index 638e814f0..fa35a7da6 100644 --- a/server/helpers/custom-validators/feeds.ts +++ b/server/helpers/custom-validators/feeds.ts | |||
@@ -13,7 +13,7 @@ function isValidRSSFeed (value: string) { | |||
13 | 'atom1' | 13 | 'atom1' |
14 | ] | 14 | ] |
15 | 15 | ||
16 | return feedExtensions.indexOf(value) !== -1 | 16 | return feedExtensions.includes(value) |
17 | } | 17 | } |
18 | 18 | ||
19 | // --------------------------------------------------------------------------- | 19 | // --------------------------------------------------------------------------- |
diff --git a/server/helpers/custom-validators/logs.ts b/server/helpers/custom-validators/logs.ts index 30d0ce262..0f266ed3b 100644 --- a/server/helpers/custom-validators/logs.ts +++ b/server/helpers/custom-validators/logs.ts | |||
@@ -4,7 +4,7 @@ import { LogLevel } from '../../../shared/models/server/log-level.type' | |||
4 | const logLevels: LogLevel[] = [ 'debug', 'info', 'warn', 'error' ] | 4 | const logLevels: LogLevel[] = [ 'debug', 'info', 'warn', 'error' ] |
5 | 5 | ||
6 | function isValidLogLevel (value: any) { | 6 | function isValidLogLevel (value: any) { |
7 | return exists(value) && logLevels.indexOf(value) !== -1 | 7 | return exists(value) && logLevels.includes(value) |
8 | } | 8 | } |
9 | 9 | ||
10 | // --------------------------------------------------------------------------- | 10 | // --------------------------------------------------------------------------- |
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts index 1ddbe0815..d6e91ad35 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts | |||
@@ -46,7 +46,7 @@ function isUserEmailVerifiedValid (value: any) { | |||
46 | 46 | ||
47 | const nsfwPolicies = values(NSFW_POLICY_TYPES) | 47 | const nsfwPolicies = values(NSFW_POLICY_TYPES) |
48 | function isUserNSFWPolicyValid (value: any) { | 48 | function isUserNSFWPolicyValid (value: any) { |
49 | return exists(value) && nsfwPolicies.indexOf(value) !== -1 | 49 | return exists(value) && nsfwPolicies.includes(value) |
50 | } | 50 | } |
51 | 51 | ||
52 | function isUserWebTorrentEnabledValid (value: any) { | 52 | function isUserWebTorrentEnabledValid (value: any) { |
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index cfb430c63..60e8075f6 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts | |||
@@ -73,7 +73,7 @@ function isVideoViewsValid (value: string) { | |||
73 | } | 73 | } |
74 | 74 | ||
75 | function isVideoRatingTypeValid (value: string) { | 75 | function isVideoRatingTypeValid (value: string) { |
76 | return value === 'none' || values(VIDEO_RATE_TYPES).indexOf(value as VideoRateType) !== -1 | 76 | return value === 'none' || values(VIDEO_RATE_TYPES).includes(value as VideoRateType) |
77 | } | 77 | } |
78 | 78 | ||
79 | function isVideoFileExtnameValid (value: string) { | 79 | function isVideoFileExtnameValid (value: string) { |