From 41655577d33cca0bc275820d1b96e97f2332084f Mon Sep 17 00:00:00 2001 From: Eliot Whalan Date: Fri, 5 May 2017 16:14:13 +1000 Subject: [PATCH 1/2] Fix descriptions --- models.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models.go b/models.go index 1a0381bb..b1842963 100644 --- a/models.go +++ b/models.go @@ -79,7 +79,7 @@ type TorrentsJson struct { Hash string `json: "hash"` Date int `json: "date"` Filesize string `json: "filesize"` - Description string `json: "description"` + Description template.HTML `json: "description"` Sub_Category SubCategoryJson `json: "sub_category"` Category CategoryJson `json: "category"` Magnet template.URL `json: "magnet"` @@ -214,7 +214,7 @@ func (t *Torrents) toJson() TorrentsJson { Hash: t.Hash, Date: t.Date, Filesize: t.Filesize, - Description: unZlib(t.Description), + Description: template.HTML(unZlib(t.Description)), Sub_Category: t.Sub_Categories.toJson(), Category: t.Categories.toJson(), Magnet: safe(magnet)} From 7f881251b73f43ab541d9ed3a41d50e97d62743d Mon Sep 17 00:00:00 2001 From: Eliot Whalan Date: Fri, 5 May 2017 16:20:57 +1000 Subject: [PATCH 2/2] Convert unix timestamps to datetime --- models.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/models.go b/models.go index b1842963..8580932c 100644 --- a/models.go +++ b/models.go @@ -7,6 +7,7 @@ import ( "html/template" "strconv" "strings" + "time" ) type Feed struct { @@ -44,7 +45,7 @@ type Torrents struct { Sub_category_id int `gorm:"column:sub_category_id"` Status int `gorm:"column:status_id"` Hash string `gorm:"column:torrent_hash"` - Date int `gorm:"column:date"` + Date int64 `gorm:"column:date"` Downloads int `gorm:"column:downloads"` Filesize string `gorm:"column:filesize"` Description []byte `gorm:"column:description"` @@ -77,7 +78,7 @@ type TorrentsJson struct { Name string `json: "name"` Status int `json: "status"` Hash string `json: "hash"` - Date int `json: "date"` + Date string `json: "date"` Filesize string `json: "filesize"` Description template.HTML `json: "description"` Sub_Category SubCategoryJson `json: "sub_category"` @@ -212,7 +213,7 @@ func (t *Torrents) toJson() TorrentsJson { Name: html.UnescapeString(t.Name), Status: t.Status, Hash: t.Hash, - Date: t.Date, + Date: time.Unix(t.Date, 0).Format(time.RFC3339), Filesize: t.Filesize, Description: template.HTML(unZlib(t.Description)), Sub_Category: t.Sub_Categories.toJson(),