fix: watchlist updated_at and unified auth middleware

This commit is contained in:
2026-05-02 17:53:08 +02:00
committed by Mikkel Elvers
parent 5940d7828a
commit e5c32fd154
5 changed files with 20 additions and 21 deletions

View File

@@ -12,8 +12,7 @@ import (
"sync"
"mal/integrations/jikan"
ctxpkg "mal/internal/context"
database "mal/internal/db"
"mal/internal/middleware"
"mal/templates"
)
@@ -82,7 +81,7 @@ func (h *Handler) HandleWatchPage(w http.ResponseWriter, r *http.Request) {
return episodes.Data[i].MalID < episodes.Data[j].MalID
})
user, _ := r.Context().Value(ctxpkg.UserKey).(*database.User)
user := middleware.GetUser(r.Context())
currentEpID := r.URL.Query().Get("ep")
if currentEpID == "" {
@@ -238,7 +237,7 @@ func (h *Handler) HandleEpisodeData(w http.ResponseWriter, r *http.Request) {
episodeID := parts[5]
user, _ := r.Context().Value(ctxpkg.UserKey).(*database.User)
user := middleware.GetUser(r.Context())
userID := ""
if user != nil {
userID = user.ID