aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/controllers/activitypub/client.ts2
-rw-r--r--server/controllers/api/config.ts2
-rw-r--r--server/controllers/api/overviews.ts2
-rw-r--r--server/controllers/api/server/follows.ts3
-rw-r--r--server/controllers/api/server/logs.ts2
-rw-r--r--server/controllers/api/users/index.ts3
-rw-r--r--server/controllers/api/users/me.ts3
-rw-r--r--server/controllers/api/users/my-subscriptions.ts3
-rw-r--r--server/controllers/api/video-channel.ts3
-rw-r--r--server/controllers/api/video-playlist.ts3
-rw-r--r--server/controllers/api/videos/captions.ts3
-rw-r--r--server/controllers/api/videos/import.ts3
-rw-r--r--server/controllers/api/videos/index.ts4
-rw-r--r--server/controllers/api/videos/rate.ts3
-rw-r--r--server/controllers/bots.ts2
-rw-r--r--server/controllers/client.ts2
-rw-r--r--server/controllers/feeds.ts3
-rw-r--r--server/controllers/services.ts3
-rw-r--r--server/controllers/static.ts2
-rw-r--r--server/helpers/activitypub.ts2
-rw-r--r--server/helpers/core-utils.ts3
-rw-r--r--server/helpers/custom-validators/activitypub/actor.ts2
-rw-r--r--server/helpers/custom-validators/activitypub/misc.ts2
-rw-r--r--server/helpers/custom-validators/activitypub/video-comments.ts4
-rw-r--r--server/helpers/custom-validators/activitypub/videos.ts2
-rw-r--r--server/helpers/custom-validators/servers.ts2
-rw-r--r--server/helpers/custom-validators/users.ts2
-rw-r--r--server/helpers/custom-validators/video-abuses.ts2
-rw-r--r--server/helpers/custom-validators/video-blacklist.ts2
-rw-r--r--server/helpers/custom-validators/video-captions.ts2
-rw-r--r--server/helpers/custom-validators/video-channels.ts2
-rw-r--r--server/helpers/custom-validators/video-comments.ts2
-rw-r--r--server/helpers/custom-validators/video-imports.ts2
-rw-r--r--server/helpers/custom-validators/video-playlists.ts2
-rw-r--r--server/helpers/custom-validators/videos.ts2
-rw-r--r--server/helpers/custom-validators/webfinger.ts2
-rw-r--r--server/helpers/express-utils.ts2
-rw-r--r--server/helpers/peertube-crypto.ts2
-rw-r--r--server/helpers/requests.ts2
-rw-r--r--server/helpers/youtube-dl.ts2
-rw-r--r--server/initializers/constants.ts7
-rw-r--r--server/initializers/index.ts2
-rw-r--r--server/initializers/migrations/0170-actor-follow-score.ts2
-rw-r--r--server/initializers/migrations/0210-video-language.ts2
-rw-r--r--server/initializers/migrations/0215-video-support-length.ts1
-rw-r--r--server/lib/activitypub/actor.ts3
-rw-r--r--server/lib/activitypub/audience.ts2
-rw-r--r--server/lib/activitypub/crawl.ts2
-rw-r--r--server/lib/activitypub/playlist.ts3
-rw-r--r--server/lib/activitypub/share.ts2
-rw-r--r--server/lib/activitypub/url.ts2
-rw-r--r--server/lib/activitypub/video-comments.ts2
-rw-r--r--server/lib/activitypub/video-rates.ts2
-rw-r--r--server/lib/activitypub/videos.ts10
-rw-r--r--server/lib/avatar.ts3
-rw-r--r--server/lib/client-html.ts2
-rw-r--r--server/lib/files-cache/actor-follow-score-cache.ts2
-rw-r--r--server/lib/files-cache/videos-caption-cache.ts2
-rw-r--r--server/lib/files-cache/videos-preview-cache.ts2
-rw-r--r--server/lib/hls.ts3
-rw-r--r--server/lib/job-queue/handlers/activitypub-follow.ts3
-rw-r--r--server/lib/job-queue/handlers/activitypub-http-broadcast.ts2
-rw-r--r--server/lib/job-queue/handlers/activitypub-http-unicast.ts2
-rw-r--r--server/lib/job-queue/handlers/utils/activitypub-http-utils.ts2
-rw-r--r--server/lib/job-queue/handlers/video-import.ts3
-rw-r--r--server/lib/job-queue/job-queue.ts2
-rw-r--r--server/lib/redis.ts2
-rw-r--r--server/lib/schedulers/actor-follow-scheduler.ts2
-rw-r--r--server/lib/schedulers/remove-old-jobs-scheduler.ts2
-rw-r--r--server/lib/schedulers/update-videos-scheduler.ts3
-rw-r--r--server/lib/schedulers/videos-redundancy-scheduler.ts2
-rw-r--r--server/lib/schedulers/youtube-dl-update-scheduler.ts2
-rw-r--r--server/lib/user.ts3
-rw-r--r--server/lib/video-transcoding.ts2
-rw-r--r--server/middlewares/activitypub.ts2
-rw-r--r--server/middlewares/oauth.ts2
-rw-r--r--server/middlewares/pagination.ts2
-rw-r--r--server/middlewares/validators/avatar.ts2
-rw-r--r--server/middlewares/validators/follows.ts2
-rw-r--r--server/middlewares/validators/sort.ts2
-rw-r--r--server/middlewares/validators/videos/video-captions.ts2
-rw-r--r--server/middlewares/validators/videos/video-channels.ts3
-rw-r--r--server/middlewares/validators/videos/video-imports.ts2
-rw-r--r--server/middlewares/validators/videos/video-playlists.ts2
-rw-r--r--server/middlewares/validators/videos/videos.ts2
-rw-r--r--server/models/account/account-video-rate.ts2
-rw-r--r--server/models/account/user.ts2
-rw-r--r--server/models/activitypub/actor-follow.ts2
-rw-r--r--server/models/activitypub/actor.ts2
-rw-r--r--server/models/avatar/avatar.ts2
-rw-r--r--server/models/redundancy/video-redundancy.ts2
-rw-r--r--server/models/utils.ts1
-rw-r--r--server/models/video/video-abuse.ts2
-rw-r--r--server/models/video/video-blacklist.ts2
-rw-r--r--server/models/video/video-caption.ts2
-rw-r--r--server/models/video/video-channel.ts2
-rw-r--r--server/models/video/video-comment.ts2
-rw-r--r--server/models/video/video-format-utils.ts2
-rw-r--r--server/models/video/video-import.ts2
-rw-r--r--server/models/video/video-playlist-element.ts2
-rw-r--r--server/models/video/video-playlist.ts2
-rw-r--r--server/models/video/video-share.ts2
-rw-r--r--server/models/video/video-streaming-playlist.ts2
-rw-r--r--server/models/video/video.ts2
-rw-r--r--server/tests/api/activitypub/security.ts2
-rw-r--r--server/tests/cli/optimize-old-videos.ts2
-rw-r--r--server/tools/peertube-import-videos.ts2
107 files changed, 129 insertions, 121 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts
index f47fae766..d36d10de1 100644
--- a/server/controllers/activitypub/client.ts
+++ b/server/controllers/activitypub/client.ts
@@ -2,7 +2,7 @@
2import * as express from 'express' 2import * as express from 'express'
3import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos' 3import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos'
4import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' 4import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub'
5import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers' 5import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants'
6import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send' 6import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send'
7import { audiencify, getAudience } from '../../lib/activitypub/audience' 7import { audiencify, getAudience } from '../../lib/activitypub/audience'
8import { buildCreateActivity } from '../../lib/activitypub/send/send-create' 8import { buildCreateActivity } from '../../lib/activitypub/send/send-create'
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index cdbccaa7d..40012c03b 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -4,7 +4,7 @@ import { ServerConfig, UserRight } from '../../../shared'
4import { About } from '../../../shared/models/server/about.model' 4import { About } from '../../../shared/models/server/about.model'
5import { CustomConfig } from '../../../shared/models/server/custom-config.model' 5import { CustomConfig } from '../../../shared/models/server/custom-config.model'
6import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' 6import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup'
7import { CONSTRAINTS_FIELDS } from '../../initializers' 7import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
8import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares' 8import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares'
9import { customConfigUpdateValidator } from '../../middlewares/validators/config' 9import { customConfigUpdateValidator } from '../../middlewares/validators/config'
10import { ClientHtml } from '../../lib/client-html' 10import { ClientHtml } from '../../lib/client-html'
diff --git a/server/controllers/api/overviews.ts b/server/controllers/api/overviews.ts
index b052acdb7..37ac152db 100644
--- a/server/controllers/api/overviews.ts
+++ b/server/controllers/api/overviews.ts
@@ -4,7 +4,7 @@ import { VideoModel } from '../../models/video/video'
4import { asyncMiddleware } from '../../middlewares' 4import { asyncMiddleware } from '../../middlewares'
5import { TagModel } from '../../models/video/tag' 5import { TagModel } from '../../models/video/tag'
6import { VideosOverview } from '../../../shared/models/overviews' 6import { VideosOverview } from '../../../shared/models/overviews'
7import { MEMOIZE_TTL, OVERVIEWS, ROUTE_CACHE_LIFETIME } from '../../initializers' 7import { MEMOIZE_TTL, OVERVIEWS, ROUTE_CACHE_LIFETIME } from '../../initializers/constants'
8import { cacheRoute } from '../../middlewares/cache' 8import { cacheRoute } from '../../middlewares/cache'
9import * as memoizee from 'memoizee' 9import * as memoizee from 'memoizee'
10 10
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts
index 207a09a4c..d38ce91de 100644
--- a/server/controllers/api/server/follows.ts
+++ b/server/controllers/api/server/follows.ts
@@ -2,7 +2,7 @@ import * as express from 'express'
2import { UserRight } from '../../../../shared/models/users' 2import { UserRight } from '../../../../shared/models/users'
3import { logger } from '../../../helpers/logger' 3import { logger } from '../../../helpers/logger'
4import { getFormattedObjects, getServerActor } from '../../../helpers/utils' 4import { getFormattedObjects, getServerActor } from '../../../helpers/utils'
5import { sequelizeTypescript, SERVER_ACTOR_NAME } from '../../../initializers' 5import { SERVER_ACTOR_NAME } from '../../../initializers/constants'
6import { sendAccept, sendReject, sendUndoFollow } from '../../../lib/activitypub/send' 6import { sendAccept, sendReject, sendUndoFollow } from '../../../lib/activitypub/send'
7import { 7import {
8 asyncMiddleware, 8 asyncMiddleware,
@@ -24,6 +24,7 @@ import {
24import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 24import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
25import { JobQueue } from '../../../lib/job-queue' 25import { JobQueue } from '../../../lib/job-queue'
26import { removeRedundancyOf } from '../../../lib/redundancy' 26import { removeRedundancyOf } from '../../../lib/redundancy'
27import { sequelizeTypescript } from '../../../initializers/database'
27 28
28const serverFollowsRouter = express.Router() 29const serverFollowsRouter = express.Router()
29serverFollowsRouter.get('/following', 30serverFollowsRouter.get('/following',
diff --git a/server/controllers/api/server/logs.ts b/server/controllers/api/server/logs.ts
index bbbfa1d80..03941cca7 100644
--- a/server/controllers/api/server/logs.ts
+++ b/server/controllers/api/server/logs.ts
@@ -3,7 +3,7 @@ import { UserRight } from '../../../../shared/models/users'
3import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares' 3import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares'
4import { mtimeSortFilesDesc } from '../../../../shared/utils/logs/logs' 4import { mtimeSortFilesDesc } from '../../../../shared/utils/logs/logs'
5import { readdir, readFile } from 'fs-extra' 5import { readdir, readFile } from 'fs-extra'
6import { MAX_LOGS_OUTPUT_CHARACTERS } from '../../../initializers' 6import { MAX_LOGS_OUTPUT_CHARACTERS } from '../../../initializers/constants'
7import { join } from 'path' 7import { join } from 'path'
8import { getLogsValidator } from '../../../middlewares/validators/logs' 8import { getLogsValidator } from '../../../middlewares/validators/logs'
9import { LogLevel } from '../../../../shared/models/server/log-level.type' 9import { LogLevel } from '../../../../shared/models/server/log-level.type'
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts
index a049e23e4..28c8de303 100644
--- a/server/controllers/api/users/index.ts
+++ b/server/controllers/api/users/index.ts
@@ -3,7 +3,7 @@ import * as RateLimit from 'express-rate-limit'
3import { UserCreate, UserRight, UserRole, UserUpdate } from '../../../../shared' 3import { UserCreate, UserRight, UserRole, UserUpdate } from '../../../../shared'
4import { logger } from '../../../helpers/logger' 4import { logger } from '../../../helpers/logger'
5import { getFormattedObjects } from '../../../helpers/utils' 5import { getFormattedObjects } from '../../../helpers/utils'
6import { RATES_LIMIT, sequelizeTypescript, WEBSERVER } from '../../../initializers' 6import { RATES_LIMIT, WEBSERVER } from '../../../initializers/constants'
7import { Emailer } from '../../../lib/emailer' 7import { Emailer } from '../../../lib/emailer'
8import { Redis } from '../../../lib/redis' 8import { Redis } from '../../../lib/redis'
9import { createUserAccountAndChannelAndPlaylist } from '../../../lib/user' 9import { createUserAccountAndChannelAndPlaylist } from '../../../lib/user'
@@ -44,6 +44,7 @@ import { myNotificationsRouter } from './my-notifications'
44import { Notifier } from '../../../lib/notifier' 44import { Notifier } from '../../../lib/notifier'
45import { mySubscriptionsRouter } from './my-subscriptions' 45import { mySubscriptionsRouter } from './my-subscriptions'
46import { CONFIG } from '../../../initializers/config' 46import { CONFIG } from '../../../initializers/config'
47import { sequelizeTypescript } from '../../../initializers/database'
47 48
48const auditLogger = auditLoggerFactory('users') 49const auditLogger = auditLoggerFactory('users')
49 50
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index 1d1588eca..ce9e78463 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -2,7 +2,7 @@ import * as express from 'express'
2import 'multer' 2import 'multer'
3import { UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared' 3import { UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared'
4import { getFormattedObjects } from '../../../helpers/utils' 4import { getFormattedObjects } from '../../../helpers/utils'
5import { MIMETYPES, sequelizeTypescript } from '../../../initializers' 5import { MIMETYPES } from '../../../initializers/constants'
6import { sendUpdateActor } from '../../../lib/activitypub/send' 6import { sendUpdateActor } from '../../../lib/activitypub/send'
7import { 7import {
8 asyncMiddleware, 8 asyncMiddleware,
@@ -27,6 +27,7 @@ import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../h
27import { VideoImportModel } from '../../../models/video/video-import' 27import { VideoImportModel } from '../../../models/video/video-import'
28import { AccountModel } from '../../../models/account/account' 28import { AccountModel } from '../../../models/account/account'
29import { CONFIG } from '../../../initializers/config' 29import { CONFIG } from '../../../initializers/config'
30import { sequelizeTypescript } from '../../../initializers/database'
30 31
31const auditLogger = auditLoggerFactory('users-me') 32const auditLogger = auditLoggerFactory('users-me')
32 33
diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts
index 59b906a8b..c52df3154 100644
--- a/server/controllers/api/users/my-subscriptions.ts
+++ b/server/controllers/api/users/my-subscriptions.ts
@@ -1,7 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import 'multer' 2import 'multer'
3import { getFormattedObjects } from '../../../helpers/utils' 3import { getFormattedObjects } from '../../../helpers/utils'
4import { sequelizeTypescript, WEBSERVER } from '../../../initializers' 4import { WEBSERVER } from '../../../initializers/constants'
5import { 5import {
6 asyncMiddleware, 6 asyncMiddleware,
7 asyncRetryTransactionMiddleware, 7 asyncRetryTransactionMiddleware,
@@ -20,6 +20,7 @@ import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
20import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 20import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
21import { JobQueue } from '../../../lib/job-queue' 21import { JobQueue } from '../../../lib/job-queue'
22import { logger } from '../../../helpers/logger' 22import { logger } from '../../../helpers/logger'
23import { sequelizeTypescript } from '../../../initializers/database'
23 24
24const mySubscriptionsRouter = express.Router() 25const mySubscriptionsRouter = express.Router()
25 26
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts
index b79ce9cec..3d6dbfe70 100644
--- a/server/controllers/api/video-channel.ts
+++ b/server/controllers/api/video-channel.ts
@@ -23,7 +23,7 @@ import { createVideoChannel } from '../../lib/video-channel'
23import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' 23import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
24import { setAsyncActorKeys } from '../../lib/activitypub' 24import { setAsyncActorKeys } from '../../lib/activitypub'
25import { AccountModel } from '../../models/account/account' 25import { AccountModel } from '../../models/account/account'
26import { MIMETYPES, sequelizeTypescript } from '../../initializers' 26import { MIMETYPES } from '../../initializers/constants'
27import { logger } from '../../helpers/logger' 27import { logger } from '../../helpers/logger'
28import { VideoModel } from '../../models/video/video' 28import { VideoModel } from '../../models/video/video'
29import { updateAvatarValidator } from '../../middlewares/validators/avatar' 29import { updateAvatarValidator } from '../../middlewares/validators/avatar'
@@ -34,6 +34,7 @@ import { JobQueue } from '../../lib/job-queue'
34import { VideoPlaylistModel } from '../../models/video/video-playlist' 34import { VideoPlaylistModel } from '../../models/video/video-playlist'
35import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists' 35import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists'
36import { CONFIG } from '../../initializers/config' 36import { CONFIG } from '../../initializers/config'
37import { sequelizeTypescript } from '../../initializers/database'
37 38
38const auditLogger = auditLoggerFactory('channels') 39const auditLogger = auditLoggerFactory('channels')
39const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) 40const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR })
diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts
index 5a3d6a29d..71c244a60 100644
--- a/server/controllers/api/video-playlist.ts
+++ b/server/controllers/api/video-playlist.ts
@@ -12,7 +12,7 @@ import {
12} from '../../middlewares' 12} from '../../middlewares'
13import { videoPlaylistsSortValidator } from '../../middlewares/validators' 13import { videoPlaylistsSortValidator } from '../../middlewares/validators'
14import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' 14import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
15import { MIMETYPES, sequelizeTypescript, THUMBNAILS_SIZE, VIDEO_PLAYLIST_PRIVACIES } from '../../initializers' 15import { MIMETYPES, THUMBNAILS_SIZE, VIDEO_PLAYLIST_PRIVACIES } from '../../initializers/constants'
16import { logger } from '../../helpers/logger' 16import { logger } from '../../helpers/logger'
17import { resetSequelizeInstance } from '../../helpers/database-utils' 17import { resetSequelizeInstance } from '../../helpers/database-utils'
18import { VideoPlaylistModel } from '../../models/video/video-playlist' 18import { VideoPlaylistModel } from '../../models/video/video-playlist'
@@ -42,6 +42,7 @@ import { AccountModel } from '../../models/account/account'
42import { VideoPlaylistReorder } from '../../../shared/models/videos/playlist/video-playlist-reorder.model' 42import { VideoPlaylistReorder } from '../../../shared/models/videos/playlist/video-playlist-reorder.model'
43import { JobQueue } from '../../lib/job-queue' 43import { JobQueue } from '../../lib/job-queue'
44import { CONFIG } from '../../initializers/config' 44import { CONFIG } from '../../initializers/config'
45import { sequelizeTypescript } from '../../initializers/database'
45 46
46const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR }) 47const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR })
47 48
diff --git a/server/controllers/api/videos/captions.ts b/server/controllers/api/videos/captions.ts
index 7dd36e368..44c255232 100644
--- a/server/controllers/api/videos/captions.ts
+++ b/server/controllers/api/videos/captions.ts
@@ -2,13 +2,14 @@ import * as express from 'express'
2import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' 2import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares'
3import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators' 3import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators'
4import { createReqFiles } from '../../../helpers/express-utils' 4import { createReqFiles } from '../../../helpers/express-utils'
5import { MIMETYPES, sequelizeTypescript } from '../../../initializers' 5import { MIMETYPES } from '../../../initializers/constants'
6import { getFormattedObjects } from '../../../helpers/utils' 6import { getFormattedObjects } from '../../../helpers/utils'
7import { VideoCaptionModel } from '../../../models/video/video-caption' 7import { VideoCaptionModel } from '../../../models/video/video-caption'
8import { logger } from '../../../helpers/logger' 8import { logger } from '../../../helpers/logger'
9import { federateVideoIfNeeded } from '../../../lib/activitypub' 9import { federateVideoIfNeeded } from '../../../lib/activitypub'
10import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils' 10import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils'
11import { CONFIG } from '../../../initializers/config' 11import { CONFIG } from '../../../initializers/config'
12import { sequelizeTypescript } from '../../../initializers/database'
12 13
13const reqVideoCaptionAdd = createReqFiles( 14const reqVideoCaptionAdd = createReqFiles(
14 [ 'captionfile' ], 15 [ 'captionfile' ],
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts
index 5a8cd703e..a72b8c72e 100644
--- a/server/controllers/api/videos/import.ts
+++ b/server/controllers/api/videos/import.ts
@@ -3,7 +3,7 @@ import * as magnetUtil from 'magnet-uri'
3import 'multer' 3import 'multer'
4import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger' 4import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger'
5import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoImportAddValidator } from '../../../middlewares' 5import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoImportAddValidator } from '../../../middlewares'
6import { MIMETYPES, PREVIEWS_SIZE, sequelizeTypescript, THUMBNAILS_SIZE } from '../../../initializers' 6import { MIMETYPES, PREVIEWS_SIZE, THUMBNAILS_SIZE } from '../../../initializers/constants'
7import { getYoutubeDLInfo, YoutubeDLInfo } from '../../../helpers/youtube-dl' 7import { getYoutubeDLInfo, YoutubeDLInfo } from '../../../helpers/youtube-dl'
8import { createReqFiles } from '../../../helpers/express-utils' 8import { createReqFiles } from '../../../helpers/express-utils'
9import { logger } from '../../../helpers/logger' 9import { logger } from '../../../helpers/logger'
@@ -25,6 +25,7 @@ import { getSecureTorrentName } from '../../../helpers/utils'
25import { move, readFile } from 'fs-extra' 25import { move, readFile } from 'fs-extra'
26import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist' 26import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist'
27import { CONFIG } from '../../../initializers/config' 27import { CONFIG } from '../../../initializers/config'
28import { sequelizeTypescript } from '../../../initializers/database'
28 29
29const auditLogger = auditLoggerFactory('video-imports') 30const auditLogger = auditLoggerFactory('video-imports')
30const videoImportsRouter = express.Router() 31const videoImportsRouter = express.Router()
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 9470afabf..d6f513254 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -10,13 +10,12 @@ import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist'
10import { 10import {
11 MIMETYPES, 11 MIMETYPES,
12 PREVIEWS_SIZE, 12 PREVIEWS_SIZE,
13 sequelizeTypescript,
14 THUMBNAILS_SIZE, 13 THUMBNAILS_SIZE,
15 VIDEO_CATEGORIES, 14 VIDEO_CATEGORIES,
16 VIDEO_LANGUAGES, 15 VIDEO_LANGUAGES,
17 VIDEO_LICENCES, 16 VIDEO_LICENCES,
18 VIDEO_PRIVACIES 17 VIDEO_PRIVACIES
19} from '../../../initializers' 18} from '../../../initializers/constants'
20import { 19import {
21 changeVideoChannelShare, 20 changeVideoChannelShare,
22 federateVideoIfNeeded, 21 federateVideoIfNeeded,
@@ -61,6 +60,7 @@ import { watchingRouter } from './watching'
61import { Notifier } from '../../../lib/notifier' 60import { Notifier } from '../../../lib/notifier'
62import { sendView } from '../../../lib/activitypub/send/send-view' 61import { sendView } from '../../../lib/activitypub/send/send-view'
63import { CONFIG } from '../../../initializers/config' 62import { CONFIG } from '../../../initializers/config'
63import { sequelizeTypescript } from '../../../initializers/database'
64 64
65const auditLogger = auditLoggerFactory('videos') 65const auditLogger = auditLoggerFactory('videos')
66const videosRouter = express.Router() 66const videosRouter = express.Router()
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts
index 914c596c3..b65babedf 100644
--- a/server/controllers/api/videos/rate.ts
+++ b/server/controllers/api/videos/rate.ts
@@ -1,11 +1,12 @@
1import * as express from 'express' 1import * as express from 'express'
2import { UserVideoRateUpdate } from '../../../../shared' 2import { UserVideoRateUpdate } from '../../../../shared'
3import { logger } from '../../../helpers/logger' 3import { logger } from '../../../helpers/logger'
4import { sequelizeTypescript, VIDEO_RATE_TYPES } from '../../../initializers' 4import { VIDEO_RATE_TYPES } from '../../../initializers/constants'
5import { getRateUrl, sendVideoRateChange } from '../../../lib/activitypub' 5import { getRateUrl, sendVideoRateChange } from '../../../lib/activitypub'
6import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares' 6import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares'
7import { AccountModel } from '../../../models/account/account' 7import { AccountModel } from '../../../models/account/account'
8import { AccountVideoRateModel } from '../../../models/account/account-video-rate' 8import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
9import { sequelizeTypescript } from '../../../initializers/database'
9 10
10const rateVideoRouter = express.Router() 11const rateVideoRouter = express.Router()
11 12
diff --git a/server/controllers/bots.ts b/server/controllers/bots.ts
index 58ead4799..7e8e6eff6 100644
--- a/server/controllers/bots.ts
+++ b/server/controllers/bots.ts
@@ -1,6 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import { asyncMiddleware } from '../middlewares' 2import { asyncMiddleware } from '../middlewares'
3import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers' 3import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'
4import * as sitemapModule from 'sitemap' 4import * as sitemapModule from 'sitemap'
5import { logger } from '../helpers/logger' 5import { logger } from '../helpers/logger'
6import { VideoModel } from '../models/video/video' 6import { VideoModel } from '../models/video/video'
diff --git a/server/controllers/client.ts b/server/controllers/client.ts
index ece2f460c..f51470b41 100644
--- a/server/controllers/client.ts
+++ b/server/controllers/client.ts
@@ -1,7 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { join } from 'path' 2import { join } from 'path'
3import { root } from '../helpers/core-utils' 3import { root } from '../helpers/core-utils'
4import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers' 4import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers/constants'
5import { asyncMiddleware, embedCSP } from '../middlewares' 5import { asyncMiddleware, embedCSP } from '../middlewares'
6import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n' 6import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n'
7import { ClientHtml } from '../lib/client-html' 7import { ClientHtml } from '../lib/client-html'
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts
index 24c41d946..5064097cd 100644
--- a/server/controllers/feeds.ts
+++ b/server/controllers/feeds.ts
@@ -1,6 +1,5 @@
1import * as express from 'express' 1import * as express from 'express'
2import { FEEDS, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' 2import { FEEDS, ROUTE_CACHE_LIFETIME, THUMBNAILS_SIZE, WEBSERVER } from '../initializers/constants'
3import { THUMBNAILS_SIZE } from '../initializers'
4import { 3import {
5 asyncMiddleware, 4 asyncMiddleware,
6 commonVideosFiltersValidator, 5 commonVideosFiltersValidator,
diff --git a/server/controllers/services.ts b/server/controllers/services.ts
index 83b01b475..c1c53c3fc 100644
--- a/server/controllers/services.ts
+++ b/server/controllers/services.ts
@@ -1,8 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { EMBED_SIZE, PREVIEWS_SIZE, WEBSERVER } from '../initializers' 2import { EMBED_SIZE, PREVIEWS_SIZE, WEBSERVER } from '../initializers/constants'
3import { asyncMiddleware, oembedValidator } from '../middlewares' 3import { asyncMiddleware, oembedValidator } from '../middlewares'
4import { accountNameWithHostGetValidator } from '../middlewares/validators' 4import { accountNameWithHostGetValidator } from '../middlewares/validators'
5import { CONFIG } from '../initializers/config'
6 5
7const servicesRouter = express.Router() 6const servicesRouter = express.Router()
8 7
diff --git a/server/controllers/static.ts b/server/controllers/static.ts
index be5fcc8ed..f6bb88725 100644
--- a/server/controllers/static.ts
+++ b/server/controllers/static.ts
@@ -7,7 +7,7 @@ import {
7 STATIC_MAX_AGE, 7 STATIC_MAX_AGE,
8 STATIC_PATHS, 8 STATIC_PATHS,
9 WEBSERVER 9 WEBSERVER
10} from '../initializers' 10} from '../initializers/constants'
11import { VideosCaptionCache, VideosPreviewCache } from '../lib/files-cache' 11import { VideosCaptionCache, VideosPreviewCache } from '../lib/files-cache'
12import { cacheRoute } from '../middlewares/cache' 12import { cacheRoute } from '../middlewares/cache'
13import { asyncMiddleware, videosGetValidator } from '../middlewares' 13import { asyncMiddleware, videosGetValidator } from '../middlewares'
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts
index 0c303c369..951a25669 100644
--- a/server/helpers/activitypub.ts
+++ b/server/helpers/activitypub.ts
@@ -2,7 +2,7 @@ import * as Bluebird from 'bluebird'
2import * as validator from 'validator' 2import * as validator from 'validator'
3import { ResultList } from '../../shared/models' 3import { ResultList } from '../../shared/models'
4import { Activity } from '../../shared/models/activitypub' 4import { Activity } from '../../shared/models/activitypub'
5import { ACTIVITY_PUB } from '../initializers' 5import { ACTIVITY_PUB } from '../initializers/constants'
6import { ActorModel } from '../models/activitypub/actor' 6import { ActorModel } from '../models/activitypub/actor'
7import { signJsonLDObject } from './peertube-crypto' 7import { signJsonLDObject } from './peertube-crypto'
8import { pageToStartAndCount } from './core-utils' 8import { pageToStartAndCount } from './core-utils'
diff --git a/server/helpers/core-utils.ts b/server/helpers/core-utils.ts
index 3f737c1d6..f6d90bfca 100644
--- a/server/helpers/core-utils.ts
+++ b/server/helpers/core-utils.ts
@@ -11,14 +11,13 @@ import * as pem from 'pem'
11import { URL } from 'url' 11import { URL } from 'url'
12import { truncate } from 'lodash' 12import { truncate } from 'lodash'
13import { exec } from 'child_process' 13import { exec } from 'child_process'
14import { isArray } from './custom-validators/misc'
15 14
16const objectConverter = (oldObject: any, keyConverter: (e: string) => string, valueConverter: (e: any) => any) => { 15const objectConverter = (oldObject: any, keyConverter: (e: string) => string, valueConverter: (e: any) => any) => {
17 if (!oldObject || typeof oldObject !== 'object') { 16 if (!oldObject || typeof oldObject !== 'object') {
18 return valueConverter(oldObject) 17 return valueConverter(oldObject)
19 } 18 }
20 19
21 if (isArray(oldObject)) { 20 if (Array.isArray(oldObject)) {
22 return oldObject.map(e => objectConverter(e, keyConverter, valueConverter)) 21 return oldObject.map(e => objectConverter(e, keyConverter, valueConverter))
23 } 22 }
24 23
diff --git a/server/helpers/custom-validators/activitypub/actor.ts b/server/helpers/custom-validators/activitypub/actor.ts
index c05f60f14..deb331abb 100644
--- a/server/helpers/custom-validators/activitypub/actor.ts
+++ b/server/helpers/custom-validators/activitypub/actor.ts
@@ -1,5 +1,5 @@
1import * as validator from 'validator' 1import * as validator from 'validator'
2import { CONSTRAINTS_FIELDS } from '../../../initializers' 2import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'
3import { exists, isArray } from '../misc' 3import { exists, isArray } from '../misc'
4import { truncate } from 'lodash' 4import { truncate } from 'lodash'
5import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc' 5import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc'
diff --git a/server/helpers/custom-validators/activitypub/misc.ts b/server/helpers/custom-validators/activitypub/misc.ts
index f1762d11c..f9445929b 100644
--- a/server/helpers/custom-validators/activitypub/misc.ts
+++ b/server/helpers/custom-validators/activitypub/misc.ts
@@ -1,5 +1,5 @@
1import * as validator from 'validator' 1import * as validator from 'validator'
2import { CONSTRAINTS_FIELDS } from '../../../initializers' 2import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'
3import { isTestInstance } from '../../core-utils' 3import { isTestInstance } from '../../core-utils'
4import { exists } from '../misc' 4import { exists } from '../misc'
5 5
diff --git a/server/helpers/custom-validators/activitypub/video-comments.ts b/server/helpers/custom-validators/activitypub/video-comments.ts
index 0415db21c..26c8c4cc6 100644
--- a/server/helpers/custom-validators/activitypub/video-comments.ts
+++ b/server/helpers/custom-validators/activitypub/video-comments.ts
@@ -1,7 +1,7 @@
1import * as validator from 'validator' 1import * as validator from 'validator'
2import { ACTIVITY_PUB, CONSTRAINTS_FIELDS } from '../../../initializers' 2import { ACTIVITY_PUB } from '../../../initializers/constants'
3import { exists, isArray, isDateValid } from '../misc' 3import { exists, isArray, isDateValid } from '../misc'
4import { isActivityPubUrlValid, isBaseActivityValid } from './misc' 4import { isActivityPubUrlValid } from './misc'
5 5
6function sanitizeAndCheckVideoCommentObject (comment: any) { 6function sanitizeAndCheckVideoCommentObject (comment: any) {
7 if (!comment || comment.type !== 'Note') return false 7 if (!comment || comment.type !== 'Note') return false
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts
index d94333151..3ba6b0744 100644
--- a/server/helpers/custom-validators/activitypub/videos.ts
+++ b/server/helpers/custom-validators/activitypub/videos.ts
@@ -1,5 +1,5 @@
1import * as validator from 'validator' 1import * as validator from 'validator'
2import { ACTIVITY_PUB, CONSTRAINTS_FIELDS } from '../../../initializers' 2import { ACTIVITY_PUB, CONSTRAINTS_FIELDS } from '../../../initializers/constants'
3import { peertubeTruncate } from '../../core-utils' 3import { peertubeTruncate } from '../../core-utils'
4import { exists, isArray, isBooleanValid, isDateValid, isUUIDValid } from '../misc' 4import { exists, isArray, isBooleanValid, isDateValid, isUUIDValid } from '../misc'
5import { 5import {
diff --git a/server/helpers/custom-validators/servers.ts b/server/helpers/custom-validators/servers.ts
index 18c80ec8f..5c8bf0d2d 100644
--- a/server/helpers/custom-validators/servers.ts
+++ b/server/helpers/custom-validators/servers.ts
@@ -3,7 +3,7 @@ import 'express-validator'
3 3
4import { isArray, exists } from './misc' 4import { isArray, exists } from './misc'
5import { isTestInstance } from '../core-utils' 5import { isTestInstance } from '../core-utils'
6import { CONSTRAINTS_FIELDS } from '../../initializers' 6import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
7 7
8function isHostValid (host: string) { 8function isHostValid (host: string) {
9 const isURLOptions = { 9 const isURLOptions = {
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts
index 80652b479..70af5f1f0 100644
--- a/server/helpers/custom-validators/users.ts
+++ b/server/helpers/custom-validators/users.ts
@@ -1,7 +1,7 @@
1import 'express-validator' 1import 'express-validator'
2import * as validator from 'validator' 2import * as validator from 'validator'
3import { UserRole } from '../../../shared' 3import { UserRole } from '../../../shared'
4import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers' 4import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers/constants'
5import { exists, isFileValid, isBooleanValid } from './misc' 5import { exists, isFileValid, isBooleanValid } from './misc'
6import { values } from 'lodash' 6import { values } from 'lodash'
7 7
diff --git a/server/helpers/custom-validators/video-abuses.ts b/server/helpers/custom-validators/video-abuses.ts
index 71500fde5..a61dcee1c 100644
--- a/server/helpers/custom-validators/video-abuses.ts
+++ b/server/helpers/custom-validators/video-abuses.ts
@@ -1,6 +1,6 @@
1import { Response } from 'express' 1import { Response } from 'express'
2import * as validator from 'validator' 2import * as validator from 'validator'
3import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers' 3import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants'
4import { exists } from './misc' 4import { exists } from './misc'
5import { VideoAbuseModel } from '../../models/video/video-abuse' 5import { VideoAbuseModel } from '../../models/video/video-abuse'
6 6
diff --git a/server/helpers/custom-validators/video-blacklist.ts b/server/helpers/custom-validators/video-blacklist.ts
index 465f58a9c..3743f7023 100644
--- a/server/helpers/custom-validators/video-blacklist.ts
+++ b/server/helpers/custom-validators/video-blacklist.ts
@@ -1,7 +1,7 @@
1import { Response } from 'express' 1import { Response } from 'express'
2import * as validator from 'validator' 2import * as validator from 'validator'
3import { exists } from './misc' 3import { exists } from './misc'
4import { CONSTRAINTS_FIELDS } from '../../initializers' 4import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
5import { VideoBlacklistModel } from '../../models/video/video-blacklist' 5import { VideoBlacklistModel } from '../../models/video/video-blacklist'
6import { VideoBlacklistType } from '../../../shared/models/videos' 6import { VideoBlacklistType } from '../../../shared/models/videos'
7 7
diff --git a/server/helpers/custom-validators/video-captions.ts b/server/helpers/custom-validators/video-captions.ts
index 8bd139003..3b6569a8a 100644
--- a/server/helpers/custom-validators/video-captions.ts
+++ b/server/helpers/custom-validators/video-captions.ts
@@ -1,4 +1,4 @@
1import { CONSTRAINTS_FIELDS, MIMETYPES, VIDEO_LANGUAGES } from '../../initializers' 1import { CONSTRAINTS_FIELDS, MIMETYPES, VIDEO_LANGUAGES } from '../../initializers/constants'
2import { exists, isFileValid } from './misc' 2import { exists, isFileValid } from './misc'
3import { Response } from 'express' 3import { Response } from 'express'
4import { VideoModel } from '../../models/video/video' 4import { VideoModel } from '../../models/video/video'
diff --git a/server/helpers/custom-validators/video-channels.ts b/server/helpers/custom-validators/video-channels.ts
index ca8d207cf..fd56b9a70 100644
--- a/server/helpers/custom-validators/video-channels.ts
+++ b/server/helpers/custom-validators/video-channels.ts
@@ -2,7 +2,7 @@ import * as express from 'express'
2import 'express-validator' 2import 'express-validator'
3import 'multer' 3import 'multer'
4import * as validator from 'validator' 4import * as validator from 'validator'
5import { CONSTRAINTS_FIELDS } from '../../initializers' 5import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
6import { VideoChannelModel } from '../../models/video/video-channel' 6import { VideoChannelModel } from '../../models/video/video-channel'
7import { exists } from './misc' 7import { exists } from './misc'
8 8
diff --git a/server/helpers/custom-validators/video-comments.ts b/server/helpers/custom-validators/video-comments.ts
index 2b3f66063..0707e2af2 100644
--- a/server/helpers/custom-validators/video-comments.ts
+++ b/server/helpers/custom-validators/video-comments.ts
@@ -1,7 +1,7 @@
1import 'express-validator' 1import 'express-validator'
2import 'multer' 2import 'multer'
3import * as validator from 'validator' 3import * as validator from 'validator'
4import { CONSTRAINTS_FIELDS } from '../../initializers' 4import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
5 5
6const VIDEO_COMMENTS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_COMMENTS 6const VIDEO_COMMENTS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_COMMENTS
7 7
diff --git a/server/helpers/custom-validators/video-imports.ts b/server/helpers/custom-validators/video-imports.ts
index 14db9b534..f4235e2fa 100644
--- a/server/helpers/custom-validators/video-imports.ts
+++ b/server/helpers/custom-validators/video-imports.ts
@@ -1,7 +1,7 @@
1import 'express-validator' 1import 'express-validator'
2import 'multer' 2import 'multer'
3import * as validator from 'validator' 3import * as validator from 'validator'
4import { CONSTRAINTS_FIELDS, MIMETYPES, VIDEO_IMPORT_STATES } from '../../initializers' 4import { CONSTRAINTS_FIELDS, MIMETYPES, VIDEO_IMPORT_STATES } from '../../initializers/constants'
5import { exists, isFileValid } from './misc' 5import { exists, isFileValid } from './misc'
6import * as express from 'express' 6import * as express from 'express'
7import { VideoImportModel } from '../../models/video/video-import' 7import { VideoImportModel } from '../../models/video/video-import'
diff --git a/server/helpers/custom-validators/video-playlists.ts b/server/helpers/custom-validators/video-playlists.ts
index c962c5532..2fe426560 100644
--- a/server/helpers/custom-validators/video-playlists.ts
+++ b/server/helpers/custom-validators/video-playlists.ts
@@ -1,6 +1,6 @@
1import { exists } from './misc' 1import { exists } from './misc'
2import * as validator from 'validator' 2import * as validator from 'validator'
3import { CONSTRAINTS_FIELDS, VIDEO_PLAYLIST_PRIVACIES, VIDEO_PLAYLIST_TYPES } from '../../initializers' 3import { CONSTRAINTS_FIELDS, VIDEO_PLAYLIST_PRIVACIES, VIDEO_PLAYLIST_TYPES } from '../../initializers/constants'
4import * as express from 'express' 4import * as express from 'express'
5import { VideoPlaylistModel } from '../../models/video/video-playlist' 5import { VideoPlaylistModel } from '../../models/video/video-playlist'
6 6
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts
index dd9d62d24..eb08ae4ad 100644
--- a/server/helpers/custom-validators/videos.ts
+++ b/server/helpers/custom-validators/videos.ts
@@ -11,7 +11,7 @@ import {
11 VIDEO_PRIVACIES, 11 VIDEO_PRIVACIES,
12 VIDEO_RATE_TYPES, 12 VIDEO_RATE_TYPES,
13 VIDEO_STATES 13 VIDEO_STATES
14} from '../../initializers' 14} from '../../initializers/constants'
15import { VideoModel } from '../../models/video/video' 15import { VideoModel } from '../../models/video/video'
16import { exists, isArray, isDateValid, isFileValid } from './misc' 16import { exists, isArray, isDateValid, isFileValid } from './misc'
17import { VideoChannelModel } from '../../models/video/video-channel' 17import { VideoChannelModel } from '../../models/video/video-channel'
diff --git a/server/helpers/custom-validators/webfinger.ts b/server/helpers/custom-validators/webfinger.ts
index b18e43fad..dd914341e 100644
--- a/server/helpers/custom-validators/webfinger.ts
+++ b/server/helpers/custom-validators/webfinger.ts
@@ -1,4 +1,4 @@
1import { REMOTE_SCHEME, WEBSERVER } from '../../initializers' 1import { REMOTE_SCHEME, WEBSERVER } from '../../initializers/constants'
2import { sanitizeHost } from '../core-utils' 2import { sanitizeHost } from '../core-utils'
3import { exists } from './misc' 3import { exists } from './misc'
4 4
diff --git a/server/helpers/express-utils.ts b/server/helpers/express-utils.ts
index 2b574ab8e..e0a1d56a5 100644
--- a/server/helpers/express-utils.ts
+++ b/server/helpers/express-utils.ts
@@ -1,6 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import * as multer from 'multer' 2import * as multer from 'multer'
3import { REMOTE_SCHEME } from '../initializers' 3import { REMOTE_SCHEME } from '../initializers/constants'
4import { logger } from './logger' 4import { logger } from './logger'
5import { deleteFileAsync, generateRandomString } from './utils' 5import { deleteFileAsync, generateRandomString } from './utils'
6import { extname } from 'path' 6import { extname } from 'path'
diff --git a/server/helpers/peertube-crypto.ts b/server/helpers/peertube-crypto.ts
index ab9ec077e..9148df2eb 100644
--- a/server/helpers/peertube-crypto.ts
+++ b/server/helpers/peertube-crypto.ts
@@ -1,5 +1,5 @@
1import { Request } from 'express' 1import { Request } from 'express'
2import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers' 2import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants'
3import { ActorModel } from '../models/activitypub/actor' 3import { ActorModel } from '../models/activitypub/actor'
4import { bcryptComparePromise, bcryptGenSaltPromise, bcryptHashPromise, createPrivateKey, getPublicKey, sha256 } from './core-utils' 4import { bcryptComparePromise, bcryptGenSaltPromise, bcryptHashPromise, createPrivateKey, getPublicKey, sha256 } from './core-utils'
5import { jsig, jsonld } from './custom-jsonld-signature' 5import { jsig, jsonld } from './custom-jsonld-signature'
diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts
index 02854b164..60c94da81 100644
--- a/server/helpers/requests.ts
+++ b/server/helpers/requests.ts
@@ -1,7 +1,7 @@
1import * as Bluebird from 'bluebird' 1import * as Bluebird from 'bluebird'
2import { createWriteStream, remove } from 'fs-extra' 2import { createWriteStream, remove } from 'fs-extra'
3import * as request from 'request' 3import * as request from 'request'
4import { ACTIVITY_PUB } from '../initializers' 4import { ACTIVITY_PUB } from '../initializers/constants'
5import { processImage } from './image-utils' 5import { processImage } from './image-utils'
6import { join } from 'path' 6import { join } from 'path'
7import { logger } from './logger' 7import { logger } from './logger'
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts
index c188739ff..b3079370f 100644
--- a/server/helpers/youtube-dl.ts
+++ b/server/helpers/youtube-dl.ts
@@ -1,5 +1,5 @@
1import { truncate } from 'lodash' 1import { truncate } from 'lodash'
2import { CONSTRAINTS_FIELDS, VIDEO_CATEGORIES } from '../initializers' 2import { CONSTRAINTS_FIELDS, VIDEO_CATEGORIES } from '../initializers/constants'
3import { logger } from './logger' 3import { logger } from './logger'
4import { generateVideoImportTmpPath } from './utils' 4import { generateVideoImportTmpPath } from './utils'
5import { join } from 'path' 5import { join } from 'path'
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 3922d8515..a0609d7cd 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -341,7 +341,7 @@ const VIDEO_LICENCES = {
341 7: 'Public Domain Dedication' 341 7: 'Public Domain Dedication'
342} 342}
343 343
344const VIDEO_LANGUAGES = buildLanguages() 344let VIDEO_LANGUAGES: { [id: string]: string } = {}
345 345
346const VIDEO_PRIVACIES = { 346const VIDEO_PRIVACIES = {
347 [ VideoPrivacy.PUBLIC ]: 'Public', 347 [ VideoPrivacy.PUBLIC ]: 'Public',
@@ -684,6 +684,7 @@ export {
684 VIDEO_VIEW_LIFETIME, 684 VIDEO_VIEW_LIFETIME,
685 CONTACT_FORM_LIFETIME, 685 CONTACT_FORM_LIFETIME,
686 VIDEO_PLAYLIST_PRIVACIES, 686 VIDEO_PLAYLIST_PRIVACIES,
687 loadLanguages,
687 buildLanguages 688 buildLanguages
688} 689}
689 690
@@ -732,6 +733,10 @@ function buildVideosExtname () {
732 : [ '.mp4', '.ogv', '.webm' ] 733 : [ '.mp4', '.ogv', '.webm' ]
733} 734}
734 735
736function loadLanguages () {
737 VIDEO_LANGUAGES = buildLanguages()
738}
739
735function buildLanguages () { 740function buildLanguages () {
736 const iso639 = require('iso-639-3') 741 const iso639 = require('iso-639-3')
737 742
diff --git a/server/initializers/index.ts b/server/initializers/index.ts
index fe9190a9c..0fc1a7363 100644
--- a/server/initializers/index.ts
+++ b/server/initializers/index.ts
@@ -1,5 +1,3 @@
1// Constants first, database in second!
2export * from './constants'
3export * from './database' 1export * from './database'
4export * from './installer' 2export * from './installer'
5export * from './migrator' 3export * from './migrator'
diff --git a/server/initializers/migrations/0170-actor-follow-score.ts b/server/initializers/migrations/0170-actor-follow-score.ts
index 2deabaf98..a12b35da9 100644
--- a/server/initializers/migrations/0170-actor-follow-score.ts
+++ b/server/initializers/migrations/0170-actor-follow-score.ts
@@ -1,5 +1,5 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { ACTOR_FOLLOW_SCORE } from '../index' 2import { ACTOR_FOLLOW_SCORE } from '../constants'
3 3
4async function up (utils: { 4async function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction,
diff --git a/server/initializers/migrations/0210-video-language.ts b/server/initializers/migrations/0210-video-language.ts
index b7ec90905..ca95c7527 100644
--- a/server/initializers/migrations/0210-video-language.ts
+++ b/server/initializers/migrations/0210-video-language.ts
@@ -1,5 +1,5 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { CONSTRAINTS_FIELDS } from '../index' 2import { CONSTRAINTS_FIELDS } from '../constants'
3 3
4async function up (utils: { 4async function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction,
diff --git a/server/initializers/migrations/0215-video-support-length.ts b/server/initializers/migrations/0215-video-support-length.ts
index 994eda60d..ba395050f 100644
--- a/server/initializers/migrations/0215-video-support-length.ts
+++ b/server/initializers/migrations/0215-video-support-length.ts
@@ -1,5 +1,4 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { CONSTRAINTS_FIELDS } from '../index'
3 2
4async function up (utils: { 3async function up (utils: {
5 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction,
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts
index cfefc26ce..0db75906c 100644
--- a/server/lib/activitypub/actor.ts
+++ b/server/lib/activitypub/actor.ts
@@ -12,7 +12,7 @@ import { logger } from '../../helpers/logger'
12import { createPrivateAndPublicKeys } from '../../helpers/peertube-crypto' 12import { createPrivateAndPublicKeys } from '../../helpers/peertube-crypto'
13import { doRequest, downloadImage } from '../../helpers/requests' 13import { doRequest, downloadImage } from '../../helpers/requests'
14import { getUrlFromWebfinger } from '../../helpers/webfinger' 14import { getUrlFromWebfinger } from '../../helpers/webfinger'
15import { AVATARS_SIZE, MIMETYPES, sequelizeTypescript, WEBSERVER } from '../../initializers' 15import { AVATARS_SIZE, MIMETYPES, WEBSERVER } from '../../initializers/constants'
16import { AccountModel } from '../../models/account/account' 16import { AccountModel } from '../../models/account/account'
17import { ActorModel } from '../../models/activitypub/actor' 17import { ActorModel } from '../../models/activitypub/actor'
18import { AvatarModel } from '../../models/avatar/avatar' 18import { AvatarModel } from '../../models/avatar/avatar'
@@ -22,6 +22,7 @@ import { JobQueue } from '../job-queue'
22import { getServerActor } from '../../helpers/utils' 22import { getServerActor } from '../../helpers/utils'
23import { ActorFetchByUrlType, fetchActorByUrl } from '../../helpers/actor' 23import { ActorFetchByUrlType, fetchActorByUrl } from '../../helpers/actor'
24import { CONFIG } from '../../initializers/config' 24import { CONFIG } from '../../initializers/config'
25import { sequelizeTypescript } from '../../initializers/database'
25 26
26// Set account keys, this could be long so process after the account creation and do not block the client 27// Set account keys, this could be long so process after the account creation and do not block the client
27function setAsyncActorKeys (actor: ActorModel) { 28function setAsyncActorKeys (actor: ActorModel) {
diff --git a/server/lib/activitypub/audience.ts b/server/lib/activitypub/audience.ts
index 10277eca7..771a01366 100644
--- a/server/lib/activitypub/audience.ts
+++ b/server/lib/activitypub/audience.ts
@@ -1,6 +1,6 @@
1import { Transaction } from 'sequelize' 1import { Transaction } from 'sequelize'
2import { ActivityAudience } from '../../../shared/models/activitypub' 2import { ActivityAudience } from '../../../shared/models/activitypub'
3import { ACTIVITY_PUB } from '../../initializers' 3import { ACTIVITY_PUB } from '../../initializers/constants'
4import { ActorModel } from '../../models/activitypub/actor' 4import { ActorModel } from '../../models/activitypub/actor'
5import { VideoModel } from '../../models/video/video' 5import { VideoModel } from '../../models/video/video'
6import { VideoCommentModel } from '../../models/video/video-comment' 6import { VideoCommentModel } from '../../models/video/video-comment'
diff --git a/server/lib/activitypub/crawl.ts b/server/lib/activitypub/crawl.ts
index 9f4ca98ba..ba5b67bee 100644
--- a/server/lib/activitypub/crawl.ts
+++ b/server/lib/activitypub/crawl.ts
@@ -1,4 +1,4 @@
1import { ACTIVITY_PUB, JOB_REQUEST_TIMEOUT } from '../../initializers' 1import { ACTIVITY_PUB, JOB_REQUEST_TIMEOUT } from '../../initializers/constants'
2import { doRequest } from '../../helpers/requests' 2import { doRequest } from '../../helpers/requests'
3import { logger } from '../../helpers/logger' 3import { logger } from '../../helpers/logger'
4import * as Bluebird from 'bluebird' 4import * as Bluebird from 'bluebird'
diff --git a/server/lib/activitypub/playlist.ts b/server/lib/activitypub/playlist.ts
index a0d0e736e..f312409bc 100644
--- a/server/lib/activitypub/playlist.ts
+++ b/server/lib/activitypub/playlist.ts
@@ -1,6 +1,6 @@
1import { PlaylistObject } from '../../../shared/models/activitypub/objects/playlist-object' 1import { PlaylistObject } from '../../../shared/models/activitypub/objects/playlist-object'
2import { crawlCollectionPage } from './crawl' 2import { crawlCollectionPage } from './crawl'
3import { ACTIVITY_PUB, CRAWL_REQUEST_CONCURRENCY, sequelizeTypescript, THUMBNAILS_SIZE } from '../../initializers' 3import { ACTIVITY_PUB, CRAWL_REQUEST_CONCURRENCY, THUMBNAILS_SIZE } from '../../initializers/constants'
4import { AccountModel } from '../../models/account/account' 4import { AccountModel } from '../../models/account/account'
5import { isArray } from '../../helpers/custom-validators/misc' 5import { isArray } from '../../helpers/custom-validators/misc'
6import { getOrCreateActorAndServerAndModel } from './actor' 6import { getOrCreateActorAndServerAndModel } from './actor'
@@ -18,6 +18,7 @@ import { FilteredModelAttributes } from 'sequelize-typescript/lib/models/Model'
18import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' 18import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'
19import { ActivityIconObject } from '../../../shared/models/activitypub/objects' 19import { ActivityIconObject } from '../../../shared/models/activitypub/objects'
20import { CONFIG } from '../../initializers/config' 20import { CONFIG } from '../../initializers/config'
21import { sequelizeTypescript } from '../../initializers/database'
21 22
22function playlistObjectToDBAttributes (playlistObject: PlaylistObject, byAccount: AccountModel, to: string[]) { 23function playlistObjectToDBAttributes (playlistObject: PlaylistObject, byAccount: AccountModel, to: string[]) {
23 const privacy = to.indexOf(ACTIVITY_PUB.PUBLIC) !== -1 ? VideoPlaylistPrivacy.PUBLIC : VideoPlaylistPrivacy.UNLISTED 24 const privacy = to.indexOf(ACTIVITY_PUB.PUBLIC) !== -1 ? VideoPlaylistPrivacy.PUBLIC : VideoPlaylistPrivacy.UNLISTED
diff --git a/server/lib/activitypub/share.ts b/server/lib/activitypub/share.ts
index 3bece0ff7..7f38402b6 100644
--- a/server/lib/activitypub/share.ts
+++ b/server/lib/activitypub/share.ts
@@ -10,7 +10,7 @@ import * as Bluebird from 'bluebird'
10import { doRequest } from '../../helpers/requests' 10import { doRequest } from '../../helpers/requests'
11import { getOrCreateActorAndServerAndModel } from './actor' 11import { getOrCreateActorAndServerAndModel } from './actor'
12import { logger } from '../../helpers/logger' 12import { logger } from '../../helpers/logger'
13import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers' 13import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants'
14import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub' 14import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub'
15 15
16async function shareVideoByServerAndChannel (video: VideoModel, t: Transaction) { 16async function shareVideoByServerAndChannel (video: VideoModel, t: Transaction) {
diff --git a/server/lib/activitypub/url.ts b/server/lib/activitypub/url.ts
index 01950a13b..bcb7a4ee2 100644
--- a/server/lib/activitypub/url.ts
+++ b/server/lib/activitypub/url.ts
@@ -1,4 +1,4 @@
1import { WEBSERVER } from '../../initializers' 1import { WEBSERVER } from '../../initializers/constants'
2import { ActorModel } from '../../models/activitypub/actor' 2import { ActorModel } from '../../models/activitypub/actor'
3import { ActorFollowModel } from '../../models/activitypub/actor-follow' 3import { ActorFollowModel } from '../../models/activitypub/actor-follow'
4import { VideoModel } from '../../models/video/video' 4import { VideoModel } from '../../models/video/video'
diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts
index 3f9d8f0fc..18f44d50e 100644
--- a/server/lib/activitypub/video-comments.ts
+++ b/server/lib/activitypub/video-comments.ts
@@ -2,7 +2,7 @@ import { VideoCommentObject } from '../../../shared/models/activitypub/objects/v
2import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments' 2import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments'
3import { logger } from '../../helpers/logger' 3import { logger } from '../../helpers/logger'
4import { doRequest } from '../../helpers/requests' 4import { doRequest } from '../../helpers/requests'
5import { ACTIVITY_PUB, CRAWL_REQUEST_CONCURRENCY } from '../../initializers' 5import { ACTIVITY_PUB, CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants'
6import { ActorModel } from '../../models/activitypub/actor' 6import { ActorModel } from '../../models/activitypub/actor'
7import { VideoModel } from '../../models/video/video' 7import { VideoModel } from '../../models/video/video'
8import { VideoCommentModel } from '../../models/video/video-comment' 8import { VideoCommentModel } from '../../models/video/video-comment'
diff --git a/server/lib/activitypub/video-rates.ts b/server/lib/activitypub/video-rates.ts
index ad7d81df6..7809c58b8 100644
--- a/server/lib/activitypub/video-rates.ts
+++ b/server/lib/activitypub/video-rates.ts
@@ -7,7 +7,7 @@ import * as Bluebird from 'bluebird'
7import { getOrCreateActorAndServerAndModel } from './actor' 7import { getOrCreateActorAndServerAndModel } from './actor'
8import { AccountVideoRateModel } from '../../models/account/account-video-rate' 8import { AccountVideoRateModel } from '../../models/account/account-video-rate'
9import { logger } from '../../helpers/logger' 9import { logger } from '../../helpers/logger'
10import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers' 10import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants'
11import { doRequest } from '../../helpers/requests' 11import { doRequest } from '../../helpers/requests'
12import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub' 12import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub'
13import { ActorModel } from '../../models/activitypub/actor' 13import { ActorModel } from '../../models/activitypub/actor'
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts
index 191f4817b..b9252e363 100644
--- a/server/lib/activitypub/videos.ts
+++ b/server/lib/activitypub/videos.ts
@@ -17,14 +17,7 @@ import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos
17import { resetSequelizeInstance, retryTransactionWrapper } from '../../helpers/database-utils' 17import { resetSequelizeInstance, retryTransactionWrapper } from '../../helpers/database-utils'
18import { logger } from '../../helpers/logger' 18import { logger } from '../../helpers/logger'
19import { doRequest, downloadImage } from '../../helpers/requests' 19import { doRequest, downloadImage } from '../../helpers/requests'
20import { 20import { ACTIVITY_PUB, MIMETYPES, P2P_MEDIA_LOADER_PEER_VERSION, REMOTE_SCHEME, THUMBNAILS_SIZE } from '../../initializers/constants'
21 ACTIVITY_PUB,
22 MIMETYPES,
23 P2P_MEDIA_LOADER_PEER_VERSION,
24 REMOTE_SCHEME,
25 sequelizeTypescript,
26 THUMBNAILS_SIZE
27} from '../../initializers'
28import { ActorModel } from '../../models/activitypub/actor' 21import { ActorModel } from '../../models/activitypub/actor'
29import { TagModel } from '../../models/video/tag' 22import { TagModel } from '../../models/video/tag'
30import { VideoModel } from '../../models/video/video' 23import { VideoModel } from '../../models/video/video'
@@ -51,6 +44,7 @@ import { AccountVideoRateModel } from '../../models/account/account-video-rate'
51import { VideoShareModel } from '../../models/video/video-share' 44import { VideoShareModel } from '../../models/video/video-share'
52import { VideoCommentModel } from '../../models/video/video-comment' 45import { VideoCommentModel } from '../../models/video/video-comment'
53import { CONFIG } from '../../initializers/config' 46import { CONFIG } from '../../initializers/config'
47import { sequelizeTypescript } from '../../initializers/database'
54 48
55async function federateVideoIfNeeded (video: VideoModel, isNewVideo: boolean, transaction?: sequelize.Transaction) { 49async function federateVideoIfNeeded (video: VideoModel, isNewVideo: boolean, transaction?: sequelize.Transaction) {
56 // If the video is not private and is published, we federate it 50 // If the video is not private and is published, we federate it
diff --git a/server/lib/avatar.ts b/server/lib/avatar.ts
index a5316df4b..dca543d0b 100644
--- a/server/lib/avatar.ts
+++ b/server/lib/avatar.ts
@@ -1,6 +1,6 @@
1import 'multer' 1import 'multer'
2import { sendUpdateActor } from './activitypub/send' 2import { sendUpdateActor } from './activitypub/send'
3import { AVATARS_SIZE, sequelizeTypescript } from '../initializers' 3import { AVATARS_SIZE } from '../initializers/constants'
4import { updateActorAvatarInstance } from './activitypub' 4import { updateActorAvatarInstance } from './activitypub'
5import { processImage } from '../helpers/image-utils' 5import { processImage } from '../helpers/image-utils'
6import { AccountModel } from '../models/account/account' 6import { AccountModel } from '../models/account/account'
@@ -9,6 +9,7 @@ import { extname, join } from 'path'
9import { retryTransactionWrapper } from '../helpers/database-utils' 9import { retryTransactionWrapper } from '../helpers/database-utils'
10import * as uuidv4 from 'uuid/v4' 10import * as uuidv4 from 'uuid/v4'
11import { CONFIG } from '../initializers/config' 11import { CONFIG } from '../initializers/config'
12import { sequelizeTypescript } from '../initializers/database'
12 13
13async function updateActorAvatarFile (avatarPhysicalFile: Express.Multer.File, accountOrChannel: AccountModel | VideoChannelModel) { 14async function updateActorAvatarFile (avatarPhysicalFile: Express.Multer.File, accountOrChannel: AccountModel | VideoChannelModel) {
14 const extension = extname(avatarPhysicalFile.filename) 15 const extension = extname(avatarPhysicalFile.filename)
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts
index f8e1e456f..516827a05 100644
--- a/server/lib/client-html.ts
+++ b/server/lib/client-html.ts
@@ -1,6 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/models/i18n/i18n' 2import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/models/i18n/i18n'
3import { CUSTOM_HTML_TAG_COMMENTS, EMBED_SIZE, WEBSERVER } from '../initializers' 3import { CUSTOM_HTML_TAG_COMMENTS, EMBED_SIZE, WEBSERVER } from '../initializers/constants'
4import { join } from 'path' 4import { join } from 'path'
5import { escapeHTML } from '../helpers/core-utils' 5import { escapeHTML } from '../helpers/core-utils'
6import { VideoModel } from '../models/video/video' 6import { VideoModel } from '../models/video/video'
diff --git a/server/lib/files-cache/actor-follow-score-cache.ts b/server/lib/files-cache/actor-follow-score-cache.ts
index d070bde09..5f8ee806f 100644
--- a/server/lib/files-cache/actor-follow-score-cache.ts
+++ b/server/lib/files-cache/actor-follow-score-cache.ts
@@ -1,4 +1,4 @@
1import { ACTOR_FOLLOW_SCORE } from '../../initializers' 1import { ACTOR_FOLLOW_SCORE } from '../../initializers/constants'
2import { logger } from '../../helpers/logger' 2import { logger } from '../../helpers/logger'
3 3
4// Cache follows scores, instead of writing them too often in database 4// Cache follows scores, instead of writing them too often in database
diff --git a/server/lib/files-cache/videos-caption-cache.ts b/server/lib/files-cache/videos-caption-cache.ts
index f5ccfe0a2..0926f4009 100644
--- a/server/lib/files-cache/videos-caption-cache.ts
+++ b/server/lib/files-cache/videos-caption-cache.ts
@@ -1,5 +1,5 @@
1import { join } from 'path' 1import { join } from 'path'
2import { FILES_CACHE } from '../../initializers' 2import { FILES_CACHE } from '../../initializers/constants'
3import { VideoModel } from '../../models/video/video' 3import { VideoModel } from '../../models/video/video'
4import { VideoCaptionModel } from '../../models/video/video-caption' 4import { VideoCaptionModel } from '../../models/video/video-caption'
5import { AbstractVideoStaticFileCache } from './abstract-video-static-file-cache' 5import { AbstractVideoStaticFileCache } from './abstract-video-static-file-cache'
diff --git a/server/lib/files-cache/videos-preview-cache.ts b/server/lib/files-cache/videos-preview-cache.ts
index 192f99aec..6575e1c83 100644
--- a/server/lib/files-cache/videos-preview-cache.ts
+++ b/server/lib/files-cache/videos-preview-cache.ts
@@ -1,5 +1,5 @@
1import { join } from 'path' 1import { join } from 'path'
2import { FILES_CACHE, STATIC_PATHS } from '../../initializers' 2import { FILES_CACHE, STATIC_PATHS } from '../../initializers/constants'
3import { VideoModel } from '../../models/video/video' 3import { VideoModel } from '../../models/video/video'
4import { AbstractVideoStaticFileCache } from './abstract-video-static-file-cache' 4import { AbstractVideoStaticFileCache } from './abstract-video-static-file-cache'
5import { CONFIG } from '../../initializers/config' 5import { CONFIG } from '../../initializers/config'
diff --git a/server/lib/hls.ts b/server/lib/hls.ts
index e804e7b3a..98da4dcd8 100644
--- a/server/lib/hls.ts
+++ b/server/lib/hls.ts
@@ -1,6 +1,6 @@
1import { VideoModel } from '../models/video/video' 1import { VideoModel } from '../models/video/video'
2import { basename, dirname, join } from 'path' 2import { basename, dirname, join } from 'path'
3import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION, sequelizeTypescript } from '../initializers' 3import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION } from '../initializers/constants'
4import { close, ensureDir, move, open, outputJSON, pathExists, read, readFile, remove, writeFile } from 'fs-extra' 4import { close, ensureDir, move, open, outputJSON, pathExists, read, readFile, remove, writeFile } from 'fs-extra'
5import { getVideoFileSize } from '../helpers/ffmpeg-utils' 5import { getVideoFileSize } from '../helpers/ffmpeg-utils'
6import { sha256 } from '../helpers/core-utils' 6import { sha256 } from '../helpers/core-utils'
@@ -11,6 +11,7 @@ import { generateRandomString } from '../helpers/utils'
11import { flatten, uniq } from 'lodash' 11import { flatten, uniq } from 'lodash'
12import { VideoFileModel } from '../models/video/video-file' 12import { VideoFileModel } from '../models/video/video-file'
13import { CONFIG } from '../initializers/config' 13import { CONFIG } from '../initializers/config'
14import { sequelizeTypescript } from '../initializers/database'
14 15
15async function updateStreamingPlaylistsInfohashesIfNeeded () { 16async function updateStreamingPlaylistsInfohashesIfNeeded () {
16 const playlistsToUpdate = await VideoStreamingPlaylistModel.listByIncorrectPeerVersion() 17 const playlistsToUpdate = await VideoStreamingPlaylistModel.listByIncorrectPeerVersion()
diff --git a/server/lib/job-queue/handlers/activitypub-follow.ts b/server/lib/job-queue/handlers/activitypub-follow.ts
index 7c84aa937..b3defb617 100644
--- a/server/lib/job-queue/handlers/activitypub-follow.ts
+++ b/server/lib/job-queue/handlers/activitypub-follow.ts
@@ -1,6 +1,6 @@
1import * as Bull from 'bull' 1import * as Bull from 'bull'
2import { logger } from '../../../helpers/logger' 2import { logger } from '../../../helpers/logger'
3import { REMOTE_SCHEME, sequelizeTypescript, WEBSERVER } from '../../../initializers' 3import { REMOTE_SCHEME, WEBSERVER } from '../../../initializers/constants'
4import { sendFollow } from '../../activitypub/send' 4import { sendFollow } from '../../activitypub/send'
5import { sanitizeHost } from '../../../helpers/core-utils' 5import { sanitizeHost } from '../../../helpers/core-utils'
6import { loadActorUrlOrGetFromWebfinger } from '../../../helpers/webfinger' 6import { loadActorUrlOrGetFromWebfinger } from '../../../helpers/webfinger'
@@ -9,6 +9,7 @@ import { retryTransactionWrapper } from '../../../helpers/database-utils'
9import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 9import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
10import { ActorModel } from '../../../models/activitypub/actor' 10import { ActorModel } from '../../../models/activitypub/actor'
11import { Notifier } from '../../notifier' 11import { Notifier } from '../../notifier'
12import { sequelizeTypescript } from '../../../initializers/database'
12 13
13export type ActivitypubFollowPayload = { 14export type ActivitypubFollowPayload = {
14 followerActorId: number 15 followerActorId: number
diff --git a/server/lib/job-queue/handlers/activitypub-http-broadcast.ts b/server/lib/job-queue/handlers/activitypub-http-broadcast.ts
index 2b1e21c39..0ff7b44a0 100644
--- a/server/lib/job-queue/handlers/activitypub-http-broadcast.ts
+++ b/server/lib/job-queue/handlers/activitypub-http-broadcast.ts
@@ -3,7 +3,7 @@ import * as Bluebird from 'bluebird'
3import { logger } from '../../../helpers/logger' 3import { logger } from '../../../helpers/logger'
4import { doRequest } from '../../../helpers/requests' 4import { doRequest } from '../../../helpers/requests'
5import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils' 5import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils'
6import { BROADCAST_CONCURRENCY, JOB_REQUEST_TIMEOUT } from '../../../initializers' 6import { BROADCAST_CONCURRENCY, JOB_REQUEST_TIMEOUT } from '../../../initializers/constants'
7import { ActorFollowScoreCache } from '../../files-cache' 7import { ActorFollowScoreCache } from '../../files-cache'
8 8
9export type ActivitypubHttpBroadcastPayload = { 9export type ActivitypubHttpBroadcastPayload = {
diff --git a/server/lib/job-queue/handlers/activitypub-http-unicast.ts b/server/lib/job-queue/handlers/activitypub-http-unicast.ts
index 59de7119a..c70ce3be9 100644
--- a/server/lib/job-queue/handlers/activitypub-http-unicast.ts
+++ b/server/lib/job-queue/handlers/activitypub-http-unicast.ts
@@ -2,7 +2,7 @@ import * as Bull from 'bull'
2import { logger } from '../../../helpers/logger' 2import { logger } from '../../../helpers/logger'
3import { doRequest } from '../../../helpers/requests' 3import { doRequest } from '../../../helpers/requests'
4import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils' 4import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils'
5import { JOB_REQUEST_TIMEOUT } from '../../../initializers' 5import { JOB_REQUEST_TIMEOUT } from '../../../initializers/constants'
6import { ActorFollowScoreCache } from '../../files-cache' 6import { ActorFollowScoreCache } from '../../files-cache'
7 7
8export type ActivitypubHttpUnicastPayload = { 8export type ActivitypubHttpUnicastPayload = {
diff --git a/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts b/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts
index 4961d4502..5c25625f6 100644
--- a/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts
+++ b/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts
@@ -2,7 +2,7 @@ import { buildSignedActivity } from '../../../../helpers/activitypub'
2import { getServerActor } from '../../../../helpers/utils' 2import { getServerActor } from '../../../../helpers/utils'
3import { ActorModel } from '../../../../models/activitypub/actor' 3import { ActorModel } from '../../../../models/activitypub/actor'
4import { sha256 } from '../../../../helpers/core-utils' 4import { sha256 } from '../../../../helpers/core-utils'
5import { HTTP_SIGNATURE } from '../../../../initializers' 5import { HTTP_SIGNATURE } from '../../../../initializers/constants'
6 6
7type Payload = { body: any, signatureActorId?: number } 7type Payload = { body: any, signatureActorId?: number }
8 8
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts
index 732773efd..8e8aa1597 100644
--- a/server/lib/job-queue/handlers/video-import.ts
+++ b/server/lib/job-queue/handlers/video-import.ts
@@ -6,7 +6,7 @@ import { VideoImportState } from '../../../../shared/models/videos'
6import { getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' 6import { getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils'
7import { extname, join } from 'path' 7import { extname, join } from 'path'
8import { VideoFileModel } from '../../../models/video/video-file' 8import { VideoFileModel } from '../../../models/video/video-file'
9import { PREVIEWS_SIZE, sequelizeTypescript, THUMBNAILS_SIZE, VIDEO_IMPORT_TIMEOUT } from '../../../initializers' 9import { PREVIEWS_SIZE, THUMBNAILS_SIZE, VIDEO_IMPORT_TIMEOUT } from '../../../initializers/constants'
10import { downloadImage } from '../../../helpers/requests' 10import { downloadImage } from '../../../helpers/requests'
11import { VideoState } from '../../../../shared' 11import { VideoState } from '../../../../shared'
12import { JobQueue } from '../index' 12import { JobQueue } from '../index'
@@ -17,6 +17,7 @@ import { getSecureTorrentName } from '../../../helpers/utils'
17import { move, remove, stat } from 'fs-extra' 17import { move, remove, stat } from 'fs-extra'
18import { Notifier } from '../../notifier' 18import { Notifier } from '../../notifier'
19import { CONFIG } from '../../../initializers/config' 19import { CONFIG } from '../../../initializers/config'
20import { sequelizeTypescript } from '../../../initializers/database'
20 21
21type VideoImportYoutubeDLPayload = { 22type VideoImportYoutubeDLPayload = {
22 type: 'youtube-dl' 23 type: 'youtube-dl'
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts
index 1c2aa109d..f09eb6ff1 100644
--- a/server/lib/job-queue/job-queue.ts
+++ b/server/lib/job-queue/job-queue.ts
@@ -2,7 +2,7 @@ import * as Bull from 'bull'
2import { JobState, JobType } from '../../../shared/models' 2import { JobState, JobType } from '../../../shared/models'
3import { logger } from '../../helpers/logger' 3import { logger } from '../../helpers/logger'
4import { Redis } from '../redis' 4import { Redis } from '../redis'
5import { JOB_ATTEMPTS, JOB_COMPLETED_LIFETIME, JOB_CONCURRENCY, JOB_TTL, REPEAT_JOBS, WEBSERVER } from '../../initializers' 5import { JOB_ATTEMPTS, JOB_COMPLETED_LIFETIME, JOB_CONCURRENCY, JOB_TTL, REPEAT_JOBS, WEBSERVER } from '../../initializers/constants'
6import { ActivitypubHttpBroadcastPayload, processActivityPubHttpBroadcast } from './handlers/activitypub-http-broadcast' 6import { ActivitypubHttpBroadcastPayload, processActivityPubHttpBroadcast } from './handlers/activitypub-http-broadcast'
7import { ActivitypubHttpFetcherPayload, processActivityPubHttpFetcher } from './handlers/activitypub-http-fetcher' 7import { ActivitypubHttpFetcherPayload, processActivityPubHttpFetcher } from './handlers/activitypub-http-fetcher'
8import { ActivitypubHttpUnicastPayload, processActivityPubHttpUnicast } from './handlers/activitypub-http-unicast' 8import { ActivitypubHttpUnicastPayload, processActivityPubHttpUnicast } from './handlers/activitypub-http-unicast'
diff --git a/server/lib/redis.ts b/server/lib/redis.ts
index a7ec8c9df..b4044bf0f 100644
--- a/server/lib/redis.ts
+++ b/server/lib/redis.ts
@@ -8,7 +8,7 @@ import {
8 USER_PASSWORD_RESET_LIFETIME, 8 USER_PASSWORD_RESET_LIFETIME,
9 VIDEO_VIEW_LIFETIME, 9 VIDEO_VIEW_LIFETIME,
10 WEBSERVER 10 WEBSERVER
11} from '../initializers' 11} from '../initializers/constants'
12import { CONFIG } from '../initializers/config' 12import { CONFIG } from '../initializers/config'
13 13
14type CachedRoute = { 14type CachedRoute = {
diff --git a/server/lib/schedulers/actor-follow-scheduler.ts b/server/lib/schedulers/actor-follow-scheduler.ts
index 05e6bd139..fdd3ad5fa 100644
--- a/server/lib/schedulers/actor-follow-scheduler.ts
+++ b/server/lib/schedulers/actor-follow-scheduler.ts
@@ -2,7 +2,7 @@ import { isTestInstance } from '../../helpers/core-utils'
2import { logger } from '../../helpers/logger' 2import { logger } from '../../helpers/logger'
3import { ActorFollowModel } from '../../models/activitypub/actor-follow' 3import { ActorFollowModel } from '../../models/activitypub/actor-follow'
4import { AbstractScheduler } from './abstract-scheduler' 4import { AbstractScheduler } from './abstract-scheduler'
5import { SCHEDULER_INTERVALS_MS } from '../../initializers' 5import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
6import { ActorFollowScoreCache } from '../files-cache' 6import { ActorFollowScoreCache } from '../files-cache'
7 7
8export class ActorFollowScheduler extends AbstractScheduler { 8export class ActorFollowScheduler extends AbstractScheduler {
diff --git a/server/lib/schedulers/remove-old-jobs-scheduler.ts b/server/lib/schedulers/remove-old-jobs-scheduler.ts
index 4a4341ba9..0179a7618 100644
--- a/server/lib/schedulers/remove-old-jobs-scheduler.ts
+++ b/server/lib/schedulers/remove-old-jobs-scheduler.ts
@@ -2,7 +2,7 @@ import { isTestInstance } from '../../helpers/core-utils'
2import { logger } from '../../helpers/logger' 2import { logger } from '../../helpers/logger'
3import { JobQueue } from '../job-queue' 3import { JobQueue } from '../job-queue'
4import { AbstractScheduler } from './abstract-scheduler' 4import { AbstractScheduler } from './abstract-scheduler'
5import { SCHEDULER_INTERVALS_MS } from '../../initializers' 5import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
6 6
7export class RemoveOldJobsScheduler extends AbstractScheduler { 7export class RemoveOldJobsScheduler extends AbstractScheduler {
8 8
diff --git a/server/lib/schedulers/update-videos-scheduler.ts b/server/lib/schedulers/update-videos-scheduler.ts
index 2179a2f26..80080a132 100644
--- a/server/lib/schedulers/update-videos-scheduler.ts
+++ b/server/lib/schedulers/update-videos-scheduler.ts
@@ -3,10 +3,11 @@ import { AbstractScheduler } from './abstract-scheduler'
3import { ScheduleVideoUpdateModel } from '../../models/video/schedule-video-update' 3import { ScheduleVideoUpdateModel } from '../../models/video/schedule-video-update'
4import { retryTransactionWrapper } from '../../helpers/database-utils' 4import { retryTransactionWrapper } from '../../helpers/database-utils'
5import { federateVideoIfNeeded } from '../activitypub' 5import { federateVideoIfNeeded } from '../activitypub'
6import { SCHEDULER_INTERVALS_MS, sequelizeTypescript } from '../../initializers' 6import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
7import { VideoPrivacy } from '../../../shared/models/videos' 7import { VideoPrivacy } from '../../../shared/models/videos'
8import { Notifier } from '../notifier' 8import { Notifier } from '../notifier'
9import { VideoModel } from '../../models/video/video' 9import { VideoModel } from '../../models/video/video'
10import { sequelizeTypescript } from '../../initializers/database'
10 11
11export class UpdateVideosScheduler extends AbstractScheduler { 12export class UpdateVideosScheduler extends AbstractScheduler {
12 13
diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts
index 4a8a1d413..01af1e9d2 100644
--- a/server/lib/schedulers/videos-redundancy-scheduler.ts
+++ b/server/lib/schedulers/videos-redundancy-scheduler.ts
@@ -1,5 +1,5 @@
1import { AbstractScheduler } from './abstract-scheduler' 1import { AbstractScheduler } from './abstract-scheduler'
2import { HLS_REDUNDANCY_DIRECTORY, REDUNDANCY, VIDEO_IMPORT_TIMEOUT, WEBSERVER } from '../../initializers' 2import { HLS_REDUNDANCY_DIRECTORY, REDUNDANCY, VIDEO_IMPORT_TIMEOUT, WEBSERVER } from '../../initializers/constants'
3import { logger } from '../../helpers/logger' 3import { logger } from '../../helpers/logger'
4import { VideosRedundancy } from '../../../shared/models/redundancy' 4import { VideosRedundancy } from '../../../shared/models/redundancy'
5import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' 5import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
diff --git a/server/lib/schedulers/youtube-dl-update-scheduler.ts b/server/lib/schedulers/youtube-dl-update-scheduler.ts
index aa027116d..aefe6aba4 100644
--- a/server/lib/schedulers/youtube-dl-update-scheduler.ts
+++ b/server/lib/schedulers/youtube-dl-update-scheduler.ts
@@ -1,5 +1,5 @@
1import { AbstractScheduler } from './abstract-scheduler' 1import { AbstractScheduler } from './abstract-scheduler'
2import { SCHEDULER_INTERVALS_MS } from '../../initializers' 2import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
3import { updateYoutubeDLBinary } from '../../helpers/youtube-dl' 3import { updateYoutubeDLBinary } from '../../helpers/youtube-dl'
4 4
5export class YoutubeDlUpdateScheduler extends AbstractScheduler { 5export class YoutubeDlUpdateScheduler extends AbstractScheduler {
diff --git a/server/lib/user.ts b/server/lib/user.ts
index 6fbe3ed03..ce0d60518 100644
--- a/server/lib/user.ts
+++ b/server/lib/user.ts
@@ -1,7 +1,7 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import * as uuidv4 from 'uuid/v4' 2import * as uuidv4 from 'uuid/v4'
3import { ActivityPubActorType } from '../../shared/models/activitypub' 3import { ActivityPubActorType } from '../../shared/models/activitypub'
4import { sequelizeTypescript, SERVER_ACTOR_NAME } from '../initializers' 4import { SERVER_ACTOR_NAME } from '../initializers/constants'
5import { AccountModel } from '../models/account/account' 5import { AccountModel } from '../models/account/account'
6import { UserModel } from '../models/account/user' 6import { UserModel } from '../models/account/user'
7import { buildActorInstance, getAccountActivityPubUrl, setAsyncActorKeys } from './activitypub' 7import { buildActorInstance, getAccountActivityPubUrl, setAsyncActorKeys } from './activitypub'
@@ -12,6 +12,7 @@ import { ActorModel } from '../models/activitypub/actor'
12import { UserNotificationSettingModel } from '../models/account/user-notification-setting' 12import { UserNotificationSettingModel } from '../models/account/user-notification-setting'
13import { UserNotificationSetting, UserNotificationSettingValue } from '../../shared/models/users' 13import { UserNotificationSetting, UserNotificationSettingValue } from '../../shared/models/users'
14import { createWatchLaterPlaylist } from './video-playlist' 14import { createWatchLaterPlaylist } from './video-playlist'
15import { sequelizeTypescript } from '../initializers/database'
15 16
16async function createUserAccountAndChannelAndPlaylist (userToCreate: UserModel, validateUser = true) { 17async function createUserAccountAndChannelAndPlaylist (userToCreate: UserModel, validateUser = true) {
17 const { user, account, videoChannel } = await sequelizeTypescript.transaction(async t => { 18 const { user, account, videoChannel } = await sequelizeTypescript.transaction(async t => {
diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts
index 11098dca3..0fe0ff12a 100644
--- a/server/lib/video-transcoding.ts
+++ b/server/lib/video-transcoding.ts
@@ -1,4 +1,4 @@
1import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION, WEBSERVER } from '../initializers' 1import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION, WEBSERVER } from '../initializers/constants'
2import { join } from 'path' 2import { join } from 'path'
3import { getVideoFileFPS, transcode } from '../helpers/ffmpeg-utils' 3import { getVideoFileFPS, transcode } from '../helpers/ffmpeg-utils'
4import { ensureDir, move, remove, stat } from 'fs-extra' 4import { ensureDir, move, remove, stat } from 'fs-extra'
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'
2import { ActivityPubSignature } from '../../shared' 2import { ActivityPubSignature } from '../../shared'
3import { logger } from '../helpers/logger' 3import { logger } from '../helpers/logger'
4import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto' 4import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto'
5import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers' 5import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants'
6import { getOrCreateActorAndServerAndModel } from '../lib/activitypub' 6import { getOrCreateActorAndServerAndModel } from '../lib/activitypub'
7import { loadActorUrlOrGetFromWebfinger } from '../helpers/webfinger' 7import { loadActorUrlOrGetFromWebfinger } from '../helpers/webfinger'
8 8
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 @@
1import * as express from 'express' 1import * as express from 'express'
2import * as OAuthServer from 'express-oauth-server' 2import * as OAuthServer from 'express-oauth-server'
3import 'express-validator' 3import 'express-validator'
4import { OAUTH_LIFETIME } from '../initializers' 4import { OAUTH_LIFETIME } from '../initializers/constants'
5import { logger } from '../helpers/logger' 5import { logger } from '../helpers/logger'
6import { Socket } from 'socket.io' 6import { Socket } from 'socket.io'
7import { getAccessToken } from '../lib/oauth-model' 7import { 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 @@
1import 'express-validator' 1import 'express-validator'
2import * as express from 'express' 2import * as express from 'express'
3 3
4import { PAGINATION } from '../initializers' 4import { PAGINATION } from '../initializers/constants'
5 5
6function setDefaultPagination (req: express.Request, res: express.Response, next: express.NextFunction) { 6function setDefaultPagination (req: express.Request, res: express.Response, next: express.NextFunction) {
7 if (!req.query.start) req.query.start = 0 7 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'
2import { body } from 'express-validator/check' 2import { body } from 'express-validator/check'
3import { isAvatarFile } from '../../helpers/custom-validators/users' 3import { isAvatarFile } from '../../helpers/custom-validators/users'
4import { areValidationErrors } from './utils' 4import { areValidationErrors } from './utils'
5import { CONSTRAINTS_FIELDS } from '../../initializers' 5import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
6import { logger } from '../../helpers/logger' 6import { logger } from '../../helpers/logger'
7import { cleanUpReqFiles } from '../../helpers/express-utils' 7import { cleanUpReqFiles } from '../../helpers/express-utils'
8 8
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'
4import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers' 4import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers'
5import { logger } from '../../helpers/logger' 5import { logger } from '../../helpers/logger'
6import { getServerActor } from '../../helpers/utils' 6import { getServerActor } from '../../helpers/utils'
7import { SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers' 7import { SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants'
8import { ActorFollowModel } from '../../models/activitypub/actor-follow' 8import { ActorFollowModel } from '../../models/activitypub/actor-follow'
9import { areValidationErrors } from './utils' 9import { areValidationErrors } from './utils'
10import { ActorModel } from '../../models/activitypub/actor' 10import { 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 @@
1import { SORTABLE_COLUMNS } from '../../initializers' 1import { SORTABLE_COLUMNS } from '../../initializers/constants'
2import { checkSort, createSortableColumns } from './utils' 2import { checkSort, createSortableColumns } from './utils'
3 3
4// Initialize constants here for better performances 4// 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'
3import { checkUserCanManageVideo, doesVideoExist } from '../../../helpers/custom-validators/videos' 3import { checkUserCanManageVideo, doesVideoExist } from '../../../helpers/custom-validators/videos'
4import { isIdOrUUIDValid } from '../../../helpers/custom-validators/misc' 4import { isIdOrUUIDValid } from '../../../helpers/custom-validators/misc'
5import { body, param } from 'express-validator/check' 5import { body, param } from 'express-validator/check'
6import { CONSTRAINTS_FIELDS } from '../../../initializers' 6import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'
7import { UserRight } from '../../../../shared' 7import { UserRight } from '../../../../shared'
8import { logger } from '../../../helpers/logger' 8import { logger } from '../../../helpers/logger'
9import { doesVideoCaptionExist, isVideoCaptionFile, isVideoCaptionLanguageValid } from '../../../helpers/custom-validators/video-captions' 9import { 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 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param } from 'express-validator/check' 2import { body, param } from 'express-validator/check'
3import { UserRight } from '../../../../shared' 3import { UserRight } from '../../../../shared'
4import { doesAccountNameWithHostExist } from '../../../helpers/custom-validators/accounts'
5import { 4import {
6 doesLocalVideoChannelNameExist, 5 doesLocalVideoChannelNameExist,
6 doesVideoChannelNameWithHostExist,
7 isVideoChannelDescriptionValid, 7 isVideoChannelDescriptionValid,
8 isVideoChannelNameValid, 8 isVideoChannelNameValid,
9 doesVideoChannelNameWithHostExist,
10 isVideoChannelSupportValid 9 isVideoChannelSupportValid
11} from '../../../helpers/custom-validators/video-channels' 10} from '../../../helpers/custom-validators/video-channels'
12import { logger } from '../../../helpers/logger' 11import { 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 '../../../
8import { cleanUpReqFiles } from '../../../helpers/express-utils' 8import { cleanUpReqFiles } from '../../../helpers/express-utils'
9import { doesVideoChannelOfAccountExist, isVideoMagnetUriValid, isVideoNameValid } from '../../../helpers/custom-validators/videos' 9import { doesVideoChannelOfAccountExist, isVideoMagnetUriValid, isVideoNameValid } from '../../../helpers/custom-validators/videos'
10import { CONFIG } from '../../../initializers/config' 10import { CONFIG } from '../../../initializers/config'
11import { CONSTRAINTS_FIELDS } from '../../../initializers' 11import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'
12 12
13const videoImportAddValidator = getCommonVideoEditAttributes().concat([ 13const videoImportAddValidator = getCommonVideoEditAttributes().concat([
14 body('channelId') 14 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'
5import { UserModel } from '../../../models/account/user' 5import { UserModel } from '../../../models/account/user'
6import { areValidationErrors } from '../utils' 6import { areValidationErrors } from '../utils'
7import { doesVideoExist, isVideoImage } from '../../../helpers/custom-validators/videos' 7import { doesVideoExist, isVideoImage } from '../../../helpers/custom-validators/videos'
8import { CONSTRAINTS_FIELDS } from '../../../initializers' 8import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'
9import { isArrayOf, isIdOrUUIDValid, isIdValid, isUUIDValid, toIntArray, toValueOrNull } from '../../../helpers/custom-validators/misc' 9import { isArrayOf, isIdOrUUIDValid, isIdValid, isUUIDValid, toIntArray, toValueOrNull } from '../../../helpers/custom-validators/misc'
10import { 10import {
11 doesVideoPlaylistExist, 11 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 {
32} from '../../../helpers/custom-validators/videos' 32} from '../../../helpers/custom-validators/videos'
33import { getDurationFromVideoFile } from '../../../helpers/ffmpeg-utils' 33import { getDurationFromVideoFile } from '../../../helpers/ffmpeg-utils'
34import { logger } from '../../../helpers/logger' 34import { logger } from '../../../helpers/logger'
35import { CONSTRAINTS_FIELDS } from '../../../initializers' 35import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'
36import { authenticatePromiseIfNeeded } from '../../oauth' 36import { authenticatePromiseIfNeeded } from '../../oauth'
37import { areValidationErrors } from '../utils' 37import { areValidationErrors } from '../utils'
38import { cleanUpReqFiles } from '../../../helpers/express-utils' 38import { cleanUpReqFiles } from '../../../helpers/express-utils'
diff --git a/server/models/account/account-video-rate.ts b/server/models/account/account-video-rate.ts
index f462df4b3..78a897a65 100644
--- a/server/models/account/account-video-rate.ts
+++ b/server/models/account/account-video-rate.ts
@@ -3,7 +3,7 @@ import { Transaction, Op } from 'sequelize'
3import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' 3import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
4import { IFindOptions } from 'sequelize-typescript/lib/interfaces/IFindOptions' 4import { IFindOptions } from 'sequelize-typescript/lib/interfaces/IFindOptions'
5import { VideoRateType } from '../../../shared/models/videos' 5import { VideoRateType } from '../../../shared/models/videos'
6import { CONSTRAINTS_FIELDS, VIDEO_RATE_TYPES } from '../../initializers' 6import { CONSTRAINTS_FIELDS, VIDEO_RATE_TYPES } from '../../initializers/constants'
7import { VideoModel } from '../video/video' 7import { VideoModel } from '../video/video'
8import { AccountModel } from './account' 8import { AccountModel } from './account'
9import { ActorModel } from '../activitypub/actor' 9import { ActorModel } from '../activitypub/actor'
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index 8aff9f497..38585c016 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -42,7 +42,7 @@ import { VideoChannelModel } from '../video/video-channel'
42import { AccountModel } from './account' 42import { AccountModel } from './account'
43import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type' 43import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type'
44import { values } from 'lodash' 44import { values } from 'lodash'
45import { NSFW_POLICY_TYPES } from '../../initializers' 45import { NSFW_POLICY_TYPES } from '../../initializers/constants'
46import { clearCacheByUserId } from '../../lib/oauth-model' 46import { clearCacheByUserId } from '../../lib/oauth-model'
47import { UserNotificationSettingModel } from './user-notification-setting' 47import { UserNotificationSettingModel } from './user-notification-setting'
48import { VideoModel } from '../video/video' 48import { VideoModel } from '../video/video'
diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts
index e3eeb7dae..1b272e1c8 100644
--- a/server/models/activitypub/actor-follow.ts
+++ b/server/models/activitypub/actor-follow.ts
@@ -22,7 +22,7 @@ import { FollowState } from '../../../shared/models/actors'
22import { ActorFollow } from '../../../shared/models/actors/follow.model' 22import { ActorFollow } from '../../../shared/models/actors/follow.model'
23import { logger } from '../../helpers/logger' 23import { logger } from '../../helpers/logger'
24import { getServerActor } from '../../helpers/utils' 24import { getServerActor } from '../../helpers/utils'
25import { ACTOR_FOLLOW_SCORE } from '../../initializers' 25import { ACTOR_FOLLOW_SCORE } from '../../initializers/constants'
26import { FOLLOW_STATES } from '../../initializers/constants' 26import { FOLLOW_STATES } from '../../initializers/constants'
27import { ServerModel } from '../server/server' 27import { ServerModel } from '../server/server'
28import { getSort } from '../utils' 28import { getSort } from '../utils'
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts
index 5472c8b92..e8f603031 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/activitypub/actor.ts
@@ -30,7 +30,7 @@ import {
30 isActorPublicKeyValid 30 isActorPublicKeyValid
31} from '../../helpers/custom-validators/activitypub/actor' 31} from '../../helpers/custom-validators/activitypub/actor'
32import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' 32import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
33import { ACTIVITY_PUB, ACTIVITY_PUB_ACTOR_TYPES, CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers' 33import { ACTIVITY_PUB, ACTIVITY_PUB_ACTOR_TYPES, CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'
34import { AccountModel } from '../account/account' 34import { AccountModel } from '../account/account'
35import { AvatarModel } from '../avatar/avatar' 35import { AvatarModel } from '../avatar/avatar'
36import { ServerModel } from '../server/server' 36import { ServerModel } from '../server/server'
diff --git a/server/models/avatar/avatar.ts b/server/models/avatar/avatar.ts
index 455835524..aaf1b8bd9 100644
--- a/server/models/avatar/avatar.ts
+++ b/server/models/avatar/avatar.ts
@@ -1,7 +1,7 @@
1import { join } from 'path' 1import { join } from 'path'
2import { AfterDestroy, AllowNull, Column, CreatedAt, Model, Table, UpdatedAt } from 'sequelize-typescript' 2import { AfterDestroy, AllowNull, Column, CreatedAt, Model, Table, UpdatedAt } from 'sequelize-typescript'
3import { Avatar } from '../../../shared/models/avatars/avatar.model' 3import { Avatar } from '../../../shared/models/avatars/avatar.model'
4import { STATIC_PATHS } from '../../initializers' 4import { STATIC_PATHS } from '../../initializers/constants'
5import { logger } from '../../helpers/logger' 5import { logger } from '../../helpers/logger'
6import { remove } from 'fs-extra' 6import { remove } from 'fs-extra'
7import { CONFIG } from '../../initializers/config' 7import { CONFIG } from '../../initializers/config'
diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts
index 39c50be5c..2b8e44223 100644
--- a/server/models/redundancy/video-redundancy.ts
+++ b/server/models/redundancy/video-redundancy.ts
@@ -15,7 +15,7 @@ import {
15import { ActorModel } from '../activitypub/actor' 15import { ActorModel } from '../activitypub/actor'
16import { getVideoSort, throwIfNotValid } from '../utils' 16import { getVideoSort, throwIfNotValid } from '../utils'
17import { isActivityPubUrlValid, isUrlValid } from '../../helpers/custom-validators/activitypub/misc' 17import { isActivityPubUrlValid, isUrlValid } from '../../helpers/custom-validators/activitypub/misc'
18import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../initializers' 18import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../initializers/constants'
19import { VideoFileModel } from '../video/video-file' 19import { VideoFileModel } from '../video/video-file'
20import { getServerActor } from '../../helpers/utils' 20import { getServerActor } from '../../helpers/utils'
21import { VideoModel } from '../video/video' 21import { VideoModel } from '../video/video'
diff --git a/server/models/utils.ts b/server/models/utils.ts
index f8a71b270..a478bc62b 100644
--- a/server/models/utils.ts
+++ b/server/models/utils.ts
@@ -1,6 +1,5 @@
1import { Sequelize } from 'sequelize-typescript' 1import { Sequelize } from 'sequelize-typescript'
2import * as validator from 'validator' 2import * as validator from 'validator'
3import { ACTIVITY_PUB } from '../initializers'
4 3
5type SortType = { sortModel: any, sortValue: string } 4type SortType = { sortModel: any, sortValue: string }
6 5
diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts
index cc47644f2..eacd651cc 100644
--- a/server/models/video/video-abuse.ts
+++ b/server/models/video/video-abuse.ts
@@ -10,7 +10,7 @@ import { AccountModel } from '../account/account'
10import { getSort, throwIfNotValid } from '../utils' 10import { getSort, throwIfNotValid } from '../utils'
11import { VideoModel } from './video' 11import { VideoModel } from './video'
12import { VideoAbuseState } from '../../../shared' 12import { VideoAbuseState } from '../../../shared'
13import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers' 13import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants'
14 14
15@Table({ 15@Table({
16 tableName: 'videoAbuse', 16 tableName: 'videoAbuse',
diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.ts
index 86b1f6acb..2619b4950 100644
--- a/server/models/video/video-blacklist.ts
+++ b/server/models/video/video-blacklist.ts
@@ -16,7 +16,7 @@ import { VideoModel } from './video'
16import { VideoChannelModel, ScopeNames as VideoChannelScopeNames } from './video-channel' 16import { VideoChannelModel, ScopeNames as VideoChannelScopeNames } from './video-channel'
17import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist' 17import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist'
18import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos' 18import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos'
19import { CONSTRAINTS_FIELDS } from '../../initializers' 19import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
20 20
21@Table({ 21@Table({
22 tableName: 'videoBlacklist', 22 tableName: 'videoBlacklist',
diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts
index c670bce71..f2dbbfde8 100644
--- a/server/models/video/video-caption.ts
+++ b/server/models/video/video-caption.ts
@@ -16,7 +16,7 @@ import { throwIfNotValid } from '../utils'
16import { VideoModel } from './video' 16import { VideoModel } from './video'
17import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions' 17import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions'
18import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model' 18import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model'
19import { STATIC_PATHS, VIDEO_LANGUAGES } from '../../initializers' 19import { STATIC_PATHS, VIDEO_LANGUAGES } from '../../initializers/constants'
20import { join } from 'path' 20import { join } from 'path'
21import { logger } from '../../helpers/logger' 21import { logger } from '../../helpers/logger'
22import { remove } from 'fs-extra' 22import { remove } from 'fs-extra'
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 1abc23eaa..5b5075344 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -29,7 +29,7 @@ import { AccountModel, ScopeNames as AccountModelScopeNames } from '../account/a
29import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor' 29import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor'
30import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils' 30import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils'
31import { VideoModel } from './video' 31import { VideoModel } from './video'
32import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers' 32import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'
33import { ServerModel } from '../server/server' 33import { ServerModel } from '../server/server'
34import { DefineIndexesOptions } from 'sequelize' 34import { DefineIndexesOptions } from 'sequelize'
35import { AvatarModel } from '../avatar/avatar' 35import { AvatarModel } from '../avatar/avatar'
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index 47f1cbb99..cb5f1cbbe 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -18,7 +18,7 @@ import { ActivityTagObject } from '../../../shared/models/activitypub/objects/co
18import { VideoCommentObject } from '../../../shared/models/activitypub/objects/video-comment-object' 18import { VideoCommentObject } from '../../../shared/models/activitypub/objects/video-comment-object'
19import { VideoComment } from '../../../shared/models/videos/video-comment.model' 19import { VideoComment } from '../../../shared/models/videos/video-comment.model'
20import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' 20import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
21import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers' 21import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'
22import { sendDeleteVideoComment } from '../../lib/activitypub/send' 22import { sendDeleteVideoComment } from '../../lib/activitypub/send'
23import { AccountModel } from '../account/account' 23import { AccountModel } from '../account/account'
24import { ActorModel } from '../activitypub/actor' 24import { ActorModel } from '../activitypub/actor'
diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts
index 7915fc1f9..64771b1ff 100644
--- a/server/models/video/video-format-utils.ts
+++ b/server/models/video/video-format-utils.ts
@@ -7,7 +7,7 @@ import {
7 ActivityUrlObject, 7 ActivityUrlObject,
8 VideoTorrentObject 8 VideoTorrentObject
9} from '../../../shared/models/activitypub/objects' 9} from '../../../shared/models/activitypub/objects'
10import { MIMETYPES, THUMBNAILS_SIZE, WEBSERVER } from '../../initializers' 10import { MIMETYPES, THUMBNAILS_SIZE, WEBSERVER } from '../../initializers/constants'
11import { VideoCaptionModel } from './video-caption' 11import { VideoCaptionModel } from './video-caption'
12import { 12import {
13 getVideoCommentsActivityPubUrl, 13 getVideoCommentsActivityPubUrl,
diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts
index 9bc0f17f5..ec10085d6 100644
--- a/server/models/video/video-import.ts
+++ b/server/models/video/video-import.ts
@@ -13,7 +13,7 @@ import {
13 Table, 13 Table,
14 UpdatedAt 14 UpdatedAt
15} from 'sequelize-typescript' 15} from 'sequelize-typescript'
16import { CONSTRAINTS_FIELDS, VIDEO_IMPORT_STATES } from '../../initializers' 16import { CONSTRAINTS_FIELDS, VIDEO_IMPORT_STATES } from '../../initializers/constants'
17import { getSort, throwIfNotValid } from '../utils' 17import { getSort, throwIfNotValid } from '../utils'
18import { ScopeNames as VideoModelScopeNames, VideoModel } from './video' 18import { ScopeNames as VideoModelScopeNames, VideoModel } from './video'
19import { isVideoImportStateValid, isVideoImportTargetUrlValid } from '../../helpers/custom-validators/video-imports' 19import { isVideoImportStateValid, isVideoImportTargetUrlValid } from '../../helpers/custom-validators/video-imports'
diff --git a/server/models/video/video-playlist-element.ts b/server/models/video/video-playlist-element.ts
index a2bd225a1..3396b1136 100644
--- a/server/models/video/video-playlist-element.ts
+++ b/server/models/video/video-playlist-element.ts
@@ -18,7 +18,7 @@ import { VideoPlaylistModel } from './video-playlist'
18import * as Sequelize from 'sequelize' 18import * as Sequelize from 'sequelize'
19import { getSort, throwIfNotValid } from '../utils' 19import { getSort, throwIfNotValid } from '../utils'
20import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' 20import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
21import { CONSTRAINTS_FIELDS } from '../../initializers' 21import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
22import { PlaylistElementObject } from '../../../shared/models/activitypub/objects/playlist-element-object' 22import { PlaylistElementObject } from '../../../shared/models/activitypub/objects/playlist-element-object'
23import * as validator from 'validator' 23import * as validator from 'validator'
24 24
diff --git a/server/models/video/video-playlist.ts b/server/models/video/video-playlist.ts
index 93f36a9d0..0725b752a 100644
--- a/server/models/video/video-playlist.ts
+++ b/server/models/video/video-playlist.ts
@@ -32,7 +32,7 @@ import {
32 VIDEO_PLAYLIST_PRIVACIES, 32 VIDEO_PLAYLIST_PRIVACIES,
33 VIDEO_PLAYLIST_TYPES, 33 VIDEO_PLAYLIST_TYPES,
34 WEBSERVER 34 WEBSERVER
35} from '../../initializers' 35} from '../../initializers/constants'
36import { VideoPlaylist } from '../../../shared/models/videos/playlist/video-playlist.model' 36import { VideoPlaylist } from '../../../shared/models/videos/playlist/video-playlist.model'
37import { AccountModel, ScopeNames as AccountScopeNames } from '../account/account' 37import { AccountModel, ScopeNames as AccountScopeNames } from '../account/account'
38import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel' 38import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel'
diff --git a/server/models/video/video-share.ts b/server/models/video/video-share.ts
index 399081564..c83f6c5b0 100644
--- a/server/models/video/video-share.ts
+++ b/server/models/video/video-share.ts
@@ -2,7 +2,7 @@ import * as Sequelize from 'sequelize'
2import * as Bluebird from 'bluebird' 2import * as Bluebird from 'bluebird'
3import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' 3import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'
4import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' 4import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
5import { CONSTRAINTS_FIELDS } from '../../initializers' 5import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
6import { AccountModel } from '../account/account' 6import { AccountModel } from '../account/account'
7import { ActorModel } from '../activitypub/actor' 7import { ActorModel } from '../activitypub/actor'
8import { throwIfNotValid } from '../utils' 8import { throwIfNotValid } from '../utils'
diff --git a/server/models/video/video-streaming-playlist.ts b/server/models/video/video-streaming-playlist.ts
index 0333755c5..e50b5d106 100644
--- a/server/models/video/video-streaming-playlist.ts
+++ b/server/models/video/video-streaming-playlist.ts
@@ -6,7 +6,7 @@ import * as Sequelize from 'sequelize'
6import { VideoRedundancyModel } from '../redundancy/video-redundancy' 6import { VideoRedundancyModel } from '../redundancy/video-redundancy'
7import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type' 7import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type'
8import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' 8import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
9import { CONSTRAINTS_FIELDS, STATIC_PATHS, P2P_MEDIA_LOADER_PEER_VERSION } from '../../initializers' 9import { CONSTRAINTS_FIELDS, STATIC_PATHS, P2P_MEDIA_LOADER_PEER_VERSION } from '../../initializers/constants'
10import { VideoFileModel } from './video-file' 10import { VideoFileModel } from './video-file'
11import { join } from 'path' 11import { join } from 'path'
12import { sha1 } from '../../helpers/core-utils' 12import { sha1 } from '../../helpers/core-utils'
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 3b30e9e28..38447797e 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -65,7 +65,7 @@ import {
65 VIDEO_PRIVACIES, 65 VIDEO_PRIVACIES,
66 VIDEO_STATES, 66 VIDEO_STATES,
67 WEBSERVER 67 WEBSERVER
68} from '../../initializers' 68} from '../../initializers/constants'
69import { sendDeleteVideo } from '../../lib/activitypub/send' 69import { sendDeleteVideo } from '../../lib/activitypub/send'
70import { AccountModel } from '../account/account' 70import { AccountModel } from '../account/account'
71import { AccountVideoRateModel } from '../account/account-video-rate' 71import { AccountVideoRateModel } from '../account/account-video-rate'
diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts
index b78504073..a92326846 100644
--- a/server/tests/api/activitypub/security.ts
+++ b/server/tests/api/activitypub/security.ts
@@ -12,7 +12,7 @@ import {
12 ServerInfo, 12 ServerInfo,
13 setActorField 13 setActorField
14} from '../../../../shared/utils' 14} from '../../../../shared/utils'
15import { HTTP_SIGNATURE } from '../../../initializers' 15import { HTTP_SIGNATURE } from '../../../initializers/constants'
16import { buildDigest, buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activitypub-http-utils' 16import { buildDigest, buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activitypub-http-utils'
17import * as chai from 'chai' 17import * as chai from 'chai'
18import { activityPubContextify, buildSignedActivity } from '../../../helpers/activitypub' 18import { activityPubContextify, buildSignedActivity } from '../../../helpers/activitypub'
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts
index 6f6bc25a6..f84ba1ece 100644
--- a/server/tests/cli/optimize-old-videos.ts
+++ b/server/tests/cli/optimize-old-videos.ts
@@ -18,7 +18,7 @@ import {
18} from '../../../shared/utils' 18} from '../../../shared/utils'
19import { waitJobs } from '../../../shared/utils/server/jobs' 19import { waitJobs } from '../../../shared/utils/server/jobs'
20import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../helpers/ffmpeg-utils' 20import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../helpers/ffmpeg-utils'
21import { VIDEO_TRANSCODING_FPS } from '../../initializers' 21import { VIDEO_TRANSCODING_FPS } from '../../initializers/constants'
22import { join } from 'path' 22import { join } from 'path'
23 23
24const expect = chai.expect 24const expect = chai.expect
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts
index 04e24e818..03f13b5e2 100644
--- a/server/tools/peertube-import-videos.ts
+++ b/server/tools/peertube-import-videos.ts
@@ -5,7 +5,7 @@ import * as program from 'commander'
5import { join } from 'path' 5import { join } from 'path'
6import { VideoPrivacy } from '../../shared/models/videos' 6import { VideoPrivacy } from '../../shared/models/videos'
7import { doRequestAndSaveToFile } from '../helpers/requests' 7import { doRequestAndSaveToFile } from '../helpers/requests'
8import { CONSTRAINTS_FIELDS } from '../initializers' 8import { CONSTRAINTS_FIELDS } from '../initializers/constants'
9import { getClient, getVideoCategories, login, searchVideoWithSort, uploadVideo } from '../../shared/utils/index' 9import { getClient, getVideoCategories, login, searchVideoWithSort, uploadVideo } from '../../shared/utils/index'
10import { truncate } from 'lodash' 10import { truncate } from 'lodash'
11import * as prompt from 'prompt' 11import * as prompt from 'prompt'