check / check (push) Waiting to run
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. Both links to the event log page, and its title and heading, now read "Full Event Log". Go identifiers and template file names are unchanged. Route tests follow every link and submit every form the templates render to a moved page, through the production router, with the link, form action and token taken from the rendered page. Model: opus-5-5
22 lines
565 B
Go
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)
|
|
}
|
|
}
|