From c069ad02ceb0e94648b5c4702945b348a6bd06db Mon Sep 17 00:00:00 2001 From: Teajey <21069848+Teajey@users.noreply.github.com> Date: Wed, 18 Nov 2026 23:20:09 +0900 Subject: [PATCH] Update to rsvp v1.21.1 --- http/go.mod | 2 +- http/go.sum | 2 ++ http/mux/private.go | 4 ++-- http/routing/login.go | 5 +++-- http/templates/base.gotmpl | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/http/go.mod b/http/go.mod index 092397b..c32fc5c 100644 --- a/http/go.mod +++ b/http/go.mod @@ -3,7 +3,7 @@ module lishwist/http go 1.25.5 require ( - github.com/Teajey/rsvp v0.19.0-rc.2 + github.com/Teajey/rsvp v0.21.1 github.com/gorilla/sessions v1.4.0 golang.org/x/crypto v0.39.0 ) diff --git a/http/go.sum b/http/go.sum index 1db2e8e..e665ad0 100644 --- a/http/go.sum +++ b/http/go.sum @@ -2,6 +2,8 @@ github.com/Teajey/hmc v0.6.0-rc.12 h1:Vkx6mJa3pfMlYx4vyI9LfVLHa8fNyl8LikMvXBfDGZ github.com/Teajey/hmc v0.6.0-rc.12/go.mod h1:9K7SL4RyybNLHooqsZcyFoL6QGqqa2zPgIBidw4qWQY= github.com/Teajey/rsvp v0.19.0-rc.2 h1:h4V7c3uGlSKajkWKt3fldFV+XTMEI8A4o05PMY8xv9A= github.com/Teajey/rsvp v0.19.0-rc.2/go.mod h1:z0L20VphVg+Ec2+hnpLFTG2MZTrWYFprav1kpxDba0Q= +github.com/Teajey/rsvp v0.21.1 h1:qDo0VHvatOKFG6oqsq3daPOq0TU9pjicdz5mwxwGMO4= +github.com/Teajey/rsvp v0.21.1/go.mod h1:z0L20VphVg+Ec2+hnpLFTG2MZTrWYFprav1kpxDba0Q= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= diff --git a/http/mux/private.go b/http/mux/private.go index 173af81..1262348 100644 --- a/http/mux/private.go +++ b/http/mux/private.go @@ -85,9 +85,9 @@ func (m *Private) handleWithSession(pattern string, next handler.PublicFunc) { r: r, } - err := rsvp.Write(rw, m.rsvp, r, func(w rsvp.ResponseWriter, r *http.Request) rsvp.Body { + err := rsvp.Write(rw, r, m.rsvp, rsvp.HandlerFunc(func(w rsvp.ResponseWriter, r *http.Request) rsvp.Body { return next(s, w, r) - }) + })) if err != nil { log.Printf("rsvp failed to write a response: %s", err) } diff --git a/http/routing/login.go b/http/routing/login.go index 55b0167..9b4494b 100644 --- a/http/routing/login.go +++ b/http/routing/login.go @@ -1,6 +1,7 @@ package routing import ( + "cmp" "errors" "log" "net/http" @@ -103,10 +104,10 @@ func LoginPost(session *session.Session, w rsvp.ResponseWriter, r *http.Request) login := LoginMiddle(username, password, session, r) if login != nil { page.Form.Elements = *login - return rsvp.Data(page).StatusSeeOther("") + return rsvp.Data(page).StatusSeeOther(".") } referrer := r.URL.Query().Get("referrer") - return rsvp.Data("Login successful!").StatusSeeOther(referrer) + return rsvp.Data("Login successful!").StatusSeeOther(cmp.Or(referrer, ".")) } diff --git a/http/templates/base.gotmpl b/http/templates/base.gotmpl index 03ca82d..f2814a6 100644 --- a/http/templates/base.gotmpl +++ b/http/templates/base.gotmpl @@ -1,6 +1,6 @@ {{define "input"}} + value="{{.Value}}" {{if .Required}}required {{end}}{{if .MinLength}}minlength="{{.MinLength}}" {{end}}{{with .Error}} aria-describedby="{{$.Name}}Error"{{end}}> {{with .Error}}