diff options
-rw-r--r-- | server/controllers/api/accounts.ts | 15 | ||||
-rw-r--r-- | server/controllers/api/users/me.ts | 3 | ||||
-rw-r--r-- | server/controllers/api/users/my-subscriptions.ts | 19 | ||||
-rw-r--r-- | server/controllers/api/video-channel.ts | 41 | ||||
-rw-r--r-- | server/controllers/api/videos/index.ts | 54 | ||||
-rw-r--r-- | server/controllers/feeds.ts | 18 | ||||
-rw-r--r-- | server/middlewares/sort.ts | 2 |
7 files changed, 79 insertions, 73 deletions
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts index b1c05c6c0..0a73dfcbf 100644 --- a/server/controllers/api/accounts.ts +++ b/server/controllers/api/accounts.ts | |||
@@ -1,5 +1,8 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { getServerActor } from '@server/models/application/application' | ||
3 | import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' | ||
2 | import { getFormattedObjects } from '../../helpers/utils' | 4 | import { getFormattedObjects } from '../../helpers/utils' |
5 | import { JobQueue } from '../../lib/job-queue' | ||
3 | import { | 6 | import { |
4 | asyncMiddleware, | 7 | asyncMiddleware, |
5 | authenticate, | 8 | authenticate, |
@@ -8,6 +11,7 @@ import { | |||
8 | paginationValidator, | 11 | paginationValidator, |
9 | setDefaultPagination, | 12 | setDefaultPagination, |
10 | setDefaultSort, | 13 | setDefaultSort, |
14 | setDefaultVideosSort, | ||
11 | videoPlaylistsSortValidator, | 15 | videoPlaylistsSortValidator, |
12 | videoRatesSortValidator, | 16 | videoRatesSortValidator, |
13 | videoRatingValidator | 17 | videoRatingValidator |
@@ -17,18 +21,15 @@ import { | |||
17 | accountsSortValidator, | 21 | accountsSortValidator, |
18 | ensureAuthUserOwnsAccountValidator, | 22 | ensureAuthUserOwnsAccountValidator, |
19 | videoChannelsSortValidator, | 23 | videoChannelsSortValidator, |
20 | videosSortValidator, | 24 | videoChannelStatsValidator, |
21 | videoChannelStatsValidator | 25 | videosSortValidator |
22 | } from '../../middlewares/validators' | 26 | } from '../../middlewares/validators' |
27 | import { commonVideoPlaylistFiltersValidator, videoPlaylistsSearchValidator } from '../../middlewares/validators/videos/video-playlists' | ||
23 | import { AccountModel } from '../../models/account/account' | 28 | import { AccountModel } from '../../models/account/account' |
24 | import { AccountVideoRateModel } from '../../models/account/account-video-rate' | 29 | import { AccountVideoRateModel } from '../../models/account/account-video-rate' |
25 | import { VideoModel } from '../../models/video/video' | 30 | import { VideoModel } from '../../models/video/video' |
26 | import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' | ||
27 | import { VideoChannelModel } from '../../models/video/video-channel' | 31 | import { VideoChannelModel } from '../../models/video/video-channel' |
28 | import { JobQueue } from '../../lib/job-queue' | ||
29 | import { VideoPlaylistModel } from '../../models/video/video-playlist' | 32 | import { VideoPlaylistModel } from '../../models/video/video-playlist' |
30 | import { commonVideoPlaylistFiltersValidator, videoPlaylistsSearchValidator } from '../../middlewares/validators/videos/video-playlists' | ||
31 | import { getServerActor } from '@server/models/application/application' | ||
32 | 33 | ||
33 | const accountsRouter = express.Router() | 34 | const accountsRouter = express.Router() |
34 | 35 | ||
@@ -49,7 +50,7 @@ accountsRouter.get('/:accountName/videos', | |||
49 | asyncMiddleware(accountNameWithHostGetValidator), | 50 | asyncMiddleware(accountNameWithHostGetValidator), |
50 | paginationValidator, | 51 | paginationValidator, |
51 | videosSortValidator, | 52 | videosSortValidator, |
52 | setDefaultSort, | 53 | setDefaultVideosSort, |
53 | setDefaultPagination, | 54 | setDefaultPagination, |
54 | optionalAuthenticate, | 55 | optionalAuthenticate, |
55 | commonVideosFiltersValidator, | 56 | commonVideosFiltersValidator, |
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts index 914c52e27..ba60a3d2a 100644 --- a/server/controllers/api/users/me.ts +++ b/server/controllers/api/users/me.ts | |||
@@ -17,6 +17,7 @@ import { | |||
17 | paginationValidator, | 17 | paginationValidator, |
18 | setDefaultPagination, | 18 | setDefaultPagination, |
19 | setDefaultSort, | 19 | setDefaultSort, |
20 | setDefaultVideosSort, | ||
20 | usersUpdateMeValidator, | 21 | usersUpdateMeValidator, |
21 | usersVideoRatingValidator | 22 | usersVideoRatingValidator |
22 | } from '../../../middlewares' | 23 | } from '../../../middlewares' |
@@ -60,7 +61,7 @@ meRouter.get('/me/videos', | |||
60 | authenticate, | 61 | authenticate, |
61 | paginationValidator, | 62 | paginationValidator, |
62 | videosSortValidator, | 63 | videosSortValidator, |
63 | setDefaultSort, | 64 | setDefaultVideosSort, |
64 | setDefaultPagination, | 65 | setDefaultPagination, |
65 | asyncMiddleware(getUserVideos) | 66 | asyncMiddleware(getUserVideos) |
66 | ) | 67 | ) |
diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts index 8b88feaf3..b8c234eef 100644 --- a/server/controllers/api/users/my-subscriptions.ts +++ b/server/controllers/api/users/my-subscriptions.ts | |||
@@ -1,7 +1,11 @@ | |||
1 | import * as express from 'express' | ||
2 | import 'multer' | 1 | import 'multer' |
2 | import * as express from 'express' | ||
3 | import { VideoFilter } from '../../../../shared/models/videos/video-query.type' | ||
4 | import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils' | ||
3 | import { getFormattedObjects } from '../../../helpers/utils' | 5 | import { getFormattedObjects } from '../../../helpers/utils' |
4 | import { WEBSERVER } from '../../../initializers/constants' | 6 | import { WEBSERVER } from '../../../initializers/constants' |
7 | import { sequelizeTypescript } from '../../../initializers/database' | ||
8 | import { JobQueue } from '../../../lib/job-queue' | ||
5 | import { | 9 | import { |
6 | asyncMiddleware, | 10 | asyncMiddleware, |
7 | asyncRetryTransactionMiddleware, | 11 | asyncRetryTransactionMiddleware, |
@@ -10,21 +14,18 @@ import { | |||
10 | paginationValidator, | 14 | paginationValidator, |
11 | setDefaultPagination, | 15 | setDefaultPagination, |
12 | setDefaultSort, | 16 | setDefaultSort, |
17 | setDefaultVideosSort, | ||
13 | userSubscriptionAddValidator, | 18 | userSubscriptionAddValidator, |
14 | userSubscriptionGetValidator | 19 | userSubscriptionGetValidator |
15 | } from '../../../middlewares' | 20 | } from '../../../middlewares' |
16 | import { | 21 | import { |
17 | areSubscriptionsExistValidator, | 22 | areSubscriptionsExistValidator, |
23 | userSubscriptionListValidator, | ||
18 | userSubscriptionsSortValidator, | 24 | userSubscriptionsSortValidator, |
19 | videosSortValidator, | 25 | videosSortValidator |
20 | userSubscriptionListValidator | ||
21 | } from '../../../middlewares/validators' | 26 | } from '../../../middlewares/validators' |
22 | import { VideoModel } from '../../../models/video/video' | ||
23 | import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils' | ||
24 | import { VideoFilter } from '../../../../shared/models/videos/video-query.type' | ||
25 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | 27 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' |
26 | import { JobQueue } from '../../../lib/job-queue' | 28 | import { VideoModel } from '../../../models/video/video' |
27 | import { sequelizeTypescript } from '../../../initializers/database' | ||
28 | 29 | ||
29 | const mySubscriptionsRouter = express.Router() | 30 | const mySubscriptionsRouter = express.Router() |
30 | 31 | ||
@@ -32,7 +33,7 @@ mySubscriptionsRouter.get('/me/subscriptions/videos', | |||
32 | authenticate, | 33 | authenticate, |
33 | paginationValidator, | 34 | paginationValidator, |
34 | videosSortValidator, | 35 | videosSortValidator, |
35 | setDefaultSort, | 36 | setDefaultVideosSort, |
36 | setDefaultPagination, | 37 | setDefaultPagination, |
37 | commonVideosFiltersValidator, | 38 | commonVideosFiltersValidator, |
38 | asyncMiddleware(getUserSubscriptionVideos) | 39 | asyncMiddleware(getUserSubscriptionVideos) |
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index f705034fd..45c936978 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts | |||
@@ -1,5 +1,20 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { getServerActor } from '@server/models/application/application' | ||
3 | import { MChannelAccountDefault } from '@server/types/models' | ||
4 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' | ||
5 | import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger' | ||
6 | import { resetSequelizeInstance } from '../../helpers/database-utils' | ||
7 | import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' | ||
8 | import { logger } from '../../helpers/logger' | ||
2 | import { getFormattedObjects } from '../../helpers/utils' | 9 | import { getFormattedObjects } from '../../helpers/utils' |
10 | import { CONFIG } from '../../initializers/config' | ||
11 | import { MIMETYPES } from '../../initializers/constants' | ||
12 | import { sequelizeTypescript } from '../../initializers/database' | ||
13 | import { setAsyncActorKeys } from '../../lib/activitypub/actor' | ||
14 | import { sendUpdateActor } from '../../lib/activitypub/send' | ||
15 | import { updateActorAvatarFile } from '../../lib/avatar' | ||
16 | import { JobQueue } from '../../lib/job-queue' | ||
17 | import { createLocalVideoChannel, federateAllVideosOfChannel } from '../../lib/video-channel' | ||
3 | import { | 18 | import { |
4 | asyncMiddleware, | 19 | asyncMiddleware, |
5 | asyncRetryTransactionMiddleware, | 20 | asyncRetryTransactionMiddleware, |
@@ -9,34 +24,20 @@ import { | |||
9 | paginationValidator, | 24 | paginationValidator, |
10 | setDefaultPagination, | 25 | setDefaultPagination, |
11 | setDefaultSort, | 26 | setDefaultSort, |
27 | setDefaultVideosSort, | ||
12 | videoChannelsAddValidator, | 28 | videoChannelsAddValidator, |
13 | videoChannelsRemoveValidator, | 29 | videoChannelsRemoveValidator, |
14 | videoChannelsSortValidator, | 30 | videoChannelsSortValidator, |
15 | videoChannelsUpdateValidator, | 31 | videoChannelsUpdateValidator, |
16 | videoPlaylistsSortValidator | 32 | videoPlaylistsSortValidator |
17 | } from '../../middlewares' | 33 | } from '../../middlewares' |
18 | import { VideoChannelModel } from '../../models/video/video-channel' | 34 | import { videoChannelsNameWithHostValidator, videoChannelsOwnSearchValidator, videosSortValidator } from '../../middlewares/validators' |
19 | import { videoChannelsNameWithHostValidator, videosSortValidator, videoChannelsOwnSearchValidator } from '../../middlewares/validators' | 35 | import { updateAvatarValidator } from '../../middlewares/validators/avatar' |
20 | import { sendUpdateActor } from '../../lib/activitypub/send' | 36 | import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists' |
21 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' | ||
22 | import { createLocalVideoChannel, federateAllVideosOfChannel } from '../../lib/video-channel' | ||
23 | import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' | ||
24 | import { setAsyncActorKeys } from '../../lib/activitypub/actor' | ||
25 | import { AccountModel } from '../../models/account/account' | 37 | import { AccountModel } from '../../models/account/account' |
26 | import { MIMETYPES } from '../../initializers/constants' | ||
27 | import { logger } from '../../helpers/logger' | ||
28 | import { VideoModel } from '../../models/video/video' | 38 | import { VideoModel } from '../../models/video/video' |
29 | import { updateAvatarValidator } from '../../middlewares/validators/avatar' | 39 | import { VideoChannelModel } from '../../models/video/video-channel' |
30 | import { updateActorAvatarFile } from '../../lib/avatar' | ||
31 | import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger' | ||
32 | import { resetSequelizeInstance } from '../../helpers/database-utils' | ||
33 | import { JobQueue } from '../../lib/job-queue' | ||
34 | import { VideoPlaylistModel } from '../../models/video/video-playlist' | 40 | import { VideoPlaylistModel } from '../../models/video/video-playlist' |
35 | import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists' | ||
36 | import { CONFIG } from '../../initializers/config' | ||
37 | import { sequelizeTypescript } from '../../initializers/database' | ||
38 | import { MChannelAccountDefault } from '@server/types/models' | ||
39 | import { getServerActor } from '@server/models/application/application' | ||
40 | 41 | ||
41 | const auditLogger = auditLoggerFactory('channels') | 42 | const auditLogger = auditLoggerFactory('channels') |
42 | const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) | 43 | const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) |
@@ -98,7 +99,7 @@ videoChannelRouter.get('/:nameWithHost/videos', | |||
98 | asyncMiddleware(videoChannelsNameWithHostValidator), | 99 | asyncMiddleware(videoChannelsNameWithHostValidator), |
99 | paginationValidator, | 100 | paginationValidator, |
100 | videosSortValidator, | 101 | videosSortValidator, |
101 | setDefaultSort, | 102 | setDefaultVideosSort, |
102 | setDefaultPagination, | 103 | setDefaultPagination, |
103 | optionalAuthenticate, | 104 | optionalAuthenticate, |
104 | commonVideosFiltersValidator, | 105 | commonVideosFiltersValidator, |
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 1dfd7c7a0..c05acfd2f 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -1,11 +1,24 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { move } from 'fs-extra' | ||
2 | import { extname } from 'path' | 3 | import { extname } from 'path' |
4 | import toInt from 'validator/lib/toInt' | ||
5 | import { addOptimizeOrMergeAudioJob } from '@server/helpers/video' | ||
6 | import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' | ||
7 | import { changeVideoChannelShare } from '@server/lib/activitypub/share' | ||
8 | import { getVideoActivityPubUrl } from '@server/lib/activitypub/url' | ||
9 | import { getVideoFilePath } from '@server/lib/video-paths' | ||
10 | import { getServerActor } from '@server/models/application/application' | ||
11 | import { MVideoDetails, MVideoFullLight } from '@server/types/models' | ||
3 | import { VideoCreate, VideoPrivacy, VideoState, VideoUpdate } from '../../../../shared' | 12 | import { VideoCreate, VideoPrivacy, VideoState, VideoUpdate } from '../../../../shared' |
13 | import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type' | ||
14 | import { VideoFilter } from '../../../../shared/models/videos/video-query.type' | ||
15 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' | ||
16 | import { resetSequelizeInstance } from '../../../helpers/database-utils' | ||
17 | import { buildNSFWFilter, createReqFiles, getCountVideos } from '../../../helpers/express-utils' | ||
4 | import { getMetadataFromFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' | 18 | import { getMetadataFromFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' |
5 | import { logger } from '../../../helpers/logger' | 19 | import { logger } from '../../../helpers/logger' |
6 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' | ||
7 | import { getFormattedObjects } from '../../../helpers/utils' | 20 | import { getFormattedObjects } from '../../../helpers/utils' |
8 | import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist' | 21 | import { CONFIG } from '../../../initializers/config' |
9 | import { | 22 | import { |
10 | DEFAULT_AUDIO_RESOLUTION, | 23 | DEFAULT_AUDIO_RESOLUTION, |
11 | MIMETYPES, | 24 | MIMETYPES, |
@@ -14,9 +27,15 @@ import { | |||
14 | VIDEO_LICENCES, | 27 | VIDEO_LICENCES, |
15 | VIDEO_PRIVACIES | 28 | VIDEO_PRIVACIES |
16 | } from '../../../initializers/constants' | 29 | } from '../../../initializers/constants' |
30 | import { sequelizeTypescript } from '../../../initializers/database' | ||
31 | import { sendView } from '../../../lib/activitypub/send/send-view' | ||
17 | import { federateVideoIfNeeded, fetchRemoteVideoDescription } from '../../../lib/activitypub/videos' | 32 | import { federateVideoIfNeeded, fetchRemoteVideoDescription } from '../../../lib/activitypub/videos' |
18 | import { JobQueue } from '../../../lib/job-queue' | 33 | import { JobQueue } from '../../../lib/job-queue' |
34 | import { Notifier } from '../../../lib/notifier' | ||
35 | import { Hooks } from '../../../lib/plugins/hooks' | ||
19 | import { Redis } from '../../../lib/redis' | 36 | import { Redis } from '../../../lib/redis' |
37 | import { createVideoMiniatureFromExisting, generateVideoMiniature } from '../../../lib/thumbnail' | ||
38 | import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist' | ||
20 | import { | 39 | import { |
21 | asyncMiddleware, | 40 | asyncMiddleware, |
22 | asyncRetryTransactionMiddleware, | 41 | asyncRetryTransactionMiddleware, |
@@ -26,7 +45,7 @@ import { | |||
26 | optionalAuthenticate, | 45 | optionalAuthenticate, |
27 | paginationValidator, | 46 | paginationValidator, |
28 | setDefaultPagination, | 47 | setDefaultPagination, |
29 | setDefaultSort, | 48 | setDefaultVideosSort, |
30 | videoFileMetadataGetValidator, | 49 | videoFileMetadataGetValidator, |
31 | videosAddValidator, | 50 | videosAddValidator, |
32 | videosCustomGetValidator, | 51 | videosCustomGetValidator, |
@@ -35,37 +54,18 @@ import { | |||
35 | videosSortValidator, | 54 | videosSortValidator, |
36 | videosUpdateValidator | 55 | videosUpdateValidator |
37 | } from '../../../middlewares' | 56 | } from '../../../middlewares' |
57 | import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' | ||
38 | import { TagModel } from '../../../models/video/tag' | 58 | import { TagModel } from '../../../models/video/tag' |
39 | import { VideoModel } from '../../../models/video/video' | 59 | import { VideoModel } from '../../../models/video/video' |
40 | import { VideoFileModel } from '../../../models/video/video-file' | 60 | import { VideoFileModel } from '../../../models/video/video-file' |
41 | import { abuseVideoRouter } from './abuse' | 61 | import { abuseVideoRouter } from './abuse' |
42 | import { blacklistRouter } from './blacklist' | 62 | import { blacklistRouter } from './blacklist' |
43 | import { videoCommentRouter } from './comment' | ||
44 | import { rateVideoRouter } from './rate' | ||
45 | import { ownershipVideoRouter } from './ownership' | ||
46 | import { VideoFilter } from '../../../../shared/models/videos/video-query.type' | ||
47 | import { buildNSFWFilter, createReqFiles, getCountVideos } from '../../../helpers/express-utils' | ||
48 | import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' | ||
49 | import { videoCaptionsRouter } from './captions' | 63 | import { videoCaptionsRouter } from './captions' |
64 | import { videoCommentRouter } from './comment' | ||
50 | import { videoImportsRouter } from './import' | 65 | import { videoImportsRouter } from './import' |
51 | import { resetSequelizeInstance } from '../../../helpers/database-utils' | 66 | import { ownershipVideoRouter } from './ownership' |
52 | import { move } from 'fs-extra' | 67 | import { rateVideoRouter } from './rate' |
53 | import { watchingRouter } from './watching' | 68 | import { watchingRouter } from './watching' |
54 | import { Notifier } from '../../../lib/notifier' | ||
55 | import { sendView } from '../../../lib/activitypub/send/send-view' | ||
56 | import { CONFIG } from '../../../initializers/config' | ||
57 | import { sequelizeTypescript } from '../../../initializers/database' | ||
58 | import { createVideoMiniatureFromExisting, generateVideoMiniature } from '../../../lib/thumbnail' | ||
59 | import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type' | ||
60 | import { Hooks } from '../../../lib/plugins/hooks' | ||
61 | import { MVideoDetails, MVideoFullLight } from '@server/types/models' | ||
62 | import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' | ||
63 | import { getVideoFilePath } from '@server/lib/video-paths' | ||
64 | import toInt from 'validator/lib/toInt' | ||
65 | import { addOptimizeOrMergeAudioJob } from '@server/helpers/video' | ||
66 | import { getServerActor } from '@server/models/application/application' | ||
67 | import { changeVideoChannelShare } from '@server/lib/activitypub/share' | ||
68 | import { getVideoActivityPubUrl } from '@server/lib/activitypub/url' | ||
69 | 69 | ||
70 | const auditLogger = auditLoggerFactory('videos') | 70 | const auditLogger = auditLoggerFactory('videos') |
71 | const videosRouter = express.Router() | 71 | const videosRouter = express.Router() |
@@ -105,7 +105,7 @@ videosRouter.get('/privacies', listVideoPrivacies) | |||
105 | videosRouter.get('/', | 105 | videosRouter.get('/', |
106 | paginationValidator, | 106 | paginationValidator, |
107 | videosSortValidator, | 107 | videosSortValidator, |
108 | setDefaultSort, | 108 | setDefaultVideosSort, |
109 | setDefaultPagination, | 109 | setDefaultPagination, |
110 | optionalAuthenticate, | 110 | optionalAuthenticate, |
111 | commonVideosFiltersValidator, | 111 | commonVideosFiltersValidator, |
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts index bfcd3fe36..f14c0d316 100644 --- a/server/controllers/feeds.ts +++ b/server/controllers/feeds.ts | |||
@@ -1,21 +1,21 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import * as Feed from 'pfeed' | ||
3 | import { buildNSFWFilter } from '../helpers/express-utils' | ||
4 | import { CONFIG } from '../initializers/config' | ||
2 | import { FEEDS, ROUTE_CACHE_LIFETIME, THUMBNAILS_SIZE, WEBSERVER } from '../initializers/constants' | 5 | import { FEEDS, ROUTE_CACHE_LIFETIME, THUMBNAILS_SIZE, WEBSERVER } from '../initializers/constants' |
3 | import { | 6 | import { |
4 | asyncMiddleware, | 7 | asyncMiddleware, |
5 | commonVideosFiltersValidator, | 8 | commonVideosFiltersValidator, |
6 | setDefaultSort, | 9 | feedsFormatValidator, |
10 | setDefaultVideosSort, | ||
11 | setFeedFormatContentType, | ||
7 | videoCommentsFeedsValidator, | 12 | videoCommentsFeedsValidator, |
8 | videoFeedsValidator, | 13 | videoFeedsValidator, |
9 | videosSortValidator, | 14 | videosSortValidator |
10 | feedsFormatValidator, | ||
11 | setFeedFormatContentType | ||
12 | } from '../middlewares' | 15 | } from '../middlewares' |
13 | import { VideoModel } from '../models/video/video' | ||
14 | import * as Feed from 'pfeed' | ||
15 | import { cacheRoute } from '../middlewares/cache' | 16 | import { cacheRoute } from '../middlewares/cache' |
17 | import { VideoModel } from '../models/video/video' | ||
16 | import { VideoCommentModel } from '../models/video/video-comment' | 18 | import { VideoCommentModel } from '../models/video/video-comment' |
17 | import { buildNSFWFilter } from '../helpers/express-utils' | ||
18 | import { CONFIG } from '../initializers/config' | ||
19 | 19 | ||
20 | const feedsRouter = express.Router() | 20 | const feedsRouter = express.Router() |
21 | 21 | ||
@@ -34,7 +34,7 @@ feedsRouter.get('/feeds/video-comments.:format', | |||
34 | 34 | ||
35 | feedsRouter.get('/feeds/videos.:format', | 35 | feedsRouter.get('/feeds/videos.:format', |
36 | videosSortValidator, | 36 | videosSortValidator, |
37 | setDefaultSort, | 37 | setDefaultVideosSort, |
38 | feedsFormatValidator, | 38 | feedsFormatValidator, |
39 | setFeedFormatContentType, | 39 | setFeedFormatContentType, |
40 | asyncMiddleware(cacheRoute({ | 40 | asyncMiddleware(cacheRoute({ |
diff --git a/server/middlewares/sort.ts b/server/middlewares/sort.ts index fcbb2902c..609046a46 100644 --- a/server/middlewares/sort.ts +++ b/server/middlewares/sort.ts | |||
@@ -2,6 +2,7 @@ import * as express from 'express' | |||
2 | import { SortType } from '../models/utils' | 2 | import { SortType } from '../models/utils' |
3 | 3 | ||
4 | const setDefaultSort = setDefaultSortFactory('-createdAt') | 4 | const setDefaultSort = setDefaultSortFactory('-createdAt') |
5 | const setDefaultVideosSort = setDefaultSortFactory('-publishedAt') | ||
5 | 6 | ||
6 | const setDefaultVideoRedundanciesSort = setDefaultSortFactory('name') | 7 | const setDefaultVideoRedundanciesSort = setDefaultSortFactory('name') |
7 | 8 | ||
@@ -33,6 +34,7 @@ function setBlacklistSort (req: express.Request, res: express.Response, next: ex | |||
33 | export { | 34 | export { |
34 | setDefaultSort, | 35 | setDefaultSort, |
35 | setDefaultSearchSort, | 36 | setDefaultSearchSort, |
37 | setDefaultVideosSort, | ||
36 | setDefaultVideoRedundanciesSort, | 38 | setDefaultVideoRedundanciesSort, |
37 | setBlacklistSort | 39 | setBlacklistSort |
38 | } | 40 | } |