weee
This commit is contained in:
@@ -34,3 +34,25 @@ func (h *Web) handlePodcastDownload(w http.ResponseWriter, r *http.Request) {
|
||||
go func() { _ = h.Podcasts.DownloadEpisode(context.Background(), id) }()
|
||||
http.Redirect(w, r, "/podcasts", http.StatusFound)
|
||||
}
|
||||
|
||||
func (h *Web) handlePodcastDownloadAll(w http.ResponseWriter, r *http.Request) {
|
||||
id := r.PathValue("id")
|
||||
if _, err := database.GetPodcastChannel(h.DB, id); err != nil {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
if err := r.ParseForm(); err != nil {
|
||||
http.Error(w, "bad request", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
if err := h.Podcasts.DownloadChannel(context.Background(), id); err != nil && h.Log != nil {
|
||||
h.Log.Warn("podcast channel download failed", "channel", id, "err", err)
|
||||
}
|
||||
}()
|
||||
destination := "/podcasts"
|
||||
if next := r.FormValue("next"); next != "" {
|
||||
destination = safeRedirectPath(next)
|
||||
}
|
||||
http.Redirect(w, r, destination, http.StatusFound)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user