Admin UI: replace gin with mux (#8420)
* Replace admin gin router with mux * Update layout_templ.go * Harden admin handlers * Add login CSRF handling * Fix filer copy naming conflict * address comments * address comments
This commit is contained in:
19
weed/admin/view/layout/context.go
Normal file
19
weed/admin/view/layout/context.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package layout
|
||||
|
||||
import "net/http"
|
||||
|
||||
// ViewContext contains per-request metadata needed by layout templates.
|
||||
type ViewContext struct {
|
||||
Request *http.Request
|
||||
Username string
|
||||
CSRFToken string
|
||||
}
|
||||
|
||||
// NewViewContext builds a ViewContext from request metadata.
|
||||
func NewViewContext(r *http.Request, username, csrfToken string) ViewContext {
|
||||
return ViewContext{
|
||||
Request: r,
|
||||
Username: username,
|
||||
CSRFToken: csrfToken,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user