Verify token before querying index

This commit is contained in:
2025-03-01 09:02:31 +01:00
parent d6c58cf532
commit 30c35f2112
2 changed files with 6 additions and 2 deletions

View File

@ -111,8 +111,12 @@ func ServeClicks(db *b.DB) http.HandlerFunc {
}
}
func QueryArticles(i *b.Index) http.HandlerFunc {
func QueryArticles(c *b.Config, i *b.Index) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if !tokenIsVerified(w, r, c) {
return
}
result, err := i.Query(r.PathValue("query"))
if err != nil {
log.Println(err)