diff options
Diffstat (limited to 'server/controllers/api/search')
-rw-r--r-- | server/controllers/api/search/search-videos.ts | 12 |
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' | |||
7 | import { getOrCreateAPVideo } from '@server/lib/activitypub/videos' | 7 | import { getOrCreateAPVideo } from '@server/lib/activitypub/videos' |
8 | import { Hooks } from '@server/lib/plugins/hooks' | 8 | import { Hooks } from '@server/lib/plugins/hooks' |
9 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' | 9 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' |
10 | import { getServerActor } from '@server/models/application/application' | ||
11 | import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils' | ||
10 | import { HttpStatusCode, ResultList, Video } from '@shared/models' | 12 | import { HttpStatusCode, ResultList, Video } from '@shared/models' |
11 | import { VideosSearchQueryAfterSanitize } from '../../../../shared/models/search' | 13 | import { VideosSearchQueryAfterSanitize } from '../../../../shared/models/search' |
12 | import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils' | 14 | import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils' |
@@ -100,11 +102,15 @@ async function searchVideosIndex (query: VideosSearchQueryAfterSanitize, res: ex | |||
100 | } | 102 | } |
101 | 103 | ||
102 | async function searchVideosDB (query: VideosSearchQueryAfterSanitize, res: express.Response) { | 104 | async 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 | ||
124 | async function searchVideoURI (url: string, res: express.Response) { | 130 | async function searchVideoURI (url: string, res: express.Response) { |