revert: remove torrent streaming feature

This commit is contained in:
2026-04-07 13:48:37 +02:00
parent 81e5050732
commit aa5a99eec7
28 changed files with 294 additions and 3937 deletions

View File

@@ -109,7 +109,15 @@ func (h *Handler) HandleAnimeDetails(w http.ResponseWriter, r *http.Request) {
}
func (h *Handler) HandleAPIAnimeRelations(w http.ResponseWriter, r *http.Request) {
idStr := r.PathValue("id")
path := r.URL.Path[len("/api/anime/"):]
idStr := ""
for i, c := range path {
if c == '/' {
idStr = path[:i]
break
}
}
id, _ := strconv.Atoi(idStr)
if id <= 0 {
http.Error(w, "invalid id", http.StatusBadRequest)
@@ -164,29 +172,3 @@ func (h *Handler) HandleQuickSearch(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
json.NewEncoder(w).Encode(output)
}
func (h *Handler) HandleAPIAnimeEpisodes(w http.ResponseWriter, r *http.Request) {
idStr := r.PathValue("id")
id, _ := strconv.Atoi(idStr)
if id <= 0 {
http.Error(w, "invalid id", http.StatusBadRequest)
return
}
anime, err := h.svc.GetAnime(id)
if err != nil {
log.Printf("anime fetch error: %v", err)
http.Error(w, "Failed to fetch anime", http.StatusInternalServerError)
return
}
episodes, err := h.svc.GetEpisodes(id, 1)
if err != nil {
log.Printf("episodes fetch error: %v", err)
// Return empty episodes instead of error
templates.EpisodesList(id, anime.Title, nil, anime.Episodes).Render(r.Context(), w)
return
}
templates.EpisodesList(id, anime.Title, episodes.Episodes, anime.Episodes).Render(r.Context(), w)
}