mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-05 17:10:30 +00:00
remove duplicate code
This commit is contained in:
parent
a28d03a675
commit
d074d73fec
1 changed files with 0 additions and 17 deletions
|
@ -63,22 +63,6 @@ func (a *app) mwAuthToken(next http.Handler) http.Handler {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// mwAdminOnly is a middleware that extends the mwAuthToken middleware to only allow
|
|
||||||
// requests from superusers.
|
|
||||||
// func (a *app) mwAdminOnly(next http.Handler) http.Handler {
|
|
||||||
// mw := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
// usr := services.UseUserCtx(r.Context())
|
|
||||||
|
|
||||||
// if !usr.IsSuperuser {
|
|
||||||
// server.RespondUnauthorized(w)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// next.ServeHTTP(w, r)
|
|
||||||
// })
|
|
||||||
// return a.mwAuthToken(mw)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// mqStripTrailingSlash is a middleware that will strip trailing slashes from the request path.
|
// mqStripTrailingSlash is a middleware that will strip trailing slashes from the request path.
|
||||||
func mwStripTrailingSlash(next http.Handler) http.Handler {
|
func mwStripTrailingSlash(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -111,7 +95,6 @@ func (a *app) mwStructLogger(next http.Handler) http.Handler {
|
||||||
|
|
||||||
log.Info().
|
log.Info().
|
||||||
Str("id", middleware.GetReqID(r.Context())).
|
Str("id", middleware.GetReqID(r.Context())).
|
||||||
Str("url", url).
|
|
||||||
Str("method", r.Method).
|
Str("method", r.Method).
|
||||||
Str("remote_addr", r.RemoteAddr).
|
Str("remote_addr", r.RemoteAddr).
|
||||||
Int("status", record.Status).
|
Int("status", record.Status).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue