This commit is contained in:
jdl
2024-12-12 21:11:17 +01:00
parent 03ff1aac80
commit fdf0066fc2
35 changed files with 1138 additions and 331 deletions

View File

@@ -64,3 +64,18 @@ func (app *App) handleSignedIn(pattern string, fn handlerFunc) {
return fn(s, w, r)
})
}
type peerHandlerFunc func(w http.ResponseWriter, r *http.Request) error
func (app *App) handlePeer(pattern string, fn peerHandlerFunc) {
wrapped := func(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
if err := fn(w, r); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
app.mux.HandleFunc(pattern,
webutil.WithLogging(
wrapped))
}