aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/search/search-videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/search/search-videos.ts')
-rw-r--r--server/controllers/api/search/search-videos.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/server/controllers/api/search/search-videos.ts b/server/controllers/api/search/search-videos.ts
index 90946cb74..6db70acdf 100644
--- a/server/controllers/api/search/search-videos.ts
+++ b/server/controllers/api/search/search-videos.ts
@@ -7,6 +7,8 @@ import { WEBSERVER } from '@server/initializers/constants'
7import { getOrCreateAPVideo } from '@server/lib/activitypub/videos' 7import { getOrCreateAPVideo } from '@server/lib/activitypub/videos'
8import { Hooks } from '@server/lib/plugins/hooks' 8import { Hooks } from '@server/lib/plugins/hooks'
9import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' 9import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'
10import { getServerActor } from '@server/models/application/application'
11import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils'
10import { HttpStatusCode, ResultList, Video } from '@shared/models' 12import { HttpStatusCode, ResultList, Video } from '@shared/models'
11import { VideosSearchQueryAfterSanitize } from '../../../../shared/models/search' 13import { VideosSearchQueryAfterSanitize } from '../../../../shared/models/search'
12import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils' 14import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils'
@@ -100,11 +102,15 @@ async function searchVideosIndex (query: VideosSearchQueryAfterSanitize, res: ex
100} 102}
101 103
102async function searchVideosDB (query: VideosSearchQueryAfterSanitize, res: express.Response) { 104async function searchVideosDB (query: VideosSearchQueryAfterSanitize, res: express.Response) {
105 const serverActor = await getServerActor()
106
103 const apiOptions = await Hooks.wrapObject({ 107 const apiOptions = await Hooks.wrapObject({
104 ...query, 108 ...query,
105 109
106 includeLocalVideos: true, 110 displayOnlyForFollower: {
107 filter: query.filter, 111 actorId: serverActor.id,
112 orLocalVideos: true
113 },
108 114
109 nsfw: buildNSFWFilter(res, query.nsfw), 115 nsfw: buildNSFWFilter(res, query.nsfw),
110 user: res.locals.oauth 116 user: res.locals.oauth
@@ -118,7 +124,7 @@ async function searchVideosDB (query: VideosSearchQueryAfterSanitize, res: expre
118 'filter:api.search.videos.local.list.result' 124 'filter:api.search.videos.local.list.result'
119 ) 125 )
120 126
121 return res.json(getFormattedObjects(resultList.data, resultList.total)) 127 return res.json(getFormattedObjects(resultList.data, resultList.total, guessAdditionalAttributesFromQuery(query)))
122} 128}
123 129
124async function searchVideoURI (url: string, res: express.Response) { 130async function searchVideoURI (url: string, res: express.Response) {