mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 13:42:24 -05:00
rework media processing a little bit (#191)
* rework media processing a little bit * review changes
This commit is contained in:
parent
ff05046df7
commit
2b14b20802
13 changed files with 486 additions and 166 deletions
|
|
@ -43,8 +43,34 @@ type Dereferencer interface {
|
|||
|
||||
GetRemoteInstance(ctx context.Context, username string, remoteInstanceURI *url.URL) (*gtsmodel.Instance, error)
|
||||
|
||||
GetRemoteAttachment(ctx context.Context, username string, remoteAttachmentURI *url.URL, ownerAccountID string, statusID string, expectedContentType string) (*gtsmodel.MediaAttachment, error)
|
||||
RefreshAttachment(ctx context.Context, requestingUsername string, remoteAttachmentURI *url.URL, ownerAccountID string, expectedContentType string) (*gtsmodel.MediaAttachment, error)
|
||||
// GetRemoteAttachment takes a minimal attachment struct and converts it into a fully fleshed out attachment, stored in the database and instance storage.
|
||||
//
|
||||
// The parameter minAttachment must have at least the following fields defined:
|
||||
// * minAttachment.RemoteURL
|
||||
// * minAttachment.AccountID
|
||||
// * minAttachment.File.ContentType
|
||||
//
|
||||
// The returned attachment will have an ID generated for it, so no need to generate one beforehand.
|
||||
// A blurhash will also be generated for the attachment.
|
||||
//
|
||||
// Most other fields will be preserved on the passed attachment, including:
|
||||
// * minAttachment.StatusID
|
||||
// * minAttachment.CreatedAt
|
||||
// * minAttachment.UpdatedAt
|
||||
// * minAttachment.FileMeta
|
||||
// * minAttachment.AccountID
|
||||
// * minAttachment.Description
|
||||
// * minAttachment.ScheduledStatusID
|
||||
// * minAttachment.Thumbnail.RemoteURL
|
||||
// * minAttachment.Avatar
|
||||
// * minAttachment.Header
|
||||
//
|
||||
// GetRemoteAttachment will return early if an attachment with the same value as minAttachment.RemoteURL
|
||||
// is found in the database -- then that attachment will be returned and nothing else will be changed or stored.
|
||||
GetRemoteAttachment(ctx context.Context, requestingUsername string, minAttachment *gtsmodel.MediaAttachment) (*gtsmodel.MediaAttachment, error)
|
||||
// RefreshAttachment is like GetRemoteAttachment, but the attachment will always be dereferenced again,
|
||||
// whether or not it was already stored in the database.
|
||||
RefreshAttachment(ctx context.Context, requestingUsername string, minAttachment *gtsmodel.MediaAttachment) (*gtsmodel.MediaAttachment, error)
|
||||
|
||||
DereferenceAnnounce(ctx context.Context, announce *gtsmodel.Status, requestingUsername string) error
|
||||
DereferenceThread(ctx context.Context, username string, statusIRI *url.URL) error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue