aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/abuse.ts3
-rw-r--r--server/controllers/api/config.ts4
-rw-r--r--server/controllers/api/jobs.ts4
-rw-r--r--server/controllers/api/oauth-clients.ts5
-rw-r--r--server/controllers/api/users/index.ts7
-rw-r--r--server/controllers/api/users/me.ts4
-rw-r--r--server/controllers/api/video-channel.ts3
-rw-r--r--server/controllers/api/videos/blacklist.ts3
-rw-r--r--server/controllers/api/videos/import.ts7
-rw-r--r--server/controllers/api/videos/live.ts3
-rw-r--r--server/controllers/api/videos/rate.ts3
-rw-r--r--server/controllers/api/videos/update.ts3
-rw-r--r--server/controllers/api/videos/upload.ts3
-rw-r--r--server/controllers/api/videos/watching.ts3
14 files changed, 18 insertions, 37 deletions
diff --git a/server/controllers/api/abuse.ts b/server/controllers/api/abuse.ts
index a6d0b0512..d6211cc83 100644
--- a/server/controllers/api/abuse.ts
+++ b/server/controllers/api/abuse.ts
@@ -6,8 +6,7 @@ import { AbuseModel } from '@server/models/abuse/abuse'
6import { AbuseMessageModel } from '@server/models/abuse/abuse-message' 6import { AbuseMessageModel } from '@server/models/abuse/abuse-message'
7import { getServerActor } from '@server/models/application/application' 7import { getServerActor } from '@server/models/application/application'
8import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' 8import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
9import { HttpStatusCode } from '@shared/models' 9import { AbuseCreate, AbuseState, HttpStatusCode, UserRight } from '@shared/models'
10import { AbuseCreate, AbuseState, UserRight } from '../../../shared'
11import { getFormattedObjects } from '../../helpers/utils' 10import { getFormattedObjects } from '../../helpers/utils'
12import { sequelizeTypescript } from '../../initializers/database' 11import { sequelizeTypescript } from '../../initializers/database'
13import { 12import {
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index b253db397..4e3dd4d80 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -3,9 +3,7 @@ import { remove, writeJSON } from 'fs-extra'
3import { snakeCase } from 'lodash' 3import { snakeCase } from 'lodash'
4import validator from 'validator' 4import validator from 'validator'
5import { ServerConfigManager } from '@server/lib/server-config-manager' 5import { ServerConfigManager } from '@server/lib/server-config-manager'
6import { UserRight } from '../../../shared' 6import { About, CustomConfig, UserRight } from '@shared/models'
7import { About } from '../../../shared/models/server/about.model'
8import { CustomConfig } from '../../../shared/models/server/custom-config.model'
9import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger' 7import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger'
10import { objectConverter } from '../../helpers/core-utils' 8import { objectConverter } from '../../helpers/core-utils'
11import { CONFIG, reloadConfig } from '../../initializers/config' 9import { CONFIG, reloadConfig } from '../../initializers/config'
diff --git a/server/controllers/api/jobs.ts b/server/controllers/api/jobs.ts
index 7001674bb..eebd195b0 100644
--- a/server/controllers/api/jobs.ts
+++ b/server/controllers/api/jobs.ts
@@ -1,7 +1,5 @@
1import express from 'express' 1import express from 'express'
2import { ResultList } from '../../../shared' 2import { Job, JobState, JobType, ResultList, UserRight } from '@shared/models'
3import { Job, JobState, JobType } from '../../../shared/models'
4import { UserRight } from '../../../shared/models/users'
5import { isArray } from '../../helpers/custom-validators/misc' 3import { isArray } from '../../helpers/custom-validators/misc'
6import { JobQueue } from '../../lib/job-queue' 4import { JobQueue } from '../../lib/job-queue'
7import { 5import {
diff --git a/server/controllers/api/oauth-clients.ts b/server/controllers/api/oauth-clients.ts
index 4990fb0df..2d847bdc1 100644
--- a/server/controllers/api/oauth-clients.ts
+++ b/server/controllers/api/oauth-clients.ts
@@ -1,10 +1,9 @@
1import express from 'express' 1import express from 'express'
2import { OAuthClientLocal } from '../../../shared' 2import { OAuthClientModel } from '@server/models/oauth/oauth-client'
3import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' 3import { HttpStatusCode, OAuthClientLocal } from '@shared/models'
4import { logger } from '../../helpers/logger' 4import { logger } from '../../helpers/logger'
5import { CONFIG } from '../../initializers/config' 5import { CONFIG } from '../../initializers/config'
6import { asyncMiddleware, openapiOperationDoc } from '../../middlewares' 6import { asyncMiddleware, openapiOperationDoc } from '../../middlewares'
7import { OAuthClientModel } from '../../models/oauth/oauth-client'
8 7
9const oauthClientsRouter = express.Router() 8const oauthClientsRouter = express.Router()
10 9
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts
index fcee58f6b..7efc3a137 100644
--- a/server/controllers/api/users/index.ts
+++ b/server/controllers/api/users/index.ts
@@ -4,10 +4,7 @@ import { tokensRouter } from '@server/controllers/api/users/token'
4import { Hooks } from '@server/lib/plugins/hooks' 4import { Hooks } from '@server/lib/plugins/hooks'
5import { OAuthTokenModel } from '@server/models/oauth/oauth-token' 5import { OAuthTokenModel } from '@server/models/oauth/oauth-token'
6import { MUser, MUserAccountDefault } from '@server/types/models' 6import { MUser, MUserAccountDefault } from '@server/types/models'
7import { UserCreate, UserCreateResult, UserRight, UserRole, UserUpdate } from '../../../../shared' 7import { HttpStatusCode, UserAdminFlag, UserCreate, UserCreateResult, UserRegister, UserRight, UserRole, UserUpdate } from '@shared/models'
8import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
9import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
10import { UserRegister } from '../../../../shared/models/users/user-register.model'
11import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger' 8import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger'
12import { logger } from '../../../helpers/logger' 9import { logger } from '../../../helpers/logger'
13import { generateRandomString, getFormattedObjects } from '../../../helpers/utils' 10import { generateRandomString, getFormattedObjects } from '../../../helpers/utils'
@@ -210,7 +207,7 @@ async function createUser (req: express.Request, res: express.Response) {
210 logger.info('Sending to user %s a create password email', body.username) 207 logger.info('Sending to user %s a create password email', body.username)
211 const verificationString = await Redis.Instance.setCreatePasswordVerificationString(user.id) 208 const verificationString = await Redis.Instance.setCreatePasswordVerificationString(user.id)
212 const url = WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString 209 const url = WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString
213 await Emailer.Instance.addPasswordCreateEmailJob(userToCreate.username, user.email, url) 210 Emailer.Instance.addPasswordCreateEmailJob(userToCreate.username, user.email, url)
214 } 211 }
215 212
216 Hooks.runAction('action:api.user.created', { body, user, account, videoChannel, req, res }) 213 Hooks.runAction('action:api.user.created', { body, user, account, videoChannel, req, res })
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index 127b7ca5d..878dd5a84 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -2,10 +2,8 @@ import 'multer'
2import express from 'express' 2import express from 'express'
3import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger' 3import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger'
4import { Hooks } from '@server/lib/plugins/hooks' 4import { Hooks } from '@server/lib/plugins/hooks'
5import { ActorImageType, HttpStatusCode, UserUpdateMe, UserVideoQuota, UserVideoRate as FormattedUserVideoRate } from '@shared/models'
5import { AttributesOnly } from '@shared/typescript-utils' 6import { AttributesOnly } from '@shared/typescript-utils'
6import { ActorImageType, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared'
7import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
8import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model'
9import { createReqFiles } from '../../../helpers/express-utils' 7import { createReqFiles } from '../../../helpers/express-utils'
10import { getFormattedObjects } from '../../../helpers/utils' 8import { getFormattedObjects } from '../../../helpers/utils'
11import { CONFIG } from '../../../initializers/config' 9import { CONFIG } from '../../../initializers/config'
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts
index abb777e08..e65550a22 100644
--- a/server/controllers/api/video-channel.ts
+++ b/server/controllers/api/video-channel.ts
@@ -5,8 +5,7 @@ import { ActorFollowModel } from '@server/models/actor/actor-follow'
5import { getServerActor } from '@server/models/application/application' 5import { getServerActor } from '@server/models/application/application'
6import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils' 6import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils'
7import { MChannelBannerAccountDefault } from '@server/types/models' 7import { MChannelBannerAccountDefault } from '@server/types/models'
8import { ActorImageType, VideoChannelCreate, VideoChannelUpdate } from '../../../shared' 8import { ActorImageType, HttpStatusCode, VideoChannelCreate, VideoChannelUpdate } from '@shared/models'
9import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
10import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger' 9import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger'
11import { resetSequelizeInstance } from '../../helpers/database-utils' 10import { resetSequelizeInstance } from '../../helpers/database-utils'
12import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' 11import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts
index de65c74f1..4103bb063 100644
--- a/server/controllers/api/videos/blacklist.ts
+++ b/server/controllers/api/videos/blacklist.ts
@@ -1,7 +1,6 @@
1import express from 'express' 1import express from 'express'
2import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist' 2import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist'
3import { UserRight, VideoBlacklistCreate } from '../../../../shared' 3import { HttpStatusCode, UserRight, VideoBlacklistCreate } from '@shared/models'
4import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
5import { logger } from '../../../helpers/logger' 4import { logger } from '../../../helpers/logger'
6import { getFormattedObjects } from '../../../helpers/utils' 5import { getFormattedObjects } from '../../../helpers/utils'
7import { sequelizeTypescript } from '../../../initializers/database' 6import { sequelizeTypescript } from '../../../initializers/database'
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts
index 3c445efce..08d69827b 100644
--- a/server/controllers/api/videos/import.ts
+++ b/server/controllers/api/videos/import.ts
@@ -4,6 +4,7 @@ import { decode } from 'magnet-uri'
4import parseTorrent, { Instance } from 'parse-torrent' 4import parseTorrent, { Instance } from 'parse-torrent'
5import { join } from 'path' 5import { join } from 'path'
6import { isVideoFileExtnameValid } from '@server/helpers/custom-validators/videos' 6import { isVideoFileExtnameValid } from '@server/helpers/custom-validators/videos'
7import { Hooks } from '@server/lib/plugins/hooks'
7import { ServerConfigManager } from '@server/lib/server-config-manager' 8import { ServerConfigManager } from '@server/lib/server-config-manager'
8import { setVideoTags } from '@server/lib/video' 9import { setVideoTags } from '@server/lib/video'
9import { FilteredModelAttributes } from '@server/types' 10import { FilteredModelAttributes } from '@server/types'
@@ -18,15 +19,14 @@ import {
18 MVideoWithBlacklistLight 19 MVideoWithBlacklistLight
19} from '@server/types/models' 20} from '@server/types/models'
20import { MVideoImportFormattable } from '@server/types/models/video/video-import' 21import { MVideoImportFormattable } from '@server/types/models/video/video-import'
21import { ServerErrorCode, VideoImportCreate, VideoImportState, VideoPrivacy, VideoState } from '../../../../shared' 22import { ServerErrorCode, ThumbnailType, VideoImportCreate, VideoImportState, VideoPrivacy, VideoState } from '@shared/models'
22import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type'
23import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger' 23import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger'
24import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils' 24import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils'
25import { isArray } from '../../../helpers/custom-validators/misc' 25import { isArray } from '../../../helpers/custom-validators/misc'
26import { cleanUpReqFiles, createReqFiles } from '../../../helpers/express-utils' 26import { cleanUpReqFiles, createReqFiles } from '../../../helpers/express-utils'
27import { logger } from '../../../helpers/logger' 27import { logger } from '../../../helpers/logger'
28import { getSecureTorrentName } from '../../../helpers/utils' 28import { getSecureTorrentName } from '../../../helpers/utils'
29import { YoutubeDLWrapper, YoutubeDLInfo } from '../../../helpers/youtube-dl' 29import { YoutubeDLInfo, YoutubeDLWrapper } from '../../../helpers/youtube-dl'
30import { CONFIG } from '../../../initializers/config' 30import { CONFIG } from '../../../initializers/config'
31import { MIMETYPES } from '../../../initializers/constants' 31import { MIMETYPES } from '../../../initializers/constants'
32import { sequelizeTypescript } from '../../../initializers/database' 32import { sequelizeTypescript } from '../../../initializers/database'
@@ -38,7 +38,6 @@ import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoIm
38import { VideoModel } from '../../../models/video/video' 38import { VideoModel } from '../../../models/video/video'
39import { VideoCaptionModel } from '../../../models/video/video-caption' 39import { VideoCaptionModel } from '../../../models/video/video-caption'
40import { VideoImportModel } from '../../../models/video/video-import' 40import { VideoImportModel } from '../../../models/video/video-import'
41import { Hooks } from '@server/lib/plugins/hooks'
42 41
43const auditLogger = auditLoggerFactory('video-imports') 42const auditLogger = auditLoggerFactory('video-imports')
44const videoImportsRouter = express.Router() 43const videoImportsRouter = express.Router()
diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts
index 4ee39aa4f..80ecbfef1 100644
--- a/server/controllers/api/videos/live.ts
+++ b/server/controllers/api/videos/live.ts
@@ -10,8 +10,7 @@ import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator
10import { VideoLiveModel } from '@server/models/video/video-live' 10import { VideoLiveModel } from '@server/models/video/video-live'
11import { MVideoDetails, MVideoFullLight } from '@server/types/models' 11import { MVideoDetails, MVideoFullLight } from '@server/types/models'
12import { buildUUID, uuidToShort } from '@shared/core-utils' 12import { buildUUID, uuidToShort } from '@shared/core-utils'
13import { LiveVideoCreate, LiveVideoUpdate, VideoState } from '../../../../shared' 13import { HttpStatusCode, LiveVideoCreate, LiveVideoUpdate, VideoState } from '@shared/models'
14import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
15import { logger } from '../../../helpers/logger' 14import { logger } from '../../../helpers/logger'
16import { sequelizeTypescript } from '../../../initializers/database' 15import { sequelizeTypescript } from '../../../initializers/database'
17import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail' 16import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail'
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts
index c9cc16644..6b26a8eee 100644
--- a/server/controllers/api/videos/rate.ts
+++ b/server/controllers/api/videos/rate.ts
@@ -1,6 +1,5 @@
1import express from 'express' 1import express from 'express'
2import { UserVideoRateUpdate } from '../../../../shared' 2import { HttpStatusCode, UserVideoRateUpdate } from '@shared/models'
3import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
4import { logger } from '../../../helpers/logger' 3import { logger } from '../../../helpers/logger'
5import { VIDEO_RATE_TYPES } from '../../../initializers/constants' 4import { VIDEO_RATE_TYPES } from '../../../initializers/constants'
6import { sequelizeTypescript } from '../../../initializers/database' 5import { sequelizeTypescript } from '../../../initializers/database'
diff --git a/server/controllers/api/videos/update.ts b/server/controllers/api/videos/update.ts
index 589556f47..f600847d4 100644
--- a/server/controllers/api/videos/update.ts
+++ b/server/controllers/api/videos/update.ts
@@ -6,8 +6,7 @@ import { buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video'
6import { openapiOperationDoc } from '@server/middlewares/doc' 6import { openapiOperationDoc } from '@server/middlewares/doc'
7import { FilteredModelAttributes } from '@server/types' 7import { FilteredModelAttributes } from '@server/types'
8import { MVideoFullLight } from '@server/types/models' 8import { MVideoFullLight } from '@server/types/models'
9import { VideoUpdate } from '../../../../shared' 9import { HttpStatusCode, VideoUpdate } from '@shared/models'
10import { HttpStatusCode } from '../../../../shared/models'
11import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' 10import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
12import { resetSequelizeInstance } from '../../../helpers/database-utils' 11import { resetSequelizeInstance } from '../../../helpers/database-utils'
13import { createReqFiles } from '../../../helpers/express-utils' 12import { createReqFiles } from '../../../helpers/express-utils'
diff --git a/server/controllers/api/videos/upload.ts b/server/controllers/api/videos/upload.ts
index ecc4dfa37..e8f400cff 100644
--- a/server/controllers/api/videos/upload.ts
+++ b/server/controllers/api/videos/upload.ts
@@ -20,8 +20,7 @@ import { openapiOperationDoc } from '@server/middlewares/doc'
20import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' 20import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
21import { getLowercaseExtension, uuidToShort } from '@shared/core-utils' 21import { getLowercaseExtension, uuidToShort } from '@shared/core-utils'
22import { isAudioFile } from '@shared/extra-utils' 22import { isAudioFile } from '@shared/extra-utils'
23import { VideoCreate, VideoState } from '../../../../shared' 23import { HttpStatusCode, VideoCreate, VideoResolution, VideoState } from '@shared/models'
24import { HttpStatusCode, VideoResolution } from '../../../../shared/models'
25import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' 24import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
26import { retryTransactionWrapper } from '../../../helpers/database-utils' 25import { retryTransactionWrapper } from '../../../helpers/database-utils'
27import { createReqFiles } from '../../../helpers/express-utils' 26import { createReqFiles } from '../../../helpers/express-utils'
diff --git a/server/controllers/api/videos/watching.ts b/server/controllers/api/videos/watching.ts
index e8c28b613..3fd22caac 100644
--- a/server/controllers/api/videos/watching.ts
+++ b/server/controllers/api/videos/watching.ts
@@ -1,6 +1,5 @@
1import express from 'express' 1import express from 'express'
2import { UserWatchingVideo } from '../../../../shared' 2import { HttpStatusCode, UserWatchingVideo } from '@shared/models'
3import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
4import { 3import {
5 asyncMiddleware, 4 asyncMiddleware,
6 asyncRetryTransactionMiddleware, 5 asyncRetryTransactionMiddleware,