diff options
author | FChannel <=> | 2021-01-17 20:45:07 -0800 |
---|---|---|
committer | FChannel <=> | 2021-01-17 20:45:07 -0800 |
commit | 9dc91965b1886e813aa29f5f7fb6512e2af29858 (patch) | |
tree | 14f80f35b7e6cfba1471e213ce9fd62dc97961e6 /outboxGet.go | |
parent | 89f88072c9ffd6a6e321ee7b5455665d82dbd6d7 (diff) |
support for preview images
Diffstat (limited to 'outboxGet.go')
-rw-r--r-- | outboxGet.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/outboxGet.go b/outboxGet.go index 55c63f8..1747165 100644 --- a/outboxGet.go +++ b/outboxGet.go @@ -47,7 +47,7 @@ func GetCollectionFromPath(db *sql.DB, path string) Collection { var nColl Collection var result []ObjectBase - query := fmt.Sprintf("SELECT id, name, content, type, published, attributedto, attachment, actor FROM activitystream WHERE id='%s' ORDER BY published desc;", path) + query := fmt.Sprintf("SELECT id, name, content, type, published, attributedto, attachment, preview, actor FROM activitystream WHERE id='%s' ORDER BY published desc;", path) rows, err := db.Query(query) @@ -59,8 +59,9 @@ func GetCollectionFromPath(db *sql.DB, path string) Collection { var actor Actor var post ObjectBase var attachID string + var previewID string - err = rows.Scan(&post.Id, &post.Name, &post.Content, &post.Type, &post.Published, &post.AttributedTo, &attachID, &actor.Id) + err = rows.Scan(&post.Id, &post.Name, &post.Content, &post.Type, &post.Published, &post.AttributedTo, &attachID, &previewID, &actor.Id) CheckError(err, "error scan object into post struct from path") @@ -74,6 +75,8 @@ func GetCollectionFromPath(db *sql.DB, path string) Collection { post.Attachment = GetObjectAttachment(db, attachID) + post.Preview = GetObjectPreview(db, previewID) + result = append(result, post) } @@ -89,7 +92,7 @@ func GetObjectFromPath(db *sql.DB, path string) ObjectBase{ var nObj ObjectBase var result []ObjectBase - query := fmt.Sprintf("SELECT id, name, content, type, published, attributedto, attachment, actor FROM activitystream WHERE id='%s' ORDER BY published desc;", path) + query := fmt.Sprintf("SELECT id, name, content, type, published, attributedto, attachment, preview, actor FROM activitystream WHERE id='%s' ORDER BY published desc;", path) rows, err := db.Query(query) @@ -100,8 +103,9 @@ func GetObjectFromPath(db *sql.DB, path string) ObjectBase{ for rows.Next(){ var post ObjectBase var attachID string + var previewID string - err = rows.Scan(&post.Id, &post.Name, &post.Content, &post.Type, &post.Published, &post.AttributedTo, &attachID, &post.Actor) + err = rows.Scan(&post.Id, &post.Name, &post.Content, &post.Type, &post.Published, &post.AttributedTo, &attachID, &previewID, &post.Actor) CheckError(err, "error scan object into post struct from path") @@ -111,6 +115,8 @@ func GetObjectFromPath(db *sql.DB, path string) ObjectBase{ post.Attachment = GetObjectAttachment(db, attachID) + post.Preview = GetObjectPreview(db, previewID) + result = append(result, post) } |