added imgur + some cleanup

This commit is contained in:
partisan 2024-06-10 11:49:40 +02:00
parent 12b32b6600
commit b3eb7e39ea
8 changed files with 324 additions and 127 deletions

10
text.go
View file

@ -11,7 +11,6 @@ import (
)
var (
debugMode bool
searchEngines []searchEngine
searchEngineLock sync.Mutex
)
@ -23,8 +22,6 @@ type searchEngine struct {
}
func init() {
debugMode = false
searchEngines = []searchEngine{
{Name: "Google", Func: PerformGoogleTextSearch, Weight: 1},
{Name: "LibreX", Func: PerformLibreXTextSearch, Weight: 2},
@ -138,13 +135,6 @@ func selectSearchEngine() searchEngine {
return searchEngines[0] // fallback to the first engine
}
func max(a, b int) int {
if a > b {
return a
}
return b
}
func displayResults(w http.ResponseWriter, results []TextSearchResult, query, lang string, elapsed float64, page int, hasPrevPage, hasNextPage bool) {
log.Printf("Displaying results for page %d", page)
log.Printf("Total results: %d", len(results))