Files
webhooker/internal/handlers/index.go
T
clawbot cf795ff5df
check / check (push) Successful in 4m23s
Move webhook pages to /hook/ID and inbound URLs to /h/UUID (closes #367)
The webhook page and everything under it move from /source/ID to
/hook/ID, the list and new-webhook form to /hooks and /hooks/new, and
the event log from .../logs to /hook/ID/events, body download
included. Entrypoint URLs move from /webhook/UUID to /h/UUID, and the
webhook page shows only that form. The old paths are gone.

Links, redirects, form actions, tests, comments and the README follow.
Go identifiers and template file names are unchanged. A new route test
posts to the entrypoint URL the webhook page shows and checks that the
receiver rate limit applies to it.

Model: opus-5-5
2026-10-01 19:13:32 +00:00

22 lines
565 B
Go

package handlers
import (
"net/http"
)
// HandleIndex returns a handler for the root path that redirects
// based on authentication state: authenticated users go to /hooks
// (the dashboard), unauthenticated users go to the login page.
func (s *Handlers) HandleIndex() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
sess, err := s.session.Get(r)
if err == nil && s.session.IsAuthenticated(sess) {
http.Redirect(w, r, "/hooks", http.StatusSeeOther)
return
}
http.Redirect(w, r, "/pages/login", http.StatusSeeOther)
}
}