From ab12d6abca50cbeaacbc1630519fc2a5e49d81da Mon Sep 17 00:00:00 2001 From: Wessie Date: Wed, 19 Jun 2024 21:27:51 +0100 Subject: [PATCH] websitea/admin: add CSRFTokenInput to home page input --- website/admin/home.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/website/admin/home.go b/website/admin/home.go index be0ed1d9..63d3738b 100644 --- a/website/admin/home.go +++ b/website/admin/home.go @@ -1,16 +1,19 @@ package admin import ( + "html/template" "net/http" radio "github.com/R-a-dio/valkyrie" "github.com/R-a-dio/valkyrie/util/secret" "github.com/R-a-dio/valkyrie/website/middleware" + "github.com/gorilla/csrf" ) type HomeInput struct { middleware.Input - Daypass string + Daypass string + CSRFTokenInput template.HTML CanKillStreamer bool @@ -23,6 +26,7 @@ func NewHomeInput(r *http.Request, dp secret.Secret) HomeInput { return HomeInput{ Input: input, Daypass: dp.Get(nil), + CSRFTokenInput: csrf.TemplateField(r), CanTemplateReload: input.User.UserPermissions.Has(radio.PermAdmin), CanKillStreamer: input.User.UserPermissions.Has(radio.PermDJ), }