Fix incorrect feed URLs (closes #971)
Cette révision appartient à :
Parent
66a13d0599
révision
1675b12cad
2 fichiers modifiés avec 16 ajouts et 3 suppressions
|
@ -27,6 +27,15 @@ func IsSukebei() bool {
|
|||
return Conf.Models.TorrentsTableName == "sukebei_torrents"
|
||||
}
|
||||
|
||||
// WebAddress : Returns web address for current site
|
||||
func WebAddress() string {
|
||||
if IsSukebei() {
|
||||
return Conf.WebAddress.Sukebei
|
||||
} else {
|
||||
return Conf.WebAddress.Nyaa
|
||||
}
|
||||
}
|
||||
|
||||
var allowedDatabaseTypes = map[string]bool{
|
||||
"sqlite3": true,
|
||||
"postgres": true,
|
||||
|
|
|
@ -64,9 +64,13 @@ func RSSHandler(w http.ResponseWriter, r *http.Request) {
|
|||
if len(torrents) > 0 {
|
||||
createdAsTime = torrents[0].Date
|
||||
}
|
||||
title := "Nyaa Pantsu"
|
||||
if config.IsSukebei() {
|
||||
title = "Sukebei Pantsu"
|
||||
}
|
||||
feed := &feeds.Feed{
|
||||
Title: "Nyaa Pantsu",
|
||||
Link: &feeds.Link{Href: config.Conf.WebAddress.Nyaa + "/"},
|
||||
Title: title,
|
||||
Link: &feeds.Link{Href: config.WebAddress() + "/"},
|
||||
Created: createdAsTime,
|
||||
}
|
||||
feed.Items = make([]*feeds.Item, len(torrents))
|
||||
|
@ -74,7 +78,7 @@ func RSSHandler(w http.ResponseWriter, r *http.Request) {
|
|||
for i, torrent := range torrents {
|
||||
torrentJSON := torrent.ToJSON()
|
||||
feed.Items[i] = &feeds.Item{
|
||||
ID: config.Conf.WebAddress.Nyaa + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10),
|
||||
ID: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10),
|
||||
Title: torrent.Name,
|
||||
Link: &feeds.Link{Href: string("<![CDATA[" + torrentJSON.Magnet + "]]>")},
|
||||
Description: string(torrentJSON.Description),
|
||||
|
|
Référencer dans un nouveau ticket