builds again, not sure how i broke it, also:
All checks were successful
continuous-integration/drone/push Build is passing

* fixes truncated content col
* adds text_content for plain text (has space/tag strip bug)
* update readme
This commit is contained in:
2020-03-27 20:18:55 -07:00
parent 2ecd833726
commit 9655265d85
5 changed files with 18 additions and 3 deletions

View File

@@ -19,8 +19,10 @@ type StoredToot struct {
ServerCreated time.Time
Acct string
Content []byte
TextContent []byte
URL string
Hostname string
Fetched time.Time
}
type APInstance struct {

View File

@@ -2,11 +2,14 @@ package database
import (
"fmt"
"html"
"strings"
"time"
"git.eeqj.de/sneak/feta/toot"
"github.com/google/uuid"
hstg "github.com/grokify/html-strip-tags-go"
_ "github.com/jinzhu/gorm/dialects/sqlite"
)
@@ -28,9 +31,13 @@ func (m *Manager) StoreToot(t *toot.Toot) error {
// FIXME normalize this, check for @ and append hostname if none
nt.Acct = fmt.Sprintf("%s@%s", t.Parsed.Account.Acct, strings.ToLower(t.FromHost))
nt.URL = t.Parsed.URL
nt.Content = t.Parsed.Content
nt.Content = []byte(t.Parsed.Content)
// FIXME replace tags with spaces, don't just strip them, otherwise text
// gets messed up.
nt.TextContent = []byte(html.UnescapeString(hstg.StripTags(t.Parsed.Content)))
nt.Hostname = strings.ToLower(t.FromHost)
nt.Hash = t.GetHash()
nt.Fetched = time.Now()
r := m.db.Create(&nt)
//panic(fmt.Sprintf("%+v", t))
return r.Error