From 9dab90910314f7db25fd1ae5671ac186eb9a0518 Mon Sep 17 00:00:00 2001 From: collin Date: Tue, 2 Sep 2025 16:56:06 +0200 Subject: [PATCH] Move visit to only happen on index --- controller.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/controller.go b/controller.go index 95293c8..2b6eb67 100644 --- a/controller.go +++ b/controller.go @@ -154,16 +154,16 @@ func SetupAuth() { 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) - visit := h.visits.HandleVisit(r.RemoteAddr) - if visit != nil { - h.ntfy.PublishNewVisitNotification(visit) - } switch true { case r.Method == "GET" && r.URL.Path == "/favicon.ico": getStaticFile("./client/favicon.ico", "image/png", w) 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) case r.Method == "GET" && r.URL.Path == "/rsvp":