From 84aab574f1469159e2d8b15bb7a3b854abe011cd Mon Sep 17 00:00:00 2001 From: pantsudev Date: Thu, 15 Jun 2017 20:48:38 +1000 Subject: [PATCH] Continue implementing torznab --- common/torrent.go | 11 ++++++++++- router/rss_handler.go | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/common/torrent.go b/common/torrent.go index 36b0dd90..f792a0fe 100644 --- a/common/torrent.go +++ b/common/torrent.go @@ -47,12 +47,16 @@ func (p *TorrentParam) FromRequest(r *http.Request) { nameLike := strings.TrimSpace(r.URL.Query().Get("q")) page := mux.Vars(r)["page"] + if page == "" { + page = r.URL.Query().Get("offset") + } + pagenum, err := strconv.ParseUint(page, 10, 32) if err != nil { pagenum = 1 } - max, err := strconv.ParseUint(r.URL.Query().Get("max"), 10, 32) + max, err := strconv.ParseUint(r.URL.Query().Get("limit"), 10, 32) if err != nil { max = uint64(config.Conf.Navigation.TorrentsPerPage) } else if max > uint64(config.Conf.Navigation.MaxTorrentsPerPage) { @@ -83,6 +87,11 @@ func (p *TorrentParam) FromRequest(r *http.Request) { } var category Category + cat := r.URL.Query().Get("cat") + if cat != "" { + category.Parse(r.URL.Query().Get("cat")) + } + category.Parse(r.URL.Query().Get("c")) var sortMode SortMode diff --git a/router/rss_handler.go b/router/rss_handler.go index 7acc3048..33bd3a52 100644 --- a/router/rss_handler.go +++ b/router/rss_handler.go @@ -20,8 +20,12 @@ func RSSHandler(w http.ResponseWriter, r *http.Request) { page := vars["page"] userID := vars["id"] + offset := r.URL.Query().Get("offset") var err error pagenum := 1 + if page == "" && offset != "" { + page = offset + } if page != "" { pagenum, err = strconv.Atoi(html.EscapeString(page)) if err != nil {