chore: cleanup files

This commit is contained in:
2026-04-08 18:02:54 +02:00
parent b3477fa7dd
commit a0617ec127
17 changed files with 82 additions and 81 deletions

View File

@@ -41,7 +41,6 @@ func Auth(authService *auth.Service) func(http.Handler) http.Handler {
}
}
// RequireAuth ensures that a valid user is in the context, otherwise unauthorized
func RequireAuth(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
user, ok := r.Context().Value(UserContextKey).(*database.User)
@@ -58,7 +57,6 @@ func RequireAuth(next http.Handler) http.Handler {
})
}
// RequireGlobalAuth ensures that a valid user is in the context for all routes except login and static
func RequireGlobalAuth(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Allow unauthenticated access to login, register, search, and static files
@@ -83,7 +81,6 @@ func RequireGlobalAuth(next http.Handler) http.Handler {
})
}
// GetUser returns the user from context, or nil if not logged in
func GetUser(ctx context.Context) *database.User {
user, ok := ctx.Value(UserContextKey).(*database.User)
if !ok {