aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/users/index.ts4
-rw-r--r--server/controllers/api/videos/import.ts2
-rw-r--r--server/controllers/api/videos/index.ts4
3 files changed, 4 insertions, 6 deletions
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts
index c488f720b..06a43d7a3 100644
--- a/server/controllers/api/users/index.ts
+++ b/server/controllers/api/users/index.ts
@@ -53,15 +53,13 @@ import { tokensRouter } from '@server/controllers/api/users/token'
53 53
54const auditLogger = auditLoggerFactory('users') 54const auditLogger = auditLoggerFactory('users')
55 55
56// @ts-ignore
57const signupRateLimiter = RateLimit({ 56const signupRateLimiter = RateLimit({
58 windowMs: CONFIG.RATES_LIMIT.SIGNUP.WINDOW_MS, 57 windowMs: CONFIG.RATES_LIMIT.SIGNUP.WINDOW_MS,
59 max: CONFIG.RATES_LIMIT.SIGNUP.MAX, 58 max: CONFIG.RATES_LIMIT.SIGNUP.MAX,
60 skipFailedRequests: true 59 skipFailedRequests: true
61}) 60})
62 61
63// @ts-ignore 62const askSendEmailLimiter = RateLimit({
64const askSendEmailLimiter = new RateLimit({
65 windowMs: CONFIG.RATES_LIMIT.ASK_SEND_EMAIL.WINDOW_MS, 63 windowMs: CONFIG.RATES_LIMIT.ASK_SEND_EMAIL.WINDOW_MS,
66 max: CONFIG.RATES_LIMIT.ASK_SEND_EMAIL.MAX 64 max: CONFIG.RATES_LIMIT.ASK_SEND_EMAIL.MAX
67}) 65})
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts
index b4f70a086..ec270148d 100644
--- a/server/controllers/api/videos/import.ts
+++ b/server/controllers/api/videos/import.ts
@@ -68,7 +68,7 @@ export {
68function addVideoImport (req: express.Request, res: express.Response) { 68function addVideoImport (req: express.Request, res: express.Response) {
69 if (req.body.targetUrl) return addYoutubeDLImport(req, res) 69 if (req.body.targetUrl) return addYoutubeDLImport(req, res)
70 70
71 const file = req.files && req.files['torrentfile'] ? req.files['torrentfile'][0] : undefined 71 const file = req.files?.['torrentfile']?.[0]
72 if (req.body.magnetUri || file) return addTorrentImport(req, res, file) 72 if (req.body.magnetUri || file) return addTorrentImport(req, res, file)
73} 73}
74 74
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 8048c568c..3ca5a9192 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -317,11 +317,11 @@ async function updateVideo (req: express.Request, res: express.Response) {
317 const hadPrivacyForFederation = videoInstance.hasPrivacyForFederation() 317 const hadPrivacyForFederation = videoInstance.hasPrivacyForFederation()
318 318
319 // Process thumbnail or create it from the video 319 // Process thumbnail or create it from the video
320 const thumbnailModel = req.files && req.files['thumbnailfile'] 320 const thumbnailModel = req.files?.['thumbnailfile']
321 ? await createVideoMiniatureFromExisting(req.files['thumbnailfile'][0].path, videoInstance, ThumbnailType.MINIATURE, false) 321 ? await createVideoMiniatureFromExisting(req.files['thumbnailfile'][0].path, videoInstance, ThumbnailType.MINIATURE, false)
322 : undefined 322 : undefined
323 323
324 const previewModel = req.files && req.files['previewfile'] 324 const previewModel = req.files?.['previewfile']
325 ? await createVideoMiniatureFromExisting(req.files['previewfile'][0].path, videoInstance, ThumbnailType.PREVIEW, false) 325 ? await createVideoMiniatureFromExisting(req.files['previewfile'][0].path, videoInstance, ThumbnailType.PREVIEW, false)
326 : undefined 326 : undefined
327 327