fix(player): simplify autoplay to redirect and ensure episodes are sorted

This commit is contained in:
2026-05-01 18:24:18 +02:00
committed by Mikkel Elvers
parent 8e16a21189
commit bd4c8f87e5
2 changed files with 10 additions and 144 deletions

View File

@@ -5,6 +5,7 @@ import (
"io"
"log"
"net/http"
"sort"
"strconv"
"strings"
@@ -62,6 +63,10 @@ func (h *Handler) HandleWatchPage(w http.ResponseWriter, r *http.Request) {
}
}
sort.Slice(episodes.Data, func(i, j int) bool {
return episodes.Data[i].MalID < episodes.Data[j].MalID
})
user, _ := r.Context().Value(ctxpkg.UserKey).(*database.User)
currentEpID := r.URL.Query().Get("ep")