fix: remove extra AppVersion context key entry

This commit is contained in:
juancwu 2026-02-23 17:51:13 +00:00
commit 7e3a2db356
6 changed files with 2 additions and 21 deletions

View file

@ -32,7 +32,6 @@ func guestContext() context.Context {
ctx := context.Background()
ctx = ctxkeys.WithConfig(ctx, testutil.TestConfig().Sanitized())
ctx = ctxkeys.WithCSRFToken(ctx, "test")
ctx = ctxkeys.WithAppVersion(ctx, "test")
return ctx
}

View file

@ -1,16 +0,0 @@
package middleware
import (
"net/http"
"git.juancwu.dev/juancwu/budgit/internal/ctxkeys"
)
func AppVersion(version string) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := ctxkeys.WithAppVersion(r.Context(), version)
next.ServeHTTP(w, r.WithContext(ctx))
})
}
}

View file

@ -298,7 +298,6 @@ func SetupRoutes(a *app.App) http.Handler {
handler := middleware.Chain(
mux,
middleware.SecurityHeaders(),
middleware.AppVersion(a.Cfg.Version),
middleware.Config(a.Cfg),
middleware.RequestLogging,
middleware.NoCacheDynamic,

View file

@ -39,7 +39,6 @@ func AuthenticatedContext(user *model.User, profile *model.Profile) context.Cont
ctx = ctxkeys.WithProfile(ctx, profile)
ctx = ctxkeys.WithConfig(ctx, TestConfig().Sanitized())
ctx = ctxkeys.WithCSRFToken(ctx, "test-csrf-token")
ctx = ctxkeys.WithAppVersion(ctx, "test")
return ctx
}

View file

@ -69,7 +69,7 @@ templ App(title string) {
}
}
<div class="px-2 py-1">
<span class="text-xs text-muted-foreground">App version: { ctxkeys.AppVersion(ctx) }</span>
<span class="text-xs text-muted-foreground">App version: { cfg.Version }</span>
</div>
@sidebar.Separator()
@sidebar.Menu() {

View file

@ -156,7 +156,7 @@ templ Space(title string, space *model.Space) {
}
}
<div class="px-2 py-1">
<span class="text-xs text-muted-foreground">App version: { ctxkeys.AppVersion(ctx) }</span>
<span class="text-xs text-muted-foreground">App version: { cfg.Version }</span>
</div>
@sidebar.Separator()
@sidebar.Menu() {