aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/users/me.ts11
-rw-r--r--server/controllers/api/video-channel.ts9
2 files changed, 14 insertions, 6 deletions
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index 595abcf95..00f580ee9 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -25,7 +25,13 @@ import {
25 usersUpdateMeValidator, 25 usersUpdateMeValidator,
26 usersVideoRatingValidator 26 usersVideoRatingValidator
27} from '../../../middlewares' 27} from '../../../middlewares'
28import { deleteMeValidator, usersVideosValidator, videoImportsSortValidator, videosSortValidator } from '../../../middlewares/validators' 28import {
29 deleteMeValidator,
30 getMyVideoImportsValidator,
31 usersVideosValidator,
32 videoImportsSortValidator,
33 videosSortValidator
34} from '../../../middlewares/validators'
29import { updateAvatarValidator } from '../../../middlewares/validators/actor-image' 35import { updateAvatarValidator } from '../../../middlewares/validators/actor-image'
30import { AccountModel } from '../../../models/account/account' 36import { AccountModel } from '../../../models/account/account'
31import { AccountVideoRateModel } from '../../../models/account/account-video-rate' 37import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
@@ -60,6 +66,7 @@ meRouter.get('/me/videos/imports',
60 videoImportsSortValidator, 66 videoImportsSortValidator,
61 setDefaultSort, 67 setDefaultSort,
62 setDefaultPagination, 68 setDefaultPagination,
69 getMyVideoImportsValidator,
63 asyncMiddleware(getUserVideoImports) 70 asyncMiddleware(getUserVideoImports)
64) 71)
65 72
@@ -138,7 +145,7 @@ async function getUserVideoImports (req: express.Request, res: express.Response)
138 const resultList = await VideoImportModel.listUserVideoImportsForApi({ 145 const resultList = await VideoImportModel.listUserVideoImportsForApi({
139 userId: user.id, 146 userId: user.id,
140 147
141 ...pick(req.query, [ 'targetUrl', 'start', 'count', 'sort' ]) 148 ...pick(req.query, [ 'targetUrl', 'start', 'count', 'sort', 'search', 'videoChannelSyncId' ])
142 }) 149 })
143 150
144 return res.json(getFormattedObjects(resultList.data, resultList.total)) 151 return res.json(getFormattedObjects(resultList.data, resultList.total))
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts
index 89c7181bd..94285a78d 100644
--- a/server/controllers/api/video-channel.ts
+++ b/server/controllers/api/video-channel.ts
@@ -6,7 +6,7 @@ import { ActorFollowModel } from '@server/models/actor/actor-follow'
6import { getServerActor } from '@server/models/application/application' 6import { getServerActor } from '@server/models/application/application'
7import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils' 7import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils'
8import { MChannelBannerAccountDefault } from '@server/types/models' 8import { MChannelBannerAccountDefault } from '@server/types/models'
9import { ActorImageType, HttpStatusCode, VideoChannelCreate, VideoChannelUpdate } from '@shared/models' 9import { ActorImageType, HttpStatusCode, VideoChannelCreate, VideoChannelUpdate, VideosImportInChannelCreate } from '@shared/models'
10import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger' 10import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger'
11import { resetSequelizeInstance } from '../../helpers/database-utils' 11import { resetSequelizeInstance } from '../../helpers/database-utils'
12import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' 12import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
@@ -166,7 +166,7 @@ videoChannelRouter.get('/:nameWithHost/followers',
166videoChannelRouter.post('/:nameWithHost/import-videos', 166videoChannelRouter.post('/:nameWithHost/import-videos',
167 authenticate, 167 authenticate,
168 asyncMiddleware(videoChannelsNameWithHostValidator), 168 asyncMiddleware(videoChannelsNameWithHostValidator),
169 videoChannelImportVideosValidator, 169 asyncMiddleware(videoChannelImportVideosValidator),
170 ensureIsLocalChannel, 170 ensureIsLocalChannel,
171 ensureCanManageChannel, 171 ensureCanManageChannel,
172 asyncMiddleware(ensureChannelOwnerCanUpload), 172 asyncMiddleware(ensureChannelOwnerCanUpload),
@@ -418,13 +418,14 @@ async function listVideoChannelFollowers (req: express.Request, res: express.Res
418} 418}
419 419
420async function importVideosInChannel (req: express.Request, res: express.Response) { 420async function importVideosInChannel (req: express.Request, res: express.Response) {
421 const { externalChannelUrl } = req.body 421 const { externalChannelUrl } = req.body as VideosImportInChannelCreate
422 422
423 await JobQueue.Instance.createJob({ 423 await JobQueue.Instance.createJob({
424 type: 'video-channel-import', 424 type: 'video-channel-import',
425 payload: { 425 payload: {
426 externalChannelUrl, 426 externalChannelUrl,
427 videoChannelId: res.locals.videoChannel.id 427 videoChannelId: res.locals.videoChannel.id,
428 partOfChannelSyncId: res.locals.videoChannelSync?.id
428 } 429 }
429 }) 430 })
430 431