This commit is contained in:
partisan 2024-10-14 22:15:38 +02:00
parent 3d47c80446
commit 49f613ddeb
15 changed files with 98 additions and 234 deletions

View file

@ -7,6 +7,7 @@ import (
"html/template"
"net/http"
"strings"
"time"
)
var (
@ -26,8 +27,14 @@ var (
return string(jsonBytes), nil
},
}
searchEngines []SearchEngine
)
type SearchEngine struct {
Name string
Func func(string, string, string, int) ([]SearchResult, time.Duration, error)
}
// Helper function to render templates without elapsed time measurement
func renderTemplate(w http.ResponseWriter, tmplName string, data map[string]interface{}) {
// Parse the template with common functions (including translate)