summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorsiddharth ravikumar <s@ricketyspace.net>2022-06-12 19:57:22 -0400
committersiddharth ravikumar <s@ricketyspace.net>2022-06-12 19:57:22 -0400
commit276b82f0d49d52ca02a7a51f7acb27b8cbc8381b (patch)
tree42f3a06649449680fe3fe95b58958713da61c862 /main.go
parent2f14203efe0514cd4b64085efe9cc5980a276983 (diff)
search: update `Search`
Add `Enabled`. Determines whether search is enabled or not.
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/main.go b/main.go
index e328636..9e1a6f7 100644
--- a/main.go
+++ b/main.go
@@ -13,7 +13,6 @@ import (
"regexp"
"strconv"
- "ricketyspace.net/peach/photon"
"ricketyspace.net/peach/search"
"ricketyspace.net/peach/version"
"ricketyspace.net/peach/weather"
@@ -102,15 +101,13 @@ func showWeather(w http.ResponseWriter, lat, lng float32) {
func showSearch(w http.ResponseWriter, r *http.Request) {
logRequest(r)
- // Search is disabled if photon is not enabled.
- if !photon.Enabled() {
+ search, err, status := search.NewSearch(r)
+ if err != nil && status == 404 {
http.NotFound(w, r)
return
}
-
- search, err := search.NewSearch(r)
if err != nil {
- http.Error(w, err.Error(), 500)
+ http.Error(w, err.Error(), status)
return
}
err = peachTemplates.ExecuteTemplate(w, "search.tmpl", search)