feat: Add preferences parameter to /searxng endpoint
Added paramater and handles it in the query parameters.
This commit is contained in:
parent
a3ca407b27
commit
f880c68968
|
@ -160,7 +160,7 @@ router.post('/transcript', jsonParser, async (request, response) => {
|
|||
|
||||
router.post('/searxng', jsonParser, async (request, response) => {
|
||||
try {
|
||||
const { baseUrl, query } = request.body;
|
||||
const { baseUrl, query, preferences } = request.body;
|
||||
|
||||
if (!baseUrl || !query) {
|
||||
console.log('Missing required parameters for /searxng');
|
||||
|
@ -188,6 +188,9 @@ router.post('/searxng', jsonParser, async (request, response) => {
|
|||
const searchUrl = new URL('/search', baseUrl);
|
||||
const searchParams = new URLSearchParams();
|
||||
searchParams.append('q', query);
|
||||
if (preferences.length > 0) {
|
||||
searchParams.append('preferences', preferences);
|
||||
}
|
||||
searchUrl.search = searchParams.toString();
|
||||
|
||||
const searchResult = await fetch(searchUrl, { headers: visitHeaders });
|
||||
|
|
Loading…
Reference in New Issue