Use default nsfw instance policy for search index

This commit is contained in:
Chocobozzz 2020-06-12 16:24:58 +02:00
parent 5a61ffbb7c
commit 1a40132c67
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 39 additions and 1 deletions

View file

@ -169,7 +169,14 @@ async function searchVideosIndex (query: VideosSearchQuery, res: express.Respons
const result = await buildMutedForSearchIndex(res)
const body = Object.assign(query, result)
const body: VideosSearchQuery = Object.assign(query, result)
// Use the default instance NSFW policy if not specified
if (!body.nsfw) {
body.nsfw = CONFIG.INSTANCE.DEFAULT_NSFW_POLICY === 'do_not_list'
? 'false'
: 'both'
}
const url = sanitizeUrl(CONFIG.SEARCH.SEARCH_INDEX.URL) + '/api/v1/search/videos'