diff options
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/cache.ts | 2 | ||||
-rw-r--r-- | server/middlewares/servers.ts | 2 | ||||
-rw-r--r-- | server/middlewares/user-right.ts | 2 | ||||
-rw-r--r-- | server/middlewares/validators/activitypub/activity.ts | 4 | ||||
-rw-r--r-- | server/middlewares/validators/bulk.ts | 3 | ||||
-rw-r--r-- | server/middlewares/validators/feeds.ts | 1 | ||||
-rw-r--r-- | server/middlewares/validators/shared/videos.ts | 3 | ||||
-rw-r--r-- | server/middlewares/validators/videos/video-live.ts | 3 | ||||
-rw-r--r-- | server/middlewares/validators/videos/video-ownership-changes.ts | 10 |
9 files changed, 16 insertions, 14 deletions
diff --git a/server/middlewares/cache.ts b/server/middlewares/cache.ts index 1ced06042..e508b22a6 100644 --- a/server/middlewares/cache.ts +++ b/server/middlewares/cache.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Redis } from '../lib/redis' | ||
2 | import * as apicache from 'apicache' | 1 | import * as apicache from 'apicache' |
3 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' | 2 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' |
3 | import { Redis } from '../lib/redis' | ||
4 | 4 | ||
5 | // Ensure Redis is initialized | 5 | // Ensure Redis is initialized |
6 | Redis.Instance.init() | 6 | Redis.Instance.init() |
diff --git a/server/middlewares/servers.ts b/server/middlewares/servers.ts index 49a2241b3..cf70d901e 100644 --- a/server/middlewares/servers.ts +++ b/server/middlewares/servers.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { getHostWithPort } from '../helpers/express-utils' | ||
3 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' | 2 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' |
3 | import { getHostWithPort } from '../helpers/express-utils' | ||
4 | 4 | ||
5 | function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) { | 5 | function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) { |
6 | if (!req.body.hosts) return next() | 6 | if (!req.body.hosts) return next() |
diff --git a/server/middlewares/user-right.ts b/server/middlewares/user-right.ts index 87a1766cf..c8c694f05 100644 --- a/server/middlewares/user-right.ts +++ b/server/middlewares/user-right.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { UserRight } from '../../shared' | 2 | import { UserRight } from '../../shared' |
3 | import { logger } from '../helpers/logger' | ||
4 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' | 3 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' |
4 | import { logger } from '../helpers/logger' | ||
5 | 5 | ||
6 | function ensureUserHasRight (userRight: UserRight) { | 6 | function ensureUserHasRight (userRight: UserRight) { |
7 | return function (req: express.Request, res: express.Response, next: express.NextFunction) { | 7 | return function (req: express.Request, res: express.Response, next: express.NextFunction) { |
diff --git a/server/middlewares/validators/activitypub/activity.ts b/server/middlewares/validators/activitypub/activity.ts index d65a8e455..d24e4427b 100644 --- a/server/middlewares/validators/activitypub/activity.ts +++ b/server/middlewares/validators/activitypub/activity.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity' | ||
3 | import { logger } from '../../../helpers/logger' | ||
4 | import { getServerActor } from '@server/models/application/application' | 2 | import { getServerActor } from '@server/models/application/application' |
5 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | 3 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' |
4 | import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity' | ||
5 | import { logger } from '../../../helpers/logger' | ||
6 | 6 | ||
7 | async function activityPubValidator (req: express.Request, res: express.Response, next: express.NextFunction) { | 7 | async function activityPubValidator (req: express.Request, res: express.Response, next: express.NextFunction) { |
8 | logger.debug('Checking activity pub parameters') | 8 | logger.debug('Checking activity pub parameters') |
diff --git a/server/middlewares/validators/bulk.ts b/server/middlewares/validators/bulk.ts index 4057b1e01..6fec58149 100644 --- a/server/middlewares/validators/bulk.ts +++ b/server/middlewares/validators/bulk.ts | |||
@@ -1,8 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { body } from 'express-validator' | 2 | import { body } from 'express-validator' |
3 | import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk' | 3 | import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk' |
4 | import { HttpStatusCode } from '@shared/models' | 4 | import { HttpStatusCode, UserRight } from '@shared/models' |
5 | import { UserRight } from '@shared/models' | ||
6 | import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' | 5 | import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' |
7 | import { logger } from '../../helpers/logger' | 6 | import { logger } from '../../helpers/logger' |
8 | import { areValidationErrors, doesAccountNameWithHostExist } from './shared' | 7 | import { areValidationErrors, doesAccountNameWithHostExist } from './shared' |
diff --git a/server/middlewares/validators/feeds.ts b/server/middlewares/validators/feeds.ts index 1a5a8ffa0..d29bebf64 100644 --- a/server/middlewares/validators/feeds.ts +++ b/server/middlewares/validators/feeds.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { param, query } from 'express-validator' | 2 | import { param, query } from 'express-validator' |
3 | |||
4 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' | 3 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' |
5 | import { isValidRSSFeed } from '../../helpers/custom-validators/feeds' | 4 | import { isValidRSSFeed } from '../../helpers/custom-validators/feeds' |
6 | import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc' | 5 | import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc' |
diff --git a/server/middlewares/validators/shared/videos.ts b/server/middlewares/validators/shared/videos.ts index 7f42a4893..71b81654f 100644 --- a/server/middlewares/validators/shared/videos.ts +++ b/server/middlewares/validators/shared/videos.ts | |||
@@ -12,8 +12,7 @@ import { | |||
12 | MVideoImmutable, | 12 | MVideoImmutable, |
13 | MVideoThumbnail | 13 | MVideoThumbnail |
14 | } from '@server/types/models' | 14 | } from '@server/types/models' |
15 | import { HttpStatusCode } from '@shared/models' | 15 | import { HttpStatusCode, UserRight } from '@shared/models' |
16 | import { UserRight } from '@shared/models' | ||
17 | 16 | ||
18 | async function doesVideoExist (id: number | string, res: Response, fetchType: VideoLoadType = 'all') { | 17 | async function doesVideoExist (id: number | string, res: Response, fetchType: VideoLoadType = 'all') { |
19 | const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined | 18 | const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined |
diff --git a/server/middlewares/validators/videos/video-live.ts b/server/middlewares/validators/videos/video-live.ts index 5c8a4269d..97e8b4510 100644 --- a/server/middlewares/validators/videos/video-live.ts +++ b/server/middlewares/validators/videos/video-live.ts | |||
@@ -5,8 +5,7 @@ import { isLocalLiveVideoAccepted } from '@server/lib/moderation' | |||
5 | import { Hooks } from '@server/lib/plugins/hooks' | 5 | import { Hooks } from '@server/lib/plugins/hooks' |
6 | import { VideoModel } from '@server/models/video/video' | 6 | import { VideoModel } from '@server/models/video/video' |
7 | import { VideoLiveModel } from '@server/models/video/video-live' | 7 | import { VideoLiveModel } from '@server/models/video/video-live' |
8 | import { HttpStatusCode } from '@shared/models' | 8 | import { HttpStatusCode, ServerErrorCode, UserRight, VideoState } from '@shared/models' |
9 | import { ServerErrorCode, UserRight, VideoState } from '@shared/models' | ||
10 | import { isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' | 9 | import { isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' |
11 | import { isVideoNameValid } from '../../../helpers/custom-validators/videos' | 10 | import { isVideoNameValid } from '../../../helpers/custom-validators/videos' |
12 | import { cleanUpReqFiles } from '../../../helpers/express-utils' | 11 | import { cleanUpReqFiles } from '../../../helpers/express-utils' |
diff --git a/server/middlewares/validators/videos/video-ownership-changes.ts b/server/middlewares/validators/videos/video-ownership-changes.ts index 06f86a4c8..a7f0b72c3 100644 --- a/server/middlewares/validators/videos/video-ownership-changes.ts +++ b/server/middlewares/validators/videos/video-ownership-changes.ts | |||
@@ -6,8 +6,14 @@ import { logger } from '@server/helpers/logger' | |||
6 | import { isAbleToUploadVideo } from '@server/lib/user' | 6 | import { isAbleToUploadVideo } from '@server/lib/user' |
7 | import { AccountModel } from '@server/models/account/account' | 7 | import { AccountModel } from '@server/models/account/account' |
8 | import { MVideoWithAllFiles } from '@server/types/models' | 8 | import { MVideoWithAllFiles } from '@server/types/models' |
9 | import { HttpStatusCode } from '@shared/models' | 9 | import { |
10 | import { ServerErrorCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@shared/models' | 10 | HttpStatusCode, |
11 | ServerErrorCode, | ||
12 | UserRight, | ||
13 | VideoChangeOwnershipAccept, | ||
14 | VideoChangeOwnershipStatus, | ||
15 | VideoState | ||
16 | } from '@shared/models' | ||
11 | import { | 17 | import { |
12 | areValidationErrors, | 18 | areValidationErrors, |
13 | checkUserCanManageVideo, | 19 | checkUserCanManageVideo, |