diff options
author | Chocobozzz <me@florianbigard.com> | 2020-06-12 16:24:58 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-06-12 16:27:41 +0200 |
commit | 1a40132c67e50c94a7bd3f6b63c075f471b3d6cc (patch) | |
tree | 95e4c4c36fcff9eab74648dd3bfb0f33dae9e0e9 /server/controllers/api/search.ts | |
parent | 5a61ffbb7c72dd7ecfa16c7944dac45411c1bbe9 (diff) | |
download | PeerTube-1a40132c67e50c94a7bd3f6b63c075f471b3d6cc.tar.gz PeerTube-1a40132c67e50c94a7bd3f6b63c075f471b3d6cc.tar.zst PeerTube-1a40132c67e50c94a7bd3f6b63c075f471b3d6cc.zip |
Use default nsfw instance policy for search index
Diffstat (limited to 'server/controllers/api/search.ts')
-rw-r--r-- | server/controllers/api/search.ts | 9 |
1 files changed, 8 insertions, 1 deletions
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 | |||
169 | 169 | ||
170 | const result = await buildMutedForSearchIndex(res) | 170 | const result = await buildMutedForSearchIndex(res) |
171 | 171 | ||
172 | const body = Object.assign(query, result) | 172 | const body: VideosSearchQuery = Object.assign(query, result) |
173 | |||
174 | // Use the default instance NSFW policy if not specified | ||
175 | if (!body.nsfw) { | ||
176 | body.nsfw = CONFIG.INSTANCE.DEFAULT_NSFW_POLICY === 'do_not_list' | ||
177 | ? 'false' | ||
178 | : 'both' | ||
179 | } | ||
173 | 180 | ||
174 | const url = sanitizeUrl(CONFIG.SEARCH.SEARCH_INDEX.URL) + '/api/v1/search/videos' | 181 | const url = sanitizeUrl(CONFIG.SEARCH.SEARCH_INDEX.URL) + '/api/v1/search/videos' |
175 | 182 | ||