updated logging, added theming, added settings button
This commit is contained in:
parent
51b2ef43bc
commit
ca15fb7ec5
25 changed files with 384 additions and 62 deletions
8
map.go
8
map.go
|
@ -4,7 +4,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
@ -44,11 +43,11 @@ func geocodeQuery(query string) (latitude, longitude string, found bool, err err
|
|||
return "", "", false, nil
|
||||
}
|
||||
|
||||
func handleMapSearch(w http.ResponseWriter, query string, lang string) {
|
||||
func handleMapSearch(w http.ResponseWriter, settings UserSettings, query string, lang string) {
|
||||
// Geocode the query to get coordinates
|
||||
latitude, longitude, found, err := geocodeQuery(query)
|
||||
if err != nil {
|
||||
log.Printf("Error geocoding query: %s, error: %v", query, err)
|
||||
printDebug("Error geocoding query: %s, error: %v", query, err)
|
||||
http.Error(w, "Failed to find location", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
@ -59,11 +58,12 @@ func handleMapSearch(w http.ResponseWriter, query string, lang string) {
|
|||
"Latitude": latitude,
|
||||
"Longitude": longitude,
|
||||
"Found": found,
|
||||
"Theme": settings.Theme,
|
||||
}
|
||||
|
||||
tmpl, err := template.ParseFiles("templates/map.html")
|
||||
if err != nil {
|
||||
log.Printf("Error loading map template: %v", err)
|
||||
printErr("Error loading map template: %v", err)
|
||||
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue