mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-12 14:27:29 -06:00
dereference remote media
This commit is contained in:
parent
0b8b0948f6
commit
d29ebc3d27
33 changed files with 1026 additions and 403 deletions
|
|
@ -29,6 +29,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/go-fed/activity/pub"
|
||||
"github.com/go-fed/activity/streams"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/util"
|
||||
)
|
||||
|
|
@ -304,12 +305,24 @@ func extractAttachments(i withAttachment) ([]*gtsmodel.MediaAttachment, error) {
|
|||
|
||||
attachmentProp := i.GetActivityStreamsAttachment()
|
||||
for iter := attachmentProp.Begin(); iter != attachmentProp.End(); iter = iter.Next() {
|
||||
attachmentable, ok := iter.(Attachmentable)
|
||||
|
||||
t := iter.GetType()
|
||||
if t == nil {
|
||||
fmt.Printf("\n\n\nGetType() nil\n\n\n")
|
||||
continue
|
||||
}
|
||||
|
||||
m, _ := streams.Serialize(t)
|
||||
fmt.Printf("\n\n\n%s\n\n\n", m)
|
||||
|
||||
attachmentable, ok := t.(Attachmentable)
|
||||
if !ok {
|
||||
fmt.Printf("\n\n\nnot attachmentable\n\n\n")
|
||||
continue
|
||||
}
|
||||
attachment, err := extractAttachment(attachmentable)
|
||||
if err != nil {
|
||||
fmt.Printf("\n\n\n%s\n\n\n", err)
|
||||
continue
|
||||
}
|
||||
attachments = append(attachments, attachment)
|
||||
|
|
@ -343,10 +356,7 @@ func extractAttachment(i Attachmentable) (*gtsmodel.MediaAttachment, error) {
|
|||
attachment.Description = name
|
||||
}
|
||||
|
||||
blurhash, err := extractBlurhash(i)
|
||||
if err == nil {
|
||||
attachment.Blurhash = blurhash
|
||||
}
|
||||
attachment.Processing = gtsmodel.ProcessingStatusReceived
|
||||
|
||||
return attachment, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,8 +69,6 @@ type Attachmentable interface {
|
|||
withMediaType
|
||||
withURL
|
||||
withName
|
||||
withBlurhash
|
||||
withFocalPoint
|
||||
}
|
||||
|
||||
// Hashtaggable represents the minimum activitypub interface for representing a 'hashtag' tag.
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ func (c *converter) ASStatusToStatus(statusable Statusable) (*gtsmodel.Status, e
|
|||
|
||||
// if it's CC'ed to public, it's public or unlocked
|
||||
// mentioned SPECIFIC ACCOUNTS also get added to CC'es if it's not a direct message
|
||||
if isPublic(to) {
|
||||
if isPublic(cc) || isPublic(to) {
|
||||
visibility = gtsmodel.VisibilityPublic
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue