diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/client.ts | 27 | ||||
-rw-r--r-- | server/controllers/activitypub/inbox.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/config.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/index.ts | 8 | ||||
-rw-r--r-- | server/controllers/api/jobs.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/oauth-clients.ts | 5 | ||||
-rw-r--r-- | server/controllers/api/server/follows.ts | 11 | ||||
-rw-r--r-- | server/controllers/api/users.ts | 24 | ||||
-rw-r--r-- | server/controllers/api/videos/abuse.ts | 14 | ||||
-rw-r--r-- | server/controllers/api/videos/blacklist.ts | 16 | ||||
-rw-r--r-- | server/controllers/api/videos/channel.ts | 16 | ||||
-rw-r--r-- | server/controllers/api/videos/comment.ts | 3 | ||||
-rw-r--r-- | server/controllers/api/videos/index.ts | 41 | ||||
-rw-r--r-- | server/controllers/api/videos/rate.ts | 3 | ||||
-rw-r--r-- | server/controllers/client.ts | 12 |
15 files changed, 73 insertions, 113 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index 8c6294ff7..71e706346 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts | |||
@@ -1,14 +1,17 @@ | |||
1 | // Intercept ActivityPub client requests | 1 | // Intercept ActivityPub client requests |
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | import { activityPubCollectionPagination, pageToStartAndCount } from '../../helpers' | 3 | import { activityPubCollectionPagination } from '../../helpers/activitypub' |
4 | import { pageToStartAndCount } from '../../helpers/core-utils' | ||
4 | import { ACTIVITY_PUB, CONFIG } from '../../initializers' | 5 | import { ACTIVITY_PUB, CONFIG } from '../../initializers' |
5 | import { buildVideoAnnounceToFollowers } from '../../lib/activitypub/send' | 6 | import { buildVideoAnnounceToFollowers } from '../../lib/activitypub/send' |
6 | import { asyncMiddleware, executeIfActivityPub, localAccountValidator } from '../../middlewares' | 7 | import { asyncMiddleware, executeIfActivityPub, localAccountValidator } from '../../middlewares' |
7 | import { videoChannelsGetValidator, videosGetValidator, videosShareValidator } from '../../middlewares/validators' | 8 | import { videoChannelsGetValidator, videosGetValidator, videosShareValidator } from '../../middlewares/validators' |
9 | import { videoCommentGetValidator } from '../../middlewares/validators/video-comments' | ||
8 | import { AccountModel } from '../../models/account/account' | 10 | import { AccountModel } from '../../models/account/account' |
9 | import { ActorFollowModel } from '../../models/activitypub/actor-follow' | 11 | import { ActorFollowModel } from '../../models/activitypub/actor-follow' |
10 | import { VideoModel } from '../../models/video/video' | 12 | import { VideoModel } from '../../models/video/video' |
11 | import { VideoChannelModel } from '../../models/video/video-channel' | 13 | import { VideoChannelModel } from '../../models/video/video-channel' |
14 | import { VideoCommentModel } from '../../models/video/video-comment' | ||
12 | import { VideoShareModel } from '../../models/video/video-share' | 15 | import { VideoShareModel } from '../../models/video/video-share' |
13 | 16 | ||
14 | const activityPubClientRouter = express.Router() | 17 | const activityPubClientRouter = express.Router() |
@@ -30,7 +33,7 @@ activityPubClientRouter.get('/account/:name/following', | |||
30 | 33 | ||
31 | activityPubClientRouter.get('/videos/watch/:id', | 34 | activityPubClientRouter.get('/videos/watch/:id', |
32 | executeIfActivityPub(asyncMiddleware(videosGetValidator)), | 35 | executeIfActivityPub(asyncMiddleware(videosGetValidator)), |
33 | executeIfActivityPub(videoController) | 36 | executeIfActivityPub(asyncMiddleware(videoController)) |
34 | ) | 37 | ) |
35 | 38 | ||
36 | activityPubClientRouter.get('/videos/watch/:id/announces/:accountId', | 39 | activityPubClientRouter.get('/videos/watch/:id/announces/:accountId', |
@@ -38,6 +41,11 @@ activityPubClientRouter.get('/videos/watch/:id/announces/:accountId', | |||
38 | executeIfActivityPub(asyncMiddleware(videoAnnounceController)) | 41 | executeIfActivityPub(asyncMiddleware(videoAnnounceController)) |
39 | ) | 42 | ) |
40 | 43 | ||
44 | activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId', | ||
45 | executeIfActivityPub(asyncMiddleware(videoCommentGetValidator)), | ||
46 | executeIfActivityPub(asyncMiddleware(videoCommentController)) | ||
47 | ) | ||
48 | |||
41 | activityPubClientRouter.get('/video-channels/:id', | 49 | activityPubClientRouter.get('/video-channels/:id', |
42 | executeIfActivityPub(asyncMiddleware(videoChannelsGetValidator)), | 50 | executeIfActivityPub(asyncMiddleware(videoChannelsGetValidator)), |
43 | executeIfActivityPub(asyncMiddleware(videoChannelController)) | 51 | executeIfActivityPub(asyncMiddleware(videoChannelController)) |
@@ -54,7 +62,8 @@ export { | |||
54 | function accountController (req: express.Request, res: express.Response, next: express.NextFunction) { | 62 | function accountController (req: express.Request, res: express.Response, next: express.NextFunction) { |
55 | const account: AccountModel = res.locals.account | 63 | const account: AccountModel = res.locals.account |
56 | 64 | ||
57 | return res.json(account.toActivityPubObject()).end() | 65 | return res.json(account.toActivityPubObject()) |
66 | .end() | ||
58 | } | 67 | } |
59 | 68 | ||
60 | async function accountFollowersController (req: express.Request, res: express.Response, next: express.NextFunction) { | 69 | async function accountFollowersController (req: express.Request, res: express.Response, next: express.NextFunction) { |
@@ -81,10 +90,12 @@ async function accountFollowingController (req: express.Request, res: express.Re | |||
81 | return res.json(activityPubResult) | 90 | return res.json(activityPubResult) |
82 | } | 91 | } |
83 | 92 | ||
84 | function videoController (req: express.Request, res: express.Response, next: express.NextFunction) { | 93 | async function videoController (req: express.Request, res: express.Response, next: express.NextFunction) { |
85 | const video: VideoModel = res.locals.video | 94 | const video: VideoModel = res.locals.video |
86 | 95 | ||
87 | return res.json(video.toActivityPubObject()) | 96 | // We need more attributes |
97 | const videoAll = await VideoModel.loadAndPopulateAll(video.id) | ||
98 | return res.json(videoAll.toActivityPubObject()) | ||
88 | } | 99 | } |
89 | 100 | ||
90 | async function videoAnnounceController (req: express.Request, res: express.Response, next: express.NextFunction) { | 101 | async function videoAnnounceController (req: express.Request, res: express.Response, next: express.NextFunction) { |
@@ -99,3 +110,9 @@ async function videoChannelController (req: express.Request, res: express.Respon | |||
99 | 110 | ||
100 | return res.json(videoChannel.toActivityPubObject()) | 111 | return res.json(videoChannel.toActivityPubObject()) |
101 | } | 112 | } |
113 | |||
114 | async function videoCommentController (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
115 | const videoComment: VideoCommentModel = res.locals.videoComment | ||
116 | |||
117 | return res.json(videoComment.toActivityPubObject()) | ||
118 | } | ||
diff --git a/server/controllers/activitypub/inbox.ts b/server/controllers/activitypub/inbox.ts index 8332eabb1..bfcb7b369 100644 --- a/server/controllers/activitypub/inbox.ts +++ b/server/controllers/activitypub/inbox.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { Activity, ActivityPubCollection, ActivityPubOrderedCollection, RootActivity } from '../../../shared' | 2 | import { Activity, ActivityPubCollection, ActivityPubOrderedCollection, RootActivity } from '../../../shared' |
3 | import { logger } from '../../helpers' | ||
4 | import { isActivityValid } from '../../helpers/custom-validators/activitypub/activity' | 3 | import { isActivityValid } from '../../helpers/custom-validators/activitypub/activity' |
4 | import { logger } from '../../helpers/logger' | ||
5 | import { processActivities } from '../../lib/activitypub/process/process' | 5 | import { processActivities } from '../../lib/activitypub/process/process' |
6 | import { asyncMiddleware, checkSignature, localAccountValidator, signatureValidator } from '../../middlewares' | 6 | import { asyncMiddleware, checkSignature, localAccountValidator, signatureValidator } from '../../middlewares' |
7 | import { activityPubValidator } from '../../middlewares/validators/activitypub/activity' | 7 | import { activityPubValidator } from '../../middlewares/validators/activitypub/activity' |
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 5f704f0ee..2f1132904 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { isSignupAllowed } from '../../helpers/utils' | ||
2 | 3 | ||
3 | import { isSignupAllowed } from '../../helpers' | ||
4 | import { CONFIG } from '../../initializers' | 4 | import { CONFIG } from '../../initializers' |
5 | import { asyncMiddleware } from '../../middlewares' | 5 | import { asyncMiddleware } from '../../middlewares' |
6 | import { ServerConfig } from '../../../shared' | 6 | import { ServerConfig } from '../../../shared' |
diff --git a/server/controllers/api/index.ts b/server/controllers/api/index.ts index 737ea4602..1fd44ac11 100644 --- a/server/controllers/api/index.ts +++ b/server/controllers/api/index.ts | |||
@@ -1,13 +1,11 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | 2 | import { badRequest } from '../../helpers/utils' | |
3 | import { badRequest } from '../../helpers' | ||
4 | |||
5 | import { oauthClientsRouter } from './oauth-clients' | ||
6 | import { configRouter } from './config' | 3 | import { configRouter } from './config' |
4 | import { jobsRouter } from './jobs' | ||
5 | import { oauthClientsRouter } from './oauth-clients' | ||
7 | import { serverRouter } from './server' | 6 | import { serverRouter } from './server' |
8 | import { usersRouter } from './users' | 7 | import { usersRouter } from './users' |
9 | import { videosRouter } from './videos' | 8 | import { videosRouter } from './videos' |
10 | import { jobsRouter } from './jobs' | ||
11 | 9 | ||
12 | const apiRouter = express.Router() | 10 | const apiRouter = express.Router() |
13 | 11 | ||
diff --git a/server/controllers/api/jobs.ts b/server/controllers/api/jobs.ts index 4e7cd1ee3..d9d6030a4 100644 --- a/server/controllers/api/jobs.ts +++ b/server/controllers/api/jobs.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { UserRight } from '../../../shared/models/users' | 2 | import { UserRight } from '../../../shared/models/users' |
3 | import { getFormattedObjects } from '../../helpers' | 3 | import { getFormattedObjects } from '../../helpers/utils' |
4 | import { asyncMiddleware, authenticate, ensureUserHasRight, jobsSortValidator, setJobsSort, setPagination } from '../../middlewares' | 4 | import { asyncMiddleware, authenticate, ensureUserHasRight, jobsSortValidator, setJobsSort, setPagination } from '../../middlewares' |
5 | import { paginationValidator } from '../../middlewares/validators' | 5 | import { paginationValidator } from '../../middlewares/validators' |
6 | import { JobModel } from '../../models/job/job' | 6 | import { JobModel } from '../../models/job/job' |
diff --git a/server/controllers/api/oauth-clients.ts b/server/controllers/api/oauth-clients.ts index bc02fce90..3dcc023e6 100644 --- a/server/controllers/api/oauth-clients.ts +++ b/server/controllers/api/oauth-clients.ts | |||
@@ -1,9 +1,8 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | 2 | import { OAuthClientLocal } from '../../../shared' | |
3 | import { logger } from '../../helpers/logger' | ||
3 | import { CONFIG } from '../../initializers' | 4 | import { CONFIG } from '../../initializers' |
4 | import { logger } from '../../helpers' | ||
5 | import { asyncMiddleware } from '../../middlewares' | 5 | import { asyncMiddleware } from '../../middlewares' |
6 | import { OAuthClientLocal } from '../../../shared' | ||
7 | import { OAuthClientModel } from '../../models/oauth/oauth-client' | 6 | import { OAuthClientModel } from '../../models/oauth/oauth-client' |
8 | 7 | ||
9 | const oauthClientsRouter = express.Router() | 8 | const oauthClientsRouter = express.Router() |
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts index ae5413b75..c87107197 100644 --- a/server/controllers/api/server/follows.ts +++ b/server/controllers/api/server/follows.ts | |||
@@ -1,11 +1,12 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { UserRight } from '../../../../shared/models/users' | 2 | import { UserRight } from '../../../../shared/models/users' |
3 | import { | 3 | import { sanitizeHost } from '../../../helpers/core-utils' |
4 | getFormattedObjects, getServerActor, loadActorUrlOrGetFromWebfinger, logger, retryTransactionWrapper, | 4 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
5 | sanitizeHost | 5 | import { logger } from '../../../helpers/logger' |
6 | } from '../../../helpers' | 6 | import { getFormattedObjects, getServerActor } from '../../../helpers/utils' |
7 | import { loadActorUrlOrGetFromWebfinger } from '../../../helpers/webfinger' | ||
7 | import { REMOTE_SCHEME, sequelizeTypescript, SERVER_ACTOR_NAME } from '../../../initializers' | 8 | import { REMOTE_SCHEME, sequelizeTypescript, SERVER_ACTOR_NAME } from '../../../initializers' |
8 | import { getOrCreateActorAndServerAndModel } from '../../../lib/activitypub' | 9 | import { getOrCreateActorAndServerAndModel } from '../../../lib/activitypub/actor' |
9 | import { sendFollow, sendUndoFollow } from '../../../lib/activitypub/send' | 10 | import { sendFollow, sendUndoFollow } from '../../../lib/activitypub/send' |
10 | import { | 11 | import { |
11 | asyncMiddleware, authenticate, ensureUserHasRight, paginationValidator, removeFollowingValidator, setBodyHostsPort, | 12 | asyncMiddleware, authenticate, ensureUserHasRight, paginationValidator, removeFollowingValidator, setBodyHostsPort, |
diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts index 3106df9b9..75393ad17 100644 --- a/server/controllers/api/users.ts +++ b/server/controllers/api/users.ts | |||
@@ -1,26 +1,14 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { UserCreate, UserRight, UserRole, UserUpdate, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../shared' | 2 | import { UserCreate, UserRight, UserRole, UserUpdate, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../shared' |
3 | import { getFormattedObjects, logger, retryTransactionWrapper } from '../../helpers' | 3 | import { retryTransactionWrapper } from '../../helpers/database-utils' |
4 | import { logger } from '../../helpers/logger' | ||
5 | import { getFormattedObjects } from '../../helpers/utils' | ||
4 | import { CONFIG } from '../../initializers' | 6 | import { CONFIG } from '../../initializers' |
5 | import { createUserAccountAndChannel } from '../../lib/user' | 7 | import { createUserAccountAndChannel } from '../../lib/user' |
6 | import { | 8 | import { |
7 | asyncMiddleware, | 9 | asyncMiddleware, authenticate, ensureUserHasRight, ensureUserRegistrationAllowed, paginationValidator, setPagination, setUsersSort, |
8 | authenticate, | 10 | setVideosSort, token, usersAddValidator, usersGetValidator, usersRegisterValidator, usersRemoveValidator, usersSortValidator, |
9 | ensureUserHasRight, | 11 | usersUpdateMeValidator, usersUpdateValidator, usersVideoRatingValidator |
10 | ensureUserRegistrationAllowed, | ||
11 | paginationValidator, | ||
12 | setPagination, | ||
13 | setUsersSort, | ||
14 | setVideosSort, | ||
15 | token, | ||
16 | usersAddValidator, | ||
17 | usersGetValidator, | ||
18 | usersRegisterValidator, | ||
19 | usersRemoveValidator, | ||
20 | usersSortValidator, | ||
21 | usersUpdateMeValidator, | ||
22 | usersUpdateValidator, | ||
23 | usersVideoRatingValidator | ||
24 | } from '../../middlewares' | 12 | } from '../../middlewares' |
25 | import { videosSortValidator } from '../../middlewares/validators' | 13 | import { videosSortValidator } from '../../middlewares/validators' |
26 | import { AccountVideoRateModel } from '../../models/account/account-video-rate' | 14 | import { AccountVideoRateModel } from '../../models/account/account-video-rate' |
diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts index fecdaf5a3..e78f0f6fc 100644 --- a/server/controllers/api/videos/abuse.ts +++ b/server/controllers/api/videos/abuse.ts | |||
@@ -1,17 +1,13 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { UserRight, VideoAbuseCreate } from '../../../../shared' | 2 | import { UserRight, VideoAbuseCreate } from '../../../../shared' |
3 | import { getFormattedObjects, logger, retryTransactionWrapper } from '../../../helpers' | 3 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
4 | import { logger } from '../../../helpers/logger' | ||
5 | import { getFormattedObjects } from '../../../helpers/utils' | ||
4 | import { sequelizeTypescript } from '../../../initializers' | 6 | import { sequelizeTypescript } from '../../../initializers' |
5 | import { sendVideoAbuse } from '../../../lib/activitypub/send' | 7 | import { sendVideoAbuse } from '../../../lib/activitypub/send' |
6 | import { | 8 | import { |
7 | asyncMiddleware, | 9 | asyncMiddleware, authenticate, ensureUserHasRight, paginationValidator, setPagination, setVideoAbusesSort, |
8 | authenticate, | 10 | videoAbuseReportValidator, videoAbusesSortValidator |
9 | ensureUserHasRight, | ||
10 | paginationValidator, | ||
11 | setPagination, | ||
12 | setVideoAbusesSort, | ||
13 | videoAbuseReportValidator, | ||
14 | videoAbusesSortValidator | ||
15 | } from '../../../middlewares' | 11 | } from '../../../middlewares' |
16 | import { AccountModel } from '../../../models/account/account' | 12 | import { AccountModel } from '../../../models/account/account' |
17 | import { VideoModel } from '../../../models/video/video' | 13 | import { VideoModel } from '../../../models/video/video' |
diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts index d08c6e13f..c9087fd97 100644 --- a/server/controllers/api/videos/blacklist.ts +++ b/server/controllers/api/videos/blacklist.ts | |||
@@ -1,17 +1,11 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { logger, getFormattedObjects } from '../../../helpers' | 2 | import { BlacklistedVideo, UserRight } from '../../../../shared' |
3 | import { logger } from '../../../helpers/logger' | ||
4 | import { getFormattedObjects } from '../../../helpers/utils' | ||
3 | import { | 5 | import { |
4 | authenticate, | 6 | asyncMiddleware, authenticate, blacklistSortValidator, ensureUserHasRight, paginationValidator, setBlacklistSort, setPagination, |
5 | ensureUserHasRight, | 7 | videosBlacklistAddValidator, videosBlacklistRemoveValidator |
6 | videosBlacklistAddValidator, | ||
7 | videosBlacklistRemoveValidator, | ||
8 | paginationValidator, | ||
9 | blacklistSortValidator, | ||
10 | setBlacklistSort, | ||
11 | setPagination, | ||
12 | asyncMiddleware | ||
13 | } from '../../../middlewares' | 8 | } from '../../../middlewares' |
14 | import { BlacklistedVideo, UserRight } from '../../../../shared' | ||
15 | import { VideoBlacklistModel } from '../../../models/video/video-blacklist' | 9 | import { VideoBlacklistModel } from '../../../models/video/video-blacklist' |
16 | 10 | ||
17 | const blacklistRouter = express.Router() | 11 | const blacklistRouter = express.Router() |
diff --git a/server/controllers/api/videos/channel.ts b/server/controllers/api/videos/channel.ts index cc00d9f8d..7c62b5476 100644 --- a/server/controllers/api/videos/channel.ts +++ b/server/controllers/api/videos/channel.ts | |||
@@ -1,20 +1,14 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared' | 2 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared' |
3 | import { getFormattedObjects, logger, resetSequelizeInstance, retryTransactionWrapper } from '../../../helpers' | 3 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
4 | import { logger } from '../../../helpers/logger' | ||
5 | import { getFormattedObjects, resetSequelizeInstance } from '../../../helpers/utils' | ||
4 | import { sequelizeTypescript } from '../../../initializers' | 6 | import { sequelizeTypescript } from '../../../initializers' |
5 | import { setAsyncActorKeys } from '../../../lib/activitypub' | 7 | import { setAsyncActorKeys } from '../../../lib/activitypub' |
6 | import { createVideoChannel } from '../../../lib/video-channel' | 8 | import { createVideoChannel } from '../../../lib/video-channel' |
7 | import { | 9 | import { |
8 | asyncMiddleware, | 10 | asyncMiddleware, authenticate, listVideoAccountChannelsValidator, paginationValidator, setPagination, setVideoChannelsSort, |
9 | authenticate, | 11 | videoChannelsAddValidator, videoChannelsGetValidator, videoChannelsRemoveValidator, videoChannelsSortValidator, |
10 | listVideoAccountChannelsValidator, | ||
11 | paginationValidator, | ||
12 | setPagination, | ||
13 | setVideoChannelsSort, | ||
14 | videoChannelsAddValidator, | ||
15 | videoChannelsGetValidator, | ||
16 | videoChannelsRemoveValidator, | ||
17 | videoChannelsSortValidator, | ||
18 | videoChannelsUpdateValidator | 12 | videoChannelsUpdateValidator |
19 | } from '../../../middlewares' | 13 | } from '../../../middlewares' |
20 | import { AccountModel } from '../../../models/account/account' | 14 | import { AccountModel } from '../../../models/account/account' |
diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts index 276948098..b11da2ef7 100644 --- a/server/controllers/api/videos/comment.ts +++ b/server/controllers/api/videos/comment.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { VideoCommentCreate } from '../../../../shared/models/videos/video-comment.model' | 2 | import { VideoCommentCreate } from '../../../../shared/models/videos/video-comment.model' |
3 | import { getFormattedObjects, retryTransactionWrapper } from '../../../helpers' | 3 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
4 | import { getFormattedObjects } from '../../../helpers/utils' | ||
4 | import { sequelizeTypescript } from '../../../initializers' | 5 | import { sequelizeTypescript } from '../../../initializers' |
5 | import { buildFormattedCommentTree, createVideoComment } from '../../../lib/video-comment' | 6 | import { buildFormattedCommentTree, createVideoComment } from '../../../lib/video-comment' |
6 | import { asyncMiddleware, authenticate, paginationValidator, setPagination, setVideoCommentThreadsSort } from '../../../middlewares' | 7 | import { asyncMiddleware, authenticate, paginationValidator, setPagination, setVideoCommentThreadsSort } from '../../../middlewares' |
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 8e54d95ab..11e3da5cc 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -2,44 +2,21 @@ import * as express from 'express' | |||
2 | import * as multer from 'multer' | 2 | import * as multer from 'multer' |
3 | import { extname, join } from 'path' | 3 | import { extname, join } from 'path' |
4 | import { VideoCreate, VideoPrivacy, VideoUpdate } from '../../../../shared' | 4 | import { VideoCreate, VideoPrivacy, VideoUpdate } from '../../../../shared' |
5 | import { renamePromise } from '../../../helpers/core-utils' | ||
6 | import { retryTransactionWrapper } from '../../../helpers/database-utils' | ||
7 | import { getVideoFileHeight } from '../../../helpers/ffmpeg-utils' | ||
8 | import { logger } from '../../../helpers/logger' | ||
9 | import { generateRandomString, getFormattedObjects, getServerActor, resetSequelizeInstance } from '../../../helpers/utils' | ||
5 | import { | 10 | import { |
6 | generateRandomString, | 11 | CONFIG, sequelizeTypescript, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_MIMETYPE_EXT, |
7 | getFormattedObjects, | ||
8 | getVideoFileHeight, | ||
9 | logger, | ||
10 | renamePromise, | ||
11 | resetSequelizeInstance, | ||
12 | retryTransactionWrapper | ||
13 | } from '../../../helpers' | ||
14 | import { getServerActor } from '../../../helpers/utils' | ||
15 | import { | ||
16 | CONFIG, | ||
17 | sequelizeTypescript, | ||
18 | VIDEO_CATEGORIES, | ||
19 | VIDEO_LANGUAGES, | ||
20 | VIDEO_LICENCES, | ||
21 | VIDEO_MIMETYPE_EXT, | ||
22 | VIDEO_PRIVACIES | 12 | VIDEO_PRIVACIES |
23 | } from '../../../initializers' | 13 | } from '../../../initializers' |
24 | import { | 14 | import { fetchRemoteVideoDescription, getVideoActivityPubUrl, shareVideoByServerAndChannel } from '../../../lib/activitypub' |
25 | fetchRemoteVideoDescription, | ||
26 | getVideoActivityPubUrl, | ||
27 | shareVideoByServerAndChannel | ||
28 | } from '../../../lib/activitypub' | ||
29 | import { sendCreateVideo, sendCreateViewToOrigin, sendCreateViewToVideoFollowers, sendUpdateVideo } from '../../../lib/activitypub/send' | 15 | import { sendCreateVideo, sendCreateViewToOrigin, sendCreateViewToVideoFollowers, sendUpdateVideo } from '../../../lib/activitypub/send' |
30 | import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler' | 16 | import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler' |
31 | import { | 17 | import { |
32 | asyncMiddleware, | 18 | asyncMiddleware, authenticate, paginationValidator, setPagination, setVideosSort, videosAddValidator, videosGetValidator, |
33 | authenticate, | 19 | videosRemoveValidator, videosSearchValidator, videosSortValidator, videosUpdateValidator |
34 | paginationValidator, | ||
35 | setPagination, | ||
36 | setVideosSort, | ||
37 | videosAddValidator, | ||
38 | videosGetValidator, | ||
39 | videosRemoveValidator, | ||
40 | videosSearchValidator, | ||
41 | videosSortValidator, | ||
42 | videosUpdateValidator | ||
43 | } from '../../../middlewares' | 20 | } from '../../../middlewares' |
44 | import { TagModel } from '../../../models/video/tag' | 21 | import { TagModel } from '../../../models/video/tag' |
45 | import { VideoModel } from '../../../models/video/video' | 22 | import { VideoModel } from '../../../models/video/video' |
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts index 48b744b0c..b470f27f6 100644 --- a/server/controllers/api/videos/rate.ts +++ b/server/controllers/api/videos/rate.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { UserVideoRateUpdate } from '../../../../shared' | 2 | import { UserVideoRateUpdate } from '../../../../shared' |
3 | import { logger, retryTransactionWrapper } from '../../../helpers' | 3 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
4 | import { logger } from '../../../helpers/logger' | ||
4 | import { sequelizeTypescript, VIDEO_RATE_TYPES } from '../../../initializers' | 5 | import { sequelizeTypescript, VIDEO_RATE_TYPES } from '../../../initializers' |
5 | import { sendVideoRateChangeToFollowers, sendVideoRateChangeToOrigin } from '../../../lib/activitypub' | 6 | import { sendVideoRateChangeToFollowers, sendVideoRateChangeToOrigin } from '../../../lib/activitypub' |
6 | import { asyncMiddleware, authenticate, videoRateValidator } from '../../../middlewares' | 7 | import { asyncMiddleware, authenticate, videoRateValidator } from '../../../middlewares' |
diff --git a/server/controllers/client.ts b/server/controllers/client.ts index 9a72fe8e0..39e046727 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts | |||
@@ -1,15 +1,9 @@ | |||
1 | import * as Bluebird from 'bluebird' | ||
1 | import * as express from 'express' | 2 | import * as express from 'express' |
2 | import { join } from 'path' | 3 | import { join } from 'path' |
3 | import * as validator from 'validator' | 4 | import * as validator from 'validator' |
4 | import * as Bluebird from 'bluebird' | 5 | import { escapeHTML, readFileBufferPromise, root } from '../helpers/core-utils' |
5 | import { | 6 | import { CONFIG, EMBED_SIZE, OPENGRAPH_AND_OEMBED_COMMENT, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers' |
6 | CONFIG, | ||
7 | STATIC_PATHS, | ||
8 | STATIC_MAX_AGE, | ||
9 | OPENGRAPH_AND_OEMBED_COMMENT, | ||
10 | EMBED_SIZE | ||
11 | } from '../initializers' | ||
12 | import { root, readFileBufferPromise, escapeHTML } from '../helpers' | ||
13 | import { asyncMiddleware } from '../middlewares' | 7 | import { asyncMiddleware } from '../middlewares' |
14 | import { VideoModel } from '../models/video/video' | 8 | import { VideoModel } from '../models/video/video' |
15 | 9 | ||