From 1a40132c67e50c94a7bd3f6b63c075f471b3d6cc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 12 Jun 2020 16:24:58 +0200 Subject: Use default nsfw instance policy for search index --- server/controllers/api/search.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'server/controllers') diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts index 1dea77d29..e35a7346e 100644 --- a/server/controllers/api/search.ts +++ b/server/controllers/api/search.ts @@ -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' -- cgit v1.2.3