refactor: migrate from templ to html/template

This commit is contained in:
2026-05-01 15:46:16 +02:00
committed by Mikkel Elvers
parent e6600e8af4
commit 2c6d28cf01
14 changed files with 261 additions and 1253 deletions

View File

@@ -4,8 +4,8 @@ import (
"net/http"
"strings"
"mal/internal/context"
"mal/internal/db"
webcontext "mal/web/context"
)
type AccessPolicy struct {
@@ -47,7 +47,7 @@ func RequireGlobalAuthWithPolicy(policy AccessPolicy) func(http.Handler) http.Ha
return
}
user, ok := r.Context().Value(webcontext.UserKey).(*database.User)
user, ok := r.Context().Value(context.UserKey).(*database.User)
if !ok || user == nil {
if strings.HasPrefix(r.URL.Path, "/api/") || r.Header.Get("HX-Request") == "true" {
w.Header().Set("HX-Redirect", "/login")