aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-10-10 11:46:50 +0200
committerChocobozzz <me@florianbigard.com>2018-10-10 11:46:50 +0200
commit1cd3facc3de899ac864e979cd6d6a704b712cce3 (patch)
tree7a781918d6bf1426ec76cc18390922f65971a278 /server/controllers
parentb014b6b9c7cb68d09c52b44046afe486c0736426 (diff)
downloadPeerTube-1cd3facc3de899ac864e979cd6d6a704b712cce3.tar.gz
PeerTube-1cd3facc3de899ac864e979cd6d6a704b712cce3.tar.zst
PeerTube-1cd3facc3de899ac864e979cd6d6a704b712cce3.zip
Add ability to list all local videos
Including private/unlisted for moderators/admins
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/accounts.ts4
-rw-r--r--server/controllers/api/search.ts1
-rw-r--r--server/controllers/api/video-channel.ts4
-rw-r--r--server/controllers/feeds.ts10
4 files changed, 16 insertions, 3 deletions
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts
index b7691ccba..8e3f60010 100644
--- a/server/controllers/api/accounts.ts
+++ b/server/controllers/api/accounts.ts
@@ -86,9 +86,11 @@ async function listAccountVideos (req: express.Request, res: express.Response, n
86 languageOneOf: req.query.languageOneOf, 86 languageOneOf: req.query.languageOneOf,
87 tagsOneOf: req.query.tagsOneOf, 87 tagsOneOf: req.query.tagsOneOf,
88 tagsAllOf: req.query.tagsAllOf, 88 tagsAllOf: req.query.tagsAllOf,
89 filter: req.query.filter,
89 nsfw: buildNSFWFilter(res, req.query.nsfw), 90 nsfw: buildNSFWFilter(res, req.query.nsfw),
90 withFiles: false, 91 withFiles: false,
91 accountId: account.id 92 accountId: account.id,
93 userId: res.locals.oauth ? res.locals.oauth.token.User.id : undefined
92 }) 94 })
93 95
94 return res.json(getFormattedObjects(resultList.data, resultList.total)) 96 return res.json(getFormattedObjects(resultList.data, resultList.total))
diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts
index 4be2b5ef7..a8a6cfb08 100644
--- a/server/controllers/api/search.ts
+++ b/server/controllers/api/search.ts
@@ -118,6 +118,7 @@ async function searchVideosDB (query: VideosSearchQuery, res: express.Response)
118 const options = Object.assign(query, { 118 const options = Object.assign(query, {
119 includeLocalVideos: true, 119 includeLocalVideos: true,
120 nsfw: buildNSFWFilter(res, query.nsfw), 120 nsfw: buildNSFWFilter(res, query.nsfw),
121 filter: query.filter,
121 userId: res.locals.oauth ? res.locals.oauth.token.User.id : undefined 122 userId: res.locals.oauth ? res.locals.oauth.token.User.id : undefined
122 }) 123 })
123 const resultList = await VideoModel.searchAndPopulateAccountAndServer(options) 124 const resultList = await VideoModel.searchAndPopulateAccountAndServer(options)
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts
index 1fa842d9c..c84d1be58 100644
--- a/server/controllers/api/video-channel.ts
+++ b/server/controllers/api/video-channel.ts
@@ -215,9 +215,11 @@ async function listVideoChannelVideos (req: express.Request, res: express.Respon
215 languageOneOf: req.query.languageOneOf, 215 languageOneOf: req.query.languageOneOf,
216 tagsOneOf: req.query.tagsOneOf, 216 tagsOneOf: req.query.tagsOneOf,
217 tagsAllOf: req.query.tagsAllOf, 217 tagsAllOf: req.query.tagsAllOf,
218 filter: req.query.filter,
218 nsfw: buildNSFWFilter(res, req.query.nsfw), 219 nsfw: buildNSFWFilter(res, req.query.nsfw),
219 withFiles: false, 220 withFiles: false,
220 videoChannelId: videoChannelInstance.id 221 videoChannelId: videoChannelInstance.id,
222 userId: res.locals.oauth ? res.locals.oauth.token.User.id : undefined
221 }) 223 })
222 224
223 return res.json(getFormattedObjects(resultList.data, resultList.total)) 225 return res.json(getFormattedObjects(resultList.data, resultList.total))
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts
index b30ad8e8d..ccb9b6029 100644
--- a/server/controllers/feeds.ts
+++ b/server/controllers/feeds.ts
@@ -1,7 +1,14 @@
1import * as express from 'express' 1import * as express from 'express'
2import { CONFIG, FEEDS, ROUTE_CACHE_LIFETIME } from '../initializers/constants' 2import { CONFIG, FEEDS, ROUTE_CACHE_LIFETIME } from '../initializers/constants'
3import { THUMBNAILS_SIZE } from '../initializers' 3import { THUMBNAILS_SIZE } from '../initializers'
4import { asyncMiddleware, setDefaultSort, videoCommentsFeedsValidator, videoFeedsValidator, videosSortValidator } from '../middlewares' 4import {
5 asyncMiddleware,
6 commonVideosFiltersValidator,
7 setDefaultSort,
8 videoCommentsFeedsValidator,
9 videoFeedsValidator,
10 videosSortValidator
11} from '../middlewares'
5import { VideoModel } from '../models/video/video' 12import { VideoModel } from '../models/video/video'
6import * as Feed from 'pfeed' 13import * as Feed from 'pfeed'
7import { AccountModel } from '../models/account/account' 14import { AccountModel } from '../models/account/account'
@@ -22,6 +29,7 @@ feedsRouter.get('/feeds/videos.:format',
22 videosSortValidator, 29 videosSortValidator,
23 setDefaultSort, 30 setDefaultSort,
24 asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.FEEDS)), 31 asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.FEEDS)),
32 commonVideosFiltersValidator,
25 asyncMiddleware(videoFeedsValidator), 33 asyncMiddleware(videoFeedsValidator),
26 asyncMiddleware(generateVideoFeed) 34 asyncMiddleware(generateVideoFeed)
27) 35)