Move visit to only happen on index

This commit is contained in:
collin 2025-09-02 16:56:06 +02:00
parent 337d4cf9a1
commit 9dab909103
No known key found for this signature in database

View file

@ -154,16 +154,16 @@ func SetupAuth() {
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
fmt.Printf("%s - [%s] (%s) %s\n", time.Now().Format(time.RFC3339), r.RemoteAddr, r.Method, r.URL) fmt.Printf("%s - [%s] (%s) %s\n", time.Now().Format(time.RFC3339), r.RemoteAddr, r.Method, r.URL)
visit := h.visits.HandleVisit(r.RemoteAddr)
if visit != nil {
h.ntfy.PublishNewVisitNotification(visit)
}
switch true { switch true {
case r.Method == "GET" && r.URL.Path == "/favicon.ico": case r.Method == "GET" && r.URL.Path == "/favicon.ico":
getStaticFile("./client/favicon.ico", "image/png", w) getStaticFile("./client/favicon.ico", "image/png", w)
case r.Method == "GET" && r.URL.Path == "/": case r.Method == "GET" && r.URL.Path == "/":
visit := h.visits.HandleVisit(r.RemoteAddr)
if visit != nil {
h.ntfy.PublishNewVisitNotification(visit)
}
getStaticFile("./client/index.html", "text/html", w) getStaticFile("./client/index.html", "text/html", w)
case r.Method == "GET" && r.URL.Path == "/rsvp": case r.Method == "GET" && r.URL.Path == "/rsvp":