Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Added CROS for RSS

Cette révision appartient à :
akuma06 2017-05-11 15:50:26 +02:00
Parent b2c1ac13b4
révision 4d5c04bbac

Voir le fichier

@ -36,12 +36,13 @@ func RSSHandler(w http.ResponseWriter, r *http.Request) {
Id: "https://" + config.WebAddress + "/view/" + strconv.FormatUint(uint64(torrents[i].ID), 10), Id: "https://" + config.WebAddress + "/view/" + strconv.FormatUint(uint64(torrents[i].ID), 10),
Title: torrents[i].Name, Title: torrents[i].Name,
Link: &feeds.Link{Href: string(torrentJSON.Magnet)}, Link: &feeds.Link{Href: string(torrentJSON.Magnet)},
Description: "", Description: string(torrentJSON.Description),
Created: torrents[0].Date, Created: torrents[0].Date,
Updated: torrents[0].Date, Updated: torrents[0].Date,
} }
} }
//allow cross domain AJAX requests
w.Header().Set("Access-Control-Allow-Origin", "*")
rss, rssErr := feed.ToRss() rss, rssErr := feed.ToRss()
if rssErr != nil { if rssErr != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)