Optimize default sort when listing videos
createdAt does not have the appropriate index
This commit is contained in:
parent
1c58423f6c
commit
8054669f11
|
@ -1,5 +1,8 @@
|
||||||
import * as express from 'express'
|
import * as express from 'express'
|
||||||
|
import { getServerActor } from '@server/models/application/application'
|
||||||
|
import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
|
||||||
import { getFormattedObjects } from '../../helpers/utils'
|
import { getFormattedObjects } from '../../helpers/utils'
|
||||||
|
import { JobQueue } from '../../lib/job-queue'
|
||||||
import {
|
import {
|
||||||
asyncMiddleware,
|
asyncMiddleware,
|
||||||
authenticate,
|
authenticate,
|
||||||
|
@ -8,6 +11,7 @@ import {
|
||||||
paginationValidator,
|
paginationValidator,
|
||||||
setDefaultPagination,
|
setDefaultPagination,
|
||||||
setDefaultSort,
|
setDefaultSort,
|
||||||
|
setDefaultVideosSort,
|
||||||
videoPlaylistsSortValidator,
|
videoPlaylistsSortValidator,
|
||||||
videoRatesSortValidator,
|
videoRatesSortValidator,
|
||||||
videoRatingValidator
|
videoRatingValidator
|
||||||
|
@ -17,18 +21,15 @@ import {
|
||||||
accountsSortValidator,
|
accountsSortValidator,
|
||||||
ensureAuthUserOwnsAccountValidator,
|
ensureAuthUserOwnsAccountValidator,
|
||||||
videoChannelsSortValidator,
|
videoChannelsSortValidator,
|
||||||
videosSortValidator,
|
videoChannelStatsValidator,
|
||||||
videoChannelStatsValidator
|
videosSortValidator
|
||||||
} from '../../middlewares/validators'
|
} from '../../middlewares/validators'
|
||||||
|
import { commonVideoPlaylistFiltersValidator, videoPlaylistsSearchValidator } from '../../middlewares/validators/videos/video-playlists'
|
||||||
import { AccountModel } from '../../models/account/account'
|
import { AccountModel } from '../../models/account/account'
|
||||||
import { AccountVideoRateModel } from '../../models/account/account-video-rate'
|
import { AccountVideoRateModel } from '../../models/account/account-video-rate'
|
||||||
import { VideoModel } from '../../models/video/video'
|
import { VideoModel } from '../../models/video/video'
|
||||||
import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
|
|
||||||
import { VideoChannelModel } from '../../models/video/video-channel'
|
import { VideoChannelModel } from '../../models/video/video-channel'
|
||||||
import { JobQueue } from '../../lib/job-queue'
|
|
||||||
import { VideoPlaylistModel } from '../../models/video/video-playlist'
|
import { VideoPlaylistModel } from '../../models/video/video-playlist'
|
||||||
import { commonVideoPlaylistFiltersValidator, videoPlaylistsSearchValidator } from '../../middlewares/validators/videos/video-playlists'
|
|
||||||
import { getServerActor } from '@server/models/application/application'
|
|
||||||
|
|
||||||
const accountsRouter = express.Router()
|
const accountsRouter = express.Router()
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ accountsRouter.get('/:accountName/videos',
|
||||||
asyncMiddleware(accountNameWithHostGetValidator),
|
asyncMiddleware(accountNameWithHostGetValidator),
|
||||||
paginationValidator,
|
paginationValidator,
|
||||||
videosSortValidator,
|
videosSortValidator,
|
||||||
setDefaultSort,
|
setDefaultVideosSort,
|
||||||
setDefaultPagination,
|
setDefaultPagination,
|
||||||
optionalAuthenticate,
|
optionalAuthenticate,
|
||||||
commonVideosFiltersValidator,
|
commonVideosFiltersValidator,
|
||||||
|
|
|
@ -17,6 +17,7 @@ import {
|
||||||
paginationValidator,
|
paginationValidator,
|
||||||
setDefaultPagination,
|
setDefaultPagination,
|
||||||
setDefaultSort,
|
setDefaultSort,
|
||||||
|
setDefaultVideosSort,
|
||||||
usersUpdateMeValidator,
|
usersUpdateMeValidator,
|
||||||
usersVideoRatingValidator
|
usersVideoRatingValidator
|
||||||
} from '../../../middlewares'
|
} from '../../../middlewares'
|
||||||
|
@ -60,7 +61,7 @@ meRouter.get('/me/videos',
|
||||||
authenticate,
|
authenticate,
|
||||||
paginationValidator,
|
paginationValidator,
|
||||||
videosSortValidator,
|
videosSortValidator,
|
||||||
setDefaultSort,
|
setDefaultVideosSort,
|
||||||
setDefaultPagination,
|
setDefaultPagination,
|
||||||
asyncMiddleware(getUserVideos)
|
asyncMiddleware(getUserVideos)
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
import * as express from 'express'
|
|
||||||
import 'multer'
|
import 'multer'
|
||||||
|
import * as express from 'express'
|
||||||
|
import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
|
||||||
|
import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils'
|
||||||
import { getFormattedObjects } from '../../../helpers/utils'
|
import { getFormattedObjects } from '../../../helpers/utils'
|
||||||
import { WEBSERVER } from '../../../initializers/constants'
|
import { WEBSERVER } from '../../../initializers/constants'
|
||||||
|
import { sequelizeTypescript } from '../../../initializers/database'
|
||||||
|
import { JobQueue } from '../../../lib/job-queue'
|
||||||
import {
|
import {
|
||||||
asyncMiddleware,
|
asyncMiddleware,
|
||||||
asyncRetryTransactionMiddleware,
|
asyncRetryTransactionMiddleware,
|
||||||
|
@ -10,21 +14,18 @@ import {
|
||||||
paginationValidator,
|
paginationValidator,
|
||||||
setDefaultPagination,
|
setDefaultPagination,
|
||||||
setDefaultSort,
|
setDefaultSort,
|
||||||
|
setDefaultVideosSort,
|
||||||
userSubscriptionAddValidator,
|
userSubscriptionAddValidator,
|
||||||
userSubscriptionGetValidator
|
userSubscriptionGetValidator
|
||||||
} from '../../../middlewares'
|
} from '../../../middlewares'
|
||||||
import {
|
import {
|
||||||
areSubscriptionsExistValidator,
|
areSubscriptionsExistValidator,
|
||||||
|
userSubscriptionListValidator,
|
||||||
userSubscriptionsSortValidator,
|
userSubscriptionsSortValidator,
|
||||||
videosSortValidator,
|
videosSortValidator
|
||||||
userSubscriptionListValidator
|
|
||||||
} from '../../../middlewares/validators'
|
} from '../../../middlewares/validators'
|
||||||
import { VideoModel } from '../../../models/video/video'
|
|
||||||
import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils'
|
|
||||||
import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
|
|
||||||
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
||||||
import { JobQueue } from '../../../lib/job-queue'
|
import { VideoModel } from '../../../models/video/video'
|
||||||
import { sequelizeTypescript } from '../../../initializers/database'
|
|
||||||
|
|
||||||
const mySubscriptionsRouter = express.Router()
|
const mySubscriptionsRouter = express.Router()
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ mySubscriptionsRouter.get('/me/subscriptions/videos',
|
||||||
authenticate,
|
authenticate,
|
||||||
paginationValidator,
|
paginationValidator,
|
||||||
videosSortValidator,
|
videosSortValidator,
|
||||||
setDefaultSort,
|
setDefaultVideosSort,
|
||||||
setDefaultPagination,
|
setDefaultPagination,
|
||||||
commonVideosFiltersValidator,
|
commonVideosFiltersValidator,
|
||||||
asyncMiddleware(getUserSubscriptionVideos)
|
asyncMiddleware(getUserSubscriptionVideos)
|
||||||
|
|
|
@ -1,5 +1,20 @@
|
||||||
import * as express from 'express'
|
import * as express from 'express'
|
||||||
|
import { getServerActor } from '@server/models/application/application'
|
||||||
|
import { MChannelAccountDefault } from '@server/types/models'
|
||||||
|
import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared'
|
||||||
|
import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger'
|
||||||
|
import { resetSequelizeInstance } from '../../helpers/database-utils'
|
||||||
|
import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
|
||||||
|
import { logger } from '../../helpers/logger'
|
||||||
import { getFormattedObjects } from '../../helpers/utils'
|
import { getFormattedObjects } from '../../helpers/utils'
|
||||||
|
import { CONFIG } from '../../initializers/config'
|
||||||
|
import { MIMETYPES } from '../../initializers/constants'
|
||||||
|
import { sequelizeTypescript } from '../../initializers/database'
|
||||||
|
import { setAsyncActorKeys } from '../../lib/activitypub/actor'
|
||||||
|
import { sendUpdateActor } from '../../lib/activitypub/send'
|
||||||
|
import { updateActorAvatarFile } from '../../lib/avatar'
|
||||||
|
import { JobQueue } from '../../lib/job-queue'
|
||||||
|
import { createLocalVideoChannel, federateAllVideosOfChannel } from '../../lib/video-channel'
|
||||||
import {
|
import {
|
||||||
asyncMiddleware,
|
asyncMiddleware,
|
||||||
asyncRetryTransactionMiddleware,
|
asyncRetryTransactionMiddleware,
|
||||||
|
@ -9,34 +24,20 @@ import {
|
||||||
paginationValidator,
|
paginationValidator,
|
||||||
setDefaultPagination,
|
setDefaultPagination,
|
||||||
setDefaultSort,
|
setDefaultSort,
|
||||||
|
setDefaultVideosSort,
|
||||||
videoChannelsAddValidator,
|
videoChannelsAddValidator,
|
||||||
videoChannelsRemoveValidator,
|
videoChannelsRemoveValidator,
|
||||||
videoChannelsSortValidator,
|
videoChannelsSortValidator,
|
||||||
videoChannelsUpdateValidator,
|
videoChannelsUpdateValidator,
|
||||||
videoPlaylistsSortValidator
|
videoPlaylistsSortValidator
|
||||||
} from '../../middlewares'
|
} from '../../middlewares'
|
||||||
import { VideoChannelModel } from '../../models/video/video-channel'
|
import { videoChannelsNameWithHostValidator, videoChannelsOwnSearchValidator, videosSortValidator } from '../../middlewares/validators'
|
||||||
import { videoChannelsNameWithHostValidator, videosSortValidator, videoChannelsOwnSearchValidator } from '../../middlewares/validators'
|
|
||||||
import { sendUpdateActor } from '../../lib/activitypub/send'
|
|
||||||
import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared'
|
|
||||||
import { createLocalVideoChannel, federateAllVideosOfChannel } from '../../lib/video-channel'
|
|
||||||
import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
|
|
||||||
import { setAsyncActorKeys } from '../../lib/activitypub/actor'
|
|
||||||
import { AccountModel } from '../../models/account/account'
|
|
||||||
import { MIMETYPES } from '../../initializers/constants'
|
|
||||||
import { logger } from '../../helpers/logger'
|
|
||||||
import { VideoModel } from '../../models/video/video'
|
|
||||||
import { updateAvatarValidator } from '../../middlewares/validators/avatar'
|
import { updateAvatarValidator } from '../../middlewares/validators/avatar'
|
||||||
import { updateActorAvatarFile } from '../../lib/avatar'
|
|
||||||
import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger'
|
|
||||||
import { resetSequelizeInstance } from '../../helpers/database-utils'
|
|
||||||
import { JobQueue } from '../../lib/job-queue'
|
|
||||||
import { VideoPlaylistModel } from '../../models/video/video-playlist'
|
|
||||||
import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists'
|
import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists'
|
||||||
import { CONFIG } from '../../initializers/config'
|
import { AccountModel } from '../../models/account/account'
|
||||||
import { sequelizeTypescript } from '../../initializers/database'
|
import { VideoModel } from '../../models/video/video'
|
||||||
import { MChannelAccountDefault } from '@server/types/models'
|
import { VideoChannelModel } from '../../models/video/video-channel'
|
||||||
import { getServerActor } from '@server/models/application/application'
|
import { VideoPlaylistModel } from '../../models/video/video-playlist'
|
||||||
|
|
||||||
const auditLogger = auditLoggerFactory('channels')
|
const auditLogger = auditLoggerFactory('channels')
|
||||||
const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR })
|
const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR })
|
||||||
|
@ -98,7 +99,7 @@ videoChannelRouter.get('/:nameWithHost/videos',
|
||||||
asyncMiddleware(videoChannelsNameWithHostValidator),
|
asyncMiddleware(videoChannelsNameWithHostValidator),
|
||||||
paginationValidator,
|
paginationValidator,
|
||||||
videosSortValidator,
|
videosSortValidator,
|
||||||
setDefaultSort,
|
setDefaultVideosSort,
|
||||||
setDefaultPagination,
|
setDefaultPagination,
|
||||||
optionalAuthenticate,
|
optionalAuthenticate,
|
||||||
commonVideosFiltersValidator,
|
commonVideosFiltersValidator,
|
||||||
|
|
|
@ -1,11 +1,24 @@
|
||||||
import * as express from 'express'
|
import * as express from 'express'
|
||||||
|
import { move } from 'fs-extra'
|
||||||
import { extname } from 'path'
|
import { extname } from 'path'
|
||||||
|
import toInt from 'validator/lib/toInt'
|
||||||
|
import { addOptimizeOrMergeAudioJob } from '@server/helpers/video'
|
||||||
|
import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
|
||||||
|
import { changeVideoChannelShare } from '@server/lib/activitypub/share'
|
||||||
|
import { getVideoActivityPubUrl } from '@server/lib/activitypub/url'
|
||||||
|
import { getVideoFilePath } from '@server/lib/video-paths'
|
||||||
|
import { getServerActor } from '@server/models/application/application'
|
||||||
|
import { MVideoDetails, MVideoFullLight } from '@server/types/models'
|
||||||
import { VideoCreate, VideoPrivacy, VideoState, VideoUpdate } from '../../../../shared'
|
import { VideoCreate, VideoPrivacy, VideoState, VideoUpdate } from '../../../../shared'
|
||||||
|
import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type'
|
||||||
|
import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
|
||||||
|
import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
|
||||||
|
import { resetSequelizeInstance } from '../../../helpers/database-utils'
|
||||||
|
import { buildNSFWFilter, createReqFiles, getCountVideos } from '../../../helpers/express-utils'
|
||||||
import { getMetadataFromFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils'
|
import { getMetadataFromFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils'
|
||||||
import { logger } from '../../../helpers/logger'
|
import { logger } from '../../../helpers/logger'
|
||||||
import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
|
|
||||||
import { getFormattedObjects } from '../../../helpers/utils'
|
import { getFormattedObjects } from '../../../helpers/utils'
|
||||||
import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist'
|
import { CONFIG } from '../../../initializers/config'
|
||||||
import {
|
import {
|
||||||
DEFAULT_AUDIO_RESOLUTION,
|
DEFAULT_AUDIO_RESOLUTION,
|
||||||
MIMETYPES,
|
MIMETYPES,
|
||||||
|
@ -14,9 +27,15 @@ import {
|
||||||
VIDEO_LICENCES,
|
VIDEO_LICENCES,
|
||||||
VIDEO_PRIVACIES
|
VIDEO_PRIVACIES
|
||||||
} from '../../../initializers/constants'
|
} from '../../../initializers/constants'
|
||||||
|
import { sequelizeTypescript } from '../../../initializers/database'
|
||||||
|
import { sendView } from '../../../lib/activitypub/send/send-view'
|
||||||
import { federateVideoIfNeeded, fetchRemoteVideoDescription } from '../../../lib/activitypub/videos'
|
import { federateVideoIfNeeded, fetchRemoteVideoDescription } from '../../../lib/activitypub/videos'
|
||||||
import { JobQueue } from '../../../lib/job-queue'
|
import { JobQueue } from '../../../lib/job-queue'
|
||||||
|
import { Notifier } from '../../../lib/notifier'
|
||||||
|
import { Hooks } from '../../../lib/plugins/hooks'
|
||||||
import { Redis } from '../../../lib/redis'
|
import { Redis } from '../../../lib/redis'
|
||||||
|
import { createVideoMiniatureFromExisting, generateVideoMiniature } from '../../../lib/thumbnail'
|
||||||
|
import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist'
|
||||||
import {
|
import {
|
||||||
asyncMiddleware,
|
asyncMiddleware,
|
||||||
asyncRetryTransactionMiddleware,
|
asyncRetryTransactionMiddleware,
|
||||||
|
@ -26,7 +45,7 @@ import {
|
||||||
optionalAuthenticate,
|
optionalAuthenticate,
|
||||||
paginationValidator,
|
paginationValidator,
|
||||||
setDefaultPagination,
|
setDefaultPagination,
|
||||||
setDefaultSort,
|
setDefaultVideosSort,
|
||||||
videoFileMetadataGetValidator,
|
videoFileMetadataGetValidator,
|
||||||
videosAddValidator,
|
videosAddValidator,
|
||||||
videosCustomGetValidator,
|
videosCustomGetValidator,
|
||||||
|
@ -35,37 +54,18 @@ import {
|
||||||
videosSortValidator,
|
videosSortValidator,
|
||||||
videosUpdateValidator
|
videosUpdateValidator
|
||||||
} from '../../../middlewares'
|
} from '../../../middlewares'
|
||||||
|
import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'
|
||||||
import { TagModel } from '../../../models/video/tag'
|
import { TagModel } from '../../../models/video/tag'
|
||||||
import { VideoModel } from '../../../models/video/video'
|
import { VideoModel } from '../../../models/video/video'
|
||||||
import { VideoFileModel } from '../../../models/video/video-file'
|
import { VideoFileModel } from '../../../models/video/video-file'
|
||||||
import { abuseVideoRouter } from './abuse'
|
import { abuseVideoRouter } from './abuse'
|
||||||
import { blacklistRouter } from './blacklist'
|
import { blacklistRouter } from './blacklist'
|
||||||
import { videoCommentRouter } from './comment'
|
|
||||||
import { rateVideoRouter } from './rate'
|
|
||||||
import { ownershipVideoRouter } from './ownership'
|
|
||||||
import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
|
|
||||||
import { buildNSFWFilter, createReqFiles, getCountVideos } from '../../../helpers/express-utils'
|
|
||||||
import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'
|
|
||||||
import { videoCaptionsRouter } from './captions'
|
import { videoCaptionsRouter } from './captions'
|
||||||
|
import { videoCommentRouter } from './comment'
|
||||||
import { videoImportsRouter } from './import'
|
import { videoImportsRouter } from './import'
|
||||||
import { resetSequelizeInstance } from '../../../helpers/database-utils'
|
import { ownershipVideoRouter } from './ownership'
|
||||||
import { move } from 'fs-extra'
|
import { rateVideoRouter } from './rate'
|
||||||
import { watchingRouter } from './watching'
|
import { watchingRouter } from './watching'
|
||||||
import { Notifier } from '../../../lib/notifier'
|
|
||||||
import { sendView } from '../../../lib/activitypub/send/send-view'
|
|
||||||
import { CONFIG } from '../../../initializers/config'
|
|
||||||
import { sequelizeTypescript } from '../../../initializers/database'
|
|
||||||
import { createVideoMiniatureFromExisting, generateVideoMiniature } from '../../../lib/thumbnail'
|
|
||||||
import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type'
|
|
||||||
import { Hooks } from '../../../lib/plugins/hooks'
|
|
||||||
import { MVideoDetails, MVideoFullLight } from '@server/types/models'
|
|
||||||
import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
|
|
||||||
import { getVideoFilePath } from '@server/lib/video-paths'
|
|
||||||
import toInt from 'validator/lib/toInt'
|
|
||||||
import { addOptimizeOrMergeAudioJob } from '@server/helpers/video'
|
|
||||||
import { getServerActor } from '@server/models/application/application'
|
|
||||||
import { changeVideoChannelShare } from '@server/lib/activitypub/share'
|
|
||||||
import { getVideoActivityPubUrl } from '@server/lib/activitypub/url'
|
|
||||||
|
|
||||||
const auditLogger = auditLoggerFactory('videos')
|
const auditLogger = auditLoggerFactory('videos')
|
||||||
const videosRouter = express.Router()
|
const videosRouter = express.Router()
|
||||||
|
@ -105,7 +105,7 @@ videosRouter.get('/privacies', listVideoPrivacies)
|
||||||
videosRouter.get('/',
|
videosRouter.get('/',
|
||||||
paginationValidator,
|
paginationValidator,
|
||||||
videosSortValidator,
|
videosSortValidator,
|
||||||
setDefaultSort,
|
setDefaultVideosSort,
|
||||||
setDefaultPagination,
|
setDefaultPagination,
|
||||||
optionalAuthenticate,
|
optionalAuthenticate,
|
||||||
commonVideosFiltersValidator,
|
commonVideosFiltersValidator,
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
import * as express from 'express'
|
import * as express from 'express'
|
||||||
|
import * as Feed from 'pfeed'
|
||||||
|
import { buildNSFWFilter } from '../helpers/express-utils'
|
||||||
|
import { CONFIG } from '../initializers/config'
|
||||||
import { FEEDS, ROUTE_CACHE_LIFETIME, THUMBNAILS_SIZE, WEBSERVER } from '../initializers/constants'
|
import { FEEDS, ROUTE_CACHE_LIFETIME, THUMBNAILS_SIZE, WEBSERVER } from '../initializers/constants'
|
||||||
import {
|
import {
|
||||||
asyncMiddleware,
|
asyncMiddleware,
|
||||||
commonVideosFiltersValidator,
|
commonVideosFiltersValidator,
|
||||||
setDefaultSort,
|
feedsFormatValidator,
|
||||||
|
setDefaultVideosSort,
|
||||||
|
setFeedFormatContentType,
|
||||||
videoCommentsFeedsValidator,
|
videoCommentsFeedsValidator,
|
||||||
videoFeedsValidator,
|
videoFeedsValidator,
|
||||||
videosSortValidator,
|
videosSortValidator
|
||||||
feedsFormatValidator,
|
|
||||||
setFeedFormatContentType
|
|
||||||
} from '../middlewares'
|
} from '../middlewares'
|
||||||
import { VideoModel } from '../models/video/video'
|
|
||||||
import * as Feed from 'pfeed'
|
|
||||||
import { cacheRoute } from '../middlewares/cache'
|
import { cacheRoute } from '../middlewares/cache'
|
||||||
|
import { VideoModel } from '../models/video/video'
|
||||||
import { VideoCommentModel } from '../models/video/video-comment'
|
import { VideoCommentModel } from '../models/video/video-comment'
|
||||||
import { buildNSFWFilter } from '../helpers/express-utils'
|
|
||||||
import { CONFIG } from '../initializers/config'
|
|
||||||
|
|
||||||
const feedsRouter = express.Router()
|
const feedsRouter = express.Router()
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ feedsRouter.get('/feeds/video-comments.:format',
|
||||||
|
|
||||||
feedsRouter.get('/feeds/videos.:format',
|
feedsRouter.get('/feeds/videos.:format',
|
||||||
videosSortValidator,
|
videosSortValidator,
|
||||||
setDefaultSort,
|
setDefaultVideosSort,
|
||||||
feedsFormatValidator,
|
feedsFormatValidator,
|
||||||
setFeedFormatContentType,
|
setFeedFormatContentType,
|
||||||
asyncMiddleware(cacheRoute({
|
asyncMiddleware(cacheRoute({
|
||||||
|
|
|
@ -2,6 +2,7 @@ import * as express from 'express'
|
||||||
import { SortType } from '../models/utils'
|
import { SortType } from '../models/utils'
|
||||||
|
|
||||||
const setDefaultSort = setDefaultSortFactory('-createdAt')
|
const setDefaultSort = setDefaultSortFactory('-createdAt')
|
||||||
|
const setDefaultVideosSort = setDefaultSortFactory('-publishedAt')
|
||||||
|
|
||||||
const setDefaultVideoRedundanciesSort = setDefaultSortFactory('name')
|
const setDefaultVideoRedundanciesSort = setDefaultSortFactory('name')
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ function setBlacklistSort (req: express.Request, res: express.Response, next: ex
|
||||||
export {
|
export {
|
||||||
setDefaultSort,
|
setDefaultSort,
|
||||||
setDefaultSearchSort,
|
setDefaultSearchSort,
|
||||||
|
setDefaultVideosSort,
|
||||||
setDefaultVideoRedundanciesSort,
|
setDefaultVideoRedundanciesSort,
|
||||||
setBlacklistSort
|
setBlacklistSort
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue