From 5d6198f168dd1a8598048718d149d1171df09c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sun, 5 Oct 2025 15:04:12 +0200 Subject: perf(security): cache assets checksum --- backend/router.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'backend/router.go') diff --git a/backend/router.go b/backend/router.go index 1231fdf..fb43845 100644 --- a/backend/router.go +++ b/backend/router.go @@ -20,7 +20,8 @@ const ( Version = "0.2.0" configKey = "config" isUpdateKey = "is_update" - assetsFS = "assets_fs" + assetsFSKey = "assets_fs" + debugKey = "debug" ) //go:embed templates @@ -78,7 +79,8 @@ func NewRouter(debug bool, cfg *Config, assets fs.FS) *chi.Mux { r.Use(func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := context.WithValue(r.Context(), configKey, cfg) - ctx = context.WithValue(ctx, assetsFS, assets) + ctx = context.WithValue(ctx, assetsFSKey, assets) + ctx = context.WithValue(ctx, debugKey, debug) next.ServeHTTP(w, r.WithContext(ctx)) }) }) -- cgit v1.2.3