builds again, not sure how i broke it, also:
All checks were successful
continuous-integration/drone/push Build is passing
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:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user