Update to rsvp v1.21.1

This commit is contained in:
Teajey 2026-11-18 23:20:09 +09:00
parent 1caf06934f
commit c069ad02ce
No known key found for this signature in database
5 changed files with 9 additions and 6 deletions

View File

@ -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
)

View File

@ -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=

View File

@ -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)
}

View File

@ -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, "."))
}

View File

@ -1,6 +1,6 @@
{{define "input"}}
<input style="padding: .375rem .75rem;" class="form-control{{if .Error}} is-invalid{{end}}" {{if .Type}}type="{{.Type}}" {{end}}name="{{.Name}}"
value="{{.Value}}" {{if .Required}}required {{end}}{{if .MinLength}}minlength="{{.MinLength}}" {{end}}{{with .Error}} aria-describedby="{{.Name}}Error"{{end}}>
value="{{.Value}}" {{if .Required}}required {{end}}{{if .MinLength}}minlength="{{.MinLength}}" {{end}}{{with .Error}} aria-describedby="{{$.Name}}Error"{{end}}>
{{with .Error}}
<div id="{{$.Name}}Error" class="invalid-feedback">
{{.}}