modify the RSS feed and sent it as XML
This commit is contained in:
parent
564bc640ef
commit
51a854d745
1 changed files with 8 additions and 4 deletions
12
go/main.go
12
go/main.go
|
@ -65,7 +65,7 @@ func convertICStoRSS(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
log.Println("[INFO] Generating RSS feed")
|
log.Println("[INFO] Generating RSS feed")
|
||||||
|
|
||||||
// RSS als HTTP-Antwort senden
|
// RSS als XML generieren
|
||||||
rssData, err := feed.ToRss()
|
rssData, err := feed.ToRss()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Unable to generate RSS feed: %v\n", err)
|
log.Printf("[ERROR] Unable to generate RSS feed: %v\n", err)
|
||||||
|
@ -73,10 +73,14 @@ func convertICStoRSS(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/rss+xml")
|
// Header setzen für XML-Anzeige im Browser
|
||||||
w.Write([]byte(rssData))
|
w.Header().Set("Content-Type", "application/xml; charset=utf-8")
|
||||||
|
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||||
|
|
||||||
log.Println("[INFO] RSS feed successfully generated and sent")
|
// XML-Daten an den Browser senden
|
||||||
|
fmt.Fprint(w, rssData)
|
||||||
|
|
||||||
|
log.Println("[INFO] RSS feed successfully generated and sent as XML")
|
||||||
}
|
}
|
||||||
|
|
||||||
func shouldIncludeEvent(event gocal.Event, timeRange string, now time.Time) bool {
|
func shouldIncludeEvent(event gocal.Event, timeRange string, now time.Time) bool {
|
||||||
|
|
Loading…
Reference in a new issue