scan-flow: geolocation scan, location-aware SMS throttle (log sender), finder contact, sms_enabled toggle, branding — 19/19 phase-2 scenarios pass

This commit is contained in:
2026-08-05 18:23:34 +10:00
parent 4666751e92
commit c2fa04afd0
26 changed files with 698 additions and 43 deletions

View File

@@ -12,6 +12,7 @@ import (
"wherewoof/frontend/internal/auth"
"wherewoof/frontend/internal/db"
"wherewoof/frontend/internal/handlers"
"wherewoof/frontend/internal/sms"
)
func main() {
@@ -42,13 +43,21 @@ func main() {
log.Fatal("templates:", err)
}
app := handlers.New(db.New(pool), tpl)
// SMS sender: log-only unless real SMSGlobal credentials are configured.
var sender sms.Sender = sms.LogSender{}
if key := os.Getenv("SMS_API_KEY"); key != "" {
sender = sms.New(key, os.Getenv("SMS_API_SECRET"), os.Getenv("SMS_FROM"))
}
app := handlers.New(db.New(pool), tpl, sender)
mux := http.NewServeMux()
mux.Handle("GET /static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
mux.HandleFunc("GET /{$}", app.Home)
mux.HandleFunc("/{path...}", http.NotFound)
mux.HandleFunc("GET /t/{tag_code}", app.PublicTag)
mux.HandleFunc("POST /t/{tag_code}/scan", app.Scan)
mux.HandleFunc("POST /t/{tag_code}/contact", app.FinderContact)
mux.HandleFunc("GET /register", app.RegisterPage)
mux.HandleFunc("POST /register", app.Register)
mux.HandleFunc("GET /login", app.LoginPage)