aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/middlewares/validators/activitypub/signature.ts2
-rw-r--r--server/middlewares/validators/logs.ts8
-rw-r--r--server/middlewares/validators/search.ts18
-rw-r--r--server/middlewares/validators/user-history.ts2
-rw-r--r--server/middlewares/validators/videos/videos.ts2
5 files changed, 20 insertions, 12 deletions
diff --git a/server/middlewares/validators/activitypub/signature.ts b/server/middlewares/validators/activitypub/signature.ts
index 7c4e49463..7896a6128 100644
--- a/server/middlewares/validators/activitypub/signature.ts
+++ b/server/middlewares/validators/activitypub/signature.ts
@@ -14,7 +14,7 @@ const signatureValidator = [
14 .custom(isSignatureTypeValid).withMessage('Should have a valid signature type'), 14 .custom(isSignatureTypeValid).withMessage('Should have a valid signature type'),
15 body('signature.created') 15 body('signature.created')
16 .optional() 16 .optional()
17 .custom(isDateValid).withMessage('Should have a valid signature created date'), 17 .custom(isDateValid).withMessage('Should have a signature created date that conforms to ISO 8601'),
18 body('signature.creator') 18 body('signature.creator')
19 .optional() 19 .optional()
20 .custom(isSignatureCreatorValid).withMessage('Should have a valid signature creator'), 20 .custom(isSignatureCreatorValid).withMessage('Should have a valid signature creator'),
diff --git a/server/middlewares/validators/logs.ts b/server/middlewares/validators/logs.ts
index 70e4d0d99..ba817d9a9 100644
--- a/server/middlewares/validators/logs.ts
+++ b/server/middlewares/validators/logs.ts
@@ -7,13 +7,13 @@ import { isValidLogLevel } from '../../helpers/custom-validators/logs'
7 7
8const getLogsValidator = [ 8const getLogsValidator = [
9 query('startDate') 9 query('startDate')
10 .custom(isDateValid).withMessage('Should have a valid start date'), 10 .custom(isDateValid).withMessage('Should have a start date that conforms to ISO 8601'),
11 query('level') 11 query('level')
12 .optional() 12 .optional()
13 .custom(isValidLogLevel).withMessage('Should have a valid level'), 13 .custom(isValidLogLevel).withMessage('Should have a valid level'),
14 query('endDate') 14 query('endDate')
15 .optional() 15 .optional()
16 .custom(isDateValid).withMessage('Should have a valid end date'), 16 .custom(isDateValid).withMessage('Should have an end date that conforms to ISO 8601'),
17 17
18 (req: express.Request, res: express.Response, next: express.NextFunction) => { 18 (req: express.Request, res: express.Response, next: express.NextFunction) => {
19 logger.debug('Checking getLogsValidator parameters.', { parameters: req.query }) 19 logger.debug('Checking getLogsValidator parameters.', { parameters: req.query })
@@ -26,10 +26,10 @@ const getLogsValidator = [
26 26
27const getAuditLogsValidator = [ 27const getAuditLogsValidator = [
28 query('startDate') 28 query('startDate')
29 .custom(isDateValid).withMessage('Should have a valid start date'), 29 .custom(isDateValid).withMessage('Should have a start date that conforms to ISO 8601'),
30 query('endDate') 30 query('endDate')
31 .optional() 31 .optional()
32 .custom(isDateValid).withMessage('Should have a valid end date'), 32 .custom(isDateValid).withMessage('Should have a end date that conforms to ISO 8601'),
33 33
34 (req: express.Request, res: express.Response, next: express.NextFunction) => { 34 (req: express.Request, res: express.Response, next: express.NextFunction) => {
35 logger.debug('Checking getAuditLogsValidator parameters.', { parameters: req.query }) 35 logger.debug('Checking getAuditLogsValidator parameters.', { parameters: req.query })
diff --git a/server/middlewares/validators/search.ts b/server/middlewares/validators/search.ts
index 78213c70d..d2f527750 100644
--- a/server/middlewares/validators/search.ts
+++ b/server/middlewares/validators/search.ts
@@ -8,11 +8,19 @@ import { isSearchTargetValid } from '@server/helpers/custom-validators/search'
8const videosSearchValidator = [ 8const videosSearchValidator = [
9 query('search').optional().not().isEmpty().withMessage('Should have a valid search'), 9 query('search').optional().not().isEmpty().withMessage('Should have a valid search'),
10 10
11 query('startDate').optional().custom(isDateValid).withMessage('Should have a valid start date'), 11 query('startDate')
12 query('endDate').optional().custom(isDateValid).withMessage('Should have a valid end date'), 12 .optional()
13 13 .custom(isDateValid).withMessage('Should have a start date that conforms to ISO 8601'),
14 query('originallyPublishedStartDate').optional().custom(isDateValid).withMessage('Should have a valid published start date'), 14 query('endDate')
15 query('originallyPublishedEndDate').optional().custom(isDateValid).withMessage('Should have a valid published end date'), 15 .optional()
16 .custom(isDateValid).withMessage('Should have a end date that conforms to ISO 8601'),
17
18 query('originallyPublishedStartDate')
19 .optional()
20 .custom(isDateValid).withMessage('Should have a published start date that conforms to ISO 8601'),
21 query('originallyPublishedEndDate')
22 .optional()
23 .custom(isDateValid).withMessage('Should have a published end date that conforms to ISO 8601'),
16 24
17 query('durationMin').optional().isInt().withMessage('Should have a valid min duration'), 25 query('durationMin').optional().isInt().withMessage('Should have a valid min duration'),
18 query('durationMax').optional().isInt().withMessage('Should have a valid max duration'), 26 query('durationMax').optional().isInt().withMessage('Should have a valid max duration'),
diff --git a/server/middlewares/validators/user-history.ts b/server/middlewares/validators/user-history.ts
index 058bf7758..647294cc3 100644
--- a/server/middlewares/validators/user-history.ts
+++ b/server/middlewares/validators/user-history.ts
@@ -21,7 +21,7 @@ const userHistoryListValidator = [
21const userHistoryRemoveValidator = [ 21const userHistoryRemoveValidator = [
22 body('beforeDate') 22 body('beforeDate')
23 .optional() 23 .optional()
24 .custom(isDateValid).withMessage('Should have a valid before date'), 24 .custom(isDateValid).withMessage('Should have a before date that conforms to ISO 8601'),
25 25
26 (req: express.Request, res: express.Response, next: express.NextFunction) => { 26 (req: express.Request, res: express.Response, next: express.NextFunction) => {
27 logger.debug('Checking userHistoryRemoveValidator parameters', { parameters: req.body }) 27 logger.debug('Checking userHistoryRemoveValidator parameters', { parameters: req.body })
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts
index 3219e10d4..dce02df18 100644
--- a/server/middlewares/validators/videos/videos.ts
+++ b/server/middlewares/validators/videos/videos.ts
@@ -473,7 +473,7 @@ function getCommonVideoEditAttributes () {
473 .customSanitizer(toValueOrNull), 473 .customSanitizer(toValueOrNull),
474 body('scheduleUpdate.updateAt') 474 body('scheduleUpdate.updateAt')
475 .optional() 475 .optional()
476 .custom(isDateValid).withMessage('Should have a valid schedule update date'), 476 .custom(isDateValid).withMessage('Should have a schedule update date that conforms to ISO 8601'),
477 body('scheduleUpdate.privacy') 477 body('scheduleUpdate.privacy')
478 .optional() 478 .optional()
479 .customSanitizer(toIntOrNull) 479 .customSanitizer(toIntOrNull)