diff options
Diffstat (limited to 'server/helpers/custom-validators/activitypub')
-rw-r--r-- | server/helpers/custom-validators/activitypub/actor.ts | 4 | ||||
-rw-r--r-- | server/helpers/custom-validators/activitypub/videos.ts | 6 |
2 files changed, 5 insertions, 5 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 | ) || |