Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Fix up rss handler spec violations

Cette révision appartient à :
PantsuDev 2017-06-19 09:55:09 +10:00
Parent f31d884f6a
révision 0cfacdd48d

Voir le fichier

@ -5,6 +5,7 @@ import (
"html" "html"
"net/http" "net/http"
"strconv" "strconv"
"strings"
"time" "time"
"sort" "sort"
@ -43,13 +44,12 @@ func RSSHandler(w http.ResponseWriter, r *http.Request) {
torrentJSON := torrent.ToJSON() torrentJSON := torrent.ToJSON()
feed.Items[i] = &nyaafeeds.RssItem{ feed.Items[i] = &nyaafeeds.RssItem{
Title: torrentJSON.Name, Title: torrentJSON.Name,
Link: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), Link: config.WebAddress() + "/download/" + torrentJSON.Hash,
Description: string(torrentJSON.Description), Description: string(torrentJSON.Description),
Author: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), PubDate: torrent.Date.Format(time.RFC822),
PubDate: torrent.Date.String(), GUID: config.WebAddress() + "view" + strconv.FormatUint(uint64(torrentJSON.ID), 10),
GUID: config.WebAddress() + "/download/" + torrentJSON.Hash,
Enclosure: &nyaafeeds.RssEnclosure{ Enclosure: &nyaafeeds.RssEnclosure{
URL: config.WebAddress() + "/download/" + torrentJSON.Hash, URL: config.WebAddress() + "/download/" + strings.TrimSpace(torrentJSON.Hash),
Length: strconv.FormatUint(uint64(torrentJSON.Filesize), 10), Length: strconv.FormatUint(uint64(torrentJSON.Filesize), 10),
Type: "application/x-bittorrent", Type: "application/x-bittorrent",
}, },
@ -97,10 +97,10 @@ func RSSEztvHandler(w http.ResponseWriter, r *http.Request) {
}, },
Description: string(torrentJSON.Description), Description: string(torrentJSON.Description),
Comments: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), Comments: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10),
PubDate: torrent.Date.String(), PubDate: torrent.Date.Format(time.RFC822),
GUID: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), GUID: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10),
Enclosure: &nyaafeeds.RssEnclosure{ Enclosure: &nyaafeeds.RssEnclosure{
URL: config.WebAddress() + "/download/" + torrentJSON.Hash, URL: config.WebAddress() + "/download/" + strings.TrimSpace(torrentJSON.Hash),
Length: strconv.FormatUint(uint64(torrentJSON.Filesize), 10), Length: strconv.FormatUint(uint64(torrentJSON.Filesize), 10),
Type: "application/x-bittorrent", Type: "application/x-bittorrent",
}, },
@ -242,10 +242,10 @@ func RSSTorznabHandler(w http.ResponseWriter, r *http.Request) {
}, },
Description: string(torrentJSON.Description), Description: string(torrentJSON.Description),
Comments: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), Comments: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10),
PubDate: torrent.Date.String(), PubDate: torrent.Date.Format(time.RFC822),
GUID: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), GUID: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10),
Enclosure: &nyaafeeds.RssEnclosure{ Enclosure: &nyaafeeds.RssEnclosure{
URL: config.WebAddress() + "/download/" + torrentJSON.Hash, URL: config.WebAddress() + "/download/" + strings.TrimSpace(torrentJSON.Hash),
Length: strconv.FormatUint(uint64(torrentJSON.Filesize), 10), Length: strconv.FormatUint(uint64(torrentJSON.Filesize), 10),
Type: "application/x-bittorrent", Type: "application/x-bittorrent",
}, },