diff --git a/controllers/feed/magnet.go b/controllers/feed/magnet.go index c7d7928b..4ef5fd85 100644 --- a/controllers/feed/magnet.go +++ b/controllers/feed/magnet.go @@ -4,7 +4,6 @@ import ( "net/http" "strconv" "strings" - "time" "github.com/NyaaPantsu/nyaa/config" "github.com/NyaaPantsu/nyaa/utils/feeds" @@ -26,7 +25,7 @@ func RSSMagnetHandler(c *gin.Context) { feed := &nyaafeeds.RssFeed{ Title: title, Link: config.WebAddress() + "/", - PubDate: createdAsTime.String(), + PubDate: formatRSSDate(createdAsTime), } feed.Items = make([]*nyaafeeds.RssItem, len(torrents)) @@ -36,7 +35,7 @@ func RSSMagnetHandler(c *gin.Context) { Title: torrentJSON.Name, Link: &nyaafeeds.RssMagnetLink{Text: string(torrentJSON.Magnet)}, Description: string(torrentJSON.Description), - PubDate: torrent.Date.Format(time.RFC1123Z), + PubDate: formatRSSDate(torrent.Date), GUID: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), Enclosure: &nyaafeeds.RssEnclosure{ URL: config.WebAddress() + "/download/" + strings.TrimSpace(torrentJSON.Hash), diff --git a/controllers/feed/rss.go b/controllers/feed/rss.go index fc3e6fd1..b2b79e0f 100644 --- a/controllers/feed/rss.go +++ b/controllers/feed/rss.go @@ -5,6 +5,7 @@ import ( "strconv" "strings" "time" + "fmt" "github.com/NyaaPantsu/nyaa/config" "github.com/NyaaPantsu/nyaa/utils/feeds" @@ -26,7 +27,7 @@ func RSSHandler(c *gin.Context) { feed := &nyaafeeds.RssFeed{ Title: title, Link: config.WebAddress() + "/", - PubDate: createdAsTime.String(), + PubDate: formatRSSDate(createdAsTime), } feed.Items = make([]*nyaafeeds.RssItem, len(torrents)) @@ -36,7 +37,7 @@ func RSSHandler(c *gin.Context) { Title: torrentJSON.Name, Link: config.WebAddress() + "/download/" + torrentJSON.Hash, Description: string(torrentJSON.Description), - PubDate: torrent.Date.Format(time.RFC1123Z), + PubDate: formatRSSDate(torrent.Date), GUID: config.WebAddress() + "/view/" + strconv.FormatUint(uint64(torrentJSON.ID), 10), Enclosure: &nyaafeeds.RssEnclosure{ URL: config.WebAddress() + "/download/" + strings.TrimSpace(torrentJSON.Hash), @@ -57,3 +58,9 @@ func RSSHandler(c *gin.Context) { c.AbortWithError(http.StatusInternalServerError, writeErr) } } + +//Return date in an RFC 2822 format, the official one for RSS2 +func formatRSSDate(Date time.Time) string { + Date = Date.UTC() + return fmt.Sprintf("%.3s, %.2d %.3s %d %.2d:%.2d:%.2d +0000", Date.Weekday(), Date.Day(), Date.Month(), Date.Year(), Date.Hour(), Date.Minute(), Date.Second()) +} diff --git a/public/css/main.css b/public/css/main.css index 1eff2380..ee357997 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -2148,7 +2148,7 @@ table.multiple-upload { width: 150px; font-weight: bold; font-size: 14px!important; - padding: 5px 0; + padding: 5px 0; } .user-search { diff --git a/templates/admin/index.jet.html b/templates/admin/index.jet.html index a40e149f..7a70f0b7 100644 --- a/templates/admin/index.jet.html +++ b/templates/admin/index.jet.html @@ -24,7 +24,7 @@
0}}href="/user/{{element.UserID}}/{{element.Username}}"{{end}} class="comment-user">{{if element.Username == ""}}れんちょん{{else}}{{element.Username}}{{end}}
{{element.Content|raw}}
diff --git a/templates/site/user/edit.jet.html b/templates/site/user/edit.jet.html index 8a833574..715253ed 100644 --- a/templates/site/user/edit.jet.html +++ b/templates/site/user/edit.jet.html @@ -262,7 +262,7 @@ {{ if User.CurrentOrAdmin(UserProfile.ID) }}{{end}} {{end}}