feat: update source files, Dockerfile, vite config and service worker
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import logger from "../../debugConfig"
|
||||
|
||||
interface SearXNGResult {
|
||||
title?: string
|
||||
url?: string
|
||||
@@ -26,19 +28,25 @@ export class SearchService {
|
||||
engines: 'google,bing,duckduckgo',
|
||||
})
|
||||
|
||||
const url = `${import.meta.env.VITE_FRONTEND_SITE_URL}/searxng-api/search?${searchParams.toString()}`
|
||||
const url = `/searxng-api/search?${searchParams.toString()}`
|
||||
logger.debug('search-service', "Search URL: ", url)
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
})
|
||||
logger.debug('search-service', "Search response: ", response)
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Search failed with status: ${response.status}`)
|
||||
}
|
||||
|
||||
|
||||
const data = await response.json()
|
||||
|
||||
logger.debug('search-service', "Search data: ", data)
|
||||
|
||||
return (data.results || []).map((result: SearXNGResult) => ({
|
||||
title: result.title || '',
|
||||
url: result.url || '',
|
||||
|
||||
Reference in New Issue
Block a user