From 74dc3bca2b14f5fd3fe80c394dfc34177a46db77 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 11 Apr 2019 14:26:41 +0200 Subject: Don't expose constants directly in initializers/ --- server/middlewares/activitypub.ts | 2 +- server/middlewares/oauth.ts | 2 +- server/middlewares/pagination.ts | 2 +- server/middlewares/validators/avatar.ts | 2 +- server/middlewares/validators/follows.ts | 2 +- server/middlewares/validators/sort.ts | 2 +- server/middlewares/validators/videos/video-captions.ts | 2 +- server/middlewares/validators/videos/video-channels.ts | 3 +-- server/middlewares/validators/videos/video-imports.ts | 2 +- server/middlewares/validators/videos/video-playlists.ts | 2 +- server/middlewares/validators/videos/videos.ts | 2 +- 11 files changed, 11 insertions(+), 12 deletions(-) (limited to 'server/middlewares') diff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.ts index c528ee250..88cf342ee 100644 --- a/server/middlewares/activitypub.ts +++ b/server/middlewares/activitypub.ts @@ -2,7 +2,7 @@ import { NextFunction, Request, Response } from 'express' import { ActivityPubSignature } from '../../shared' import { logger } from '../helpers/logger' import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto' -import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers' +import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants' import { getOrCreateActorAndServerAndModel } from '../lib/activitypub' import { loadActorUrlOrGetFromWebfinger } from '../helpers/webfinger' diff --git a/server/middlewares/oauth.ts b/server/middlewares/oauth.ts index 1d193d467..de736e593 100644 --- a/server/middlewares/oauth.ts +++ b/server/middlewares/oauth.ts @@ -1,7 +1,7 @@ import * as express from 'express' import * as OAuthServer from 'express-oauth-server' import 'express-validator' -import { OAUTH_LIFETIME } from '../initializers' +import { OAUTH_LIFETIME } from '../initializers/constants' import { logger } from '../helpers/logger' import { Socket } from 'socket.io' import { getAccessToken } from '../lib/oauth-model' diff --git a/server/middlewares/pagination.ts b/server/middlewares/pagination.ts index 9b497b19e..83304940f 100644 --- a/server/middlewares/pagination.ts +++ b/server/middlewares/pagination.ts @@ -1,7 +1,7 @@ import 'express-validator' import * as express from 'express' -import { PAGINATION } from '../initializers' +import { PAGINATION } from '../initializers/constants' function setDefaultPagination (req: express.Request, res: express.Response, next: express.NextFunction) { if (!req.query.start) req.query.start = 0 diff --git a/server/middlewares/validators/avatar.ts b/server/middlewares/validators/avatar.ts index ddc14f531..bab3ed118 100644 --- a/server/middlewares/validators/avatar.ts +++ b/server/middlewares/validators/avatar.ts @@ -2,7 +2,7 @@ import * as express from 'express' import { body } from 'express-validator/check' import { isAvatarFile } from '../../helpers/custom-validators/users' import { areValidationErrors } from './utils' -import { CONSTRAINTS_FIELDS } from '../../initializers' +import { CONSTRAINTS_FIELDS } from '../../initializers/constants' import { logger } from '../../helpers/logger' import { cleanUpReqFiles } from '../../helpers/express-utils' diff --git a/server/middlewares/validators/follows.ts b/server/middlewares/validators/follows.ts index 5623b4ba6..2e5a02307 100644 --- a/server/middlewares/validators/follows.ts +++ b/server/middlewares/validators/follows.ts @@ -4,7 +4,7 @@ import { isTestInstance } from '../../helpers/core-utils' import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers' import { logger } from '../../helpers/logger' import { getServerActor } from '../../helpers/utils' -import { SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers' +import { SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants' import { ActorFollowModel } from '../../models/activitypub/actor-follow' import { areValidationErrors } from './utils' import { ActorModel } from '../../models/activitypub/actor' diff --git a/server/middlewares/validators/sort.ts b/server/middlewares/validators/sort.ts index 44295c325..b497798d1 100644 --- a/server/middlewares/validators/sort.ts +++ b/server/middlewares/validators/sort.ts @@ -1,4 +1,4 @@ -import { SORTABLE_COLUMNS } from '../../initializers' +import { SORTABLE_COLUMNS } from '../../initializers/constants' import { checkSort, createSortableColumns } from './utils' // Initialize constants here for better performances diff --git a/server/middlewares/validators/videos/video-captions.ts b/server/middlewares/validators/videos/video-captions.ts index b2b259aff..d857ac3ec 100644 --- a/server/middlewares/validators/videos/video-captions.ts +++ b/server/middlewares/validators/videos/video-captions.ts @@ -3,7 +3,7 @@ import { areValidationErrors } from '../utils' import { checkUserCanManageVideo, doesVideoExist } from '../../../helpers/custom-validators/videos' import { isIdOrUUIDValid } from '../../../helpers/custom-validators/misc' import { body, param } from 'express-validator/check' -import { CONSTRAINTS_FIELDS } from '../../../initializers' +import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' import { UserRight } from '../../../../shared' import { logger } from '../../../helpers/logger' import { doesVideoCaptionExist, isVideoCaptionFile, isVideoCaptionLanguageValid } from '../../../helpers/custom-validators/video-captions' diff --git a/server/middlewares/validators/videos/video-channels.ts b/server/middlewares/validators/videos/video-channels.ts index e2067c4d9..4b26f0bc4 100644 --- a/server/middlewares/validators/videos/video-channels.ts +++ b/server/middlewares/validators/videos/video-channels.ts @@ -1,12 +1,11 @@ import * as express from 'express' import { body, param } from 'express-validator/check' import { UserRight } from '../../../../shared' -import { doesAccountNameWithHostExist } from '../../../helpers/custom-validators/accounts' import { doesLocalVideoChannelNameExist, + doesVideoChannelNameWithHostExist, isVideoChannelDescriptionValid, isVideoChannelNameValid, - doesVideoChannelNameWithHostExist, isVideoChannelSupportValid } from '../../../helpers/custom-validators/video-channels' import { logger } from '../../../helpers/logger' diff --git a/server/middlewares/validators/videos/video-imports.ts b/server/middlewares/validators/videos/video-imports.ts index fb13f3ceb..452084a7c 100644 --- a/server/middlewares/validators/videos/video-imports.ts +++ b/server/middlewares/validators/videos/video-imports.ts @@ -8,7 +8,7 @@ import { isVideoImportTargetUrlValid, isVideoImportTorrentFile } from '../../../ import { cleanUpReqFiles } from '../../../helpers/express-utils' import { doesVideoChannelOfAccountExist, isVideoMagnetUriValid, isVideoNameValid } from '../../../helpers/custom-validators/videos' import { CONFIG } from '../../../initializers/config' -import { CONSTRAINTS_FIELDS } from '../../../initializers' +import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' const videoImportAddValidator = getCommonVideoEditAttributes().concat([ body('channelId') diff --git a/server/middlewares/validators/videos/video-playlists.ts b/server/middlewares/validators/videos/video-playlists.ts index 6ba30fac9..2c3f7e542 100644 --- a/server/middlewares/validators/videos/video-playlists.ts +++ b/server/middlewares/validators/videos/video-playlists.ts @@ -5,7 +5,7 @@ import { logger } from '../../../helpers/logger' import { UserModel } from '../../../models/account/user' import { areValidationErrors } from '../utils' import { doesVideoExist, isVideoImage } from '../../../helpers/custom-validators/videos' -import { CONSTRAINTS_FIELDS } from '../../../initializers' +import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' import { isArrayOf, isIdOrUUIDValid, isIdValid, isUUIDValid, toIntArray, toValueOrNull } from '../../../helpers/custom-validators/misc' import { doesVideoPlaylistExist, diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index 7ce1a922f..e9b036a02 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts @@ -32,7 +32,7 @@ import { } from '../../../helpers/custom-validators/videos' import { getDurationFromVideoFile } from '../../../helpers/ffmpeg-utils' import { logger } from '../../../helpers/logger' -import { CONSTRAINTS_FIELDS } from '../../../initializers' +import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' import { authenticatePromiseIfNeeded } from '../../oauth' import { areValidationErrors } from '../utils' import { cleanUpReqFiles } from '../../../helpers/express-utils' -- cgit v1.2.3