tests are passing, but there's still much to be done

This commit is contained in:
tsmethurst
2022-01-09 18:41:22 +01:00
parent f61c3ddcf7
commit dccf21dd87
18 changed files with 259 additions and 170 deletions

View File

@@ -22,6 +22,7 @@ import (
"bytes"
"errors"
"fmt"
"time"
"github.com/h2non/filetype"
)
@@ -67,6 +68,31 @@ const (
TypeEmoji Type = "emoji" // TypeEmoji is the key for emoji type requests
)
// AdditionalInfo represents additional information that should be added to an attachment
// when processing a piece of media.
type AdditionalInfo struct {
// Time that this media was created; defaults to time.Now().
CreatedAt *time.Time
// ID of the status to which this media is attached; defaults to "".
StatusID *string
// URL of the media on a remote instance; defaults to "".
RemoteURL *string
// Image description of this media; defaults to "".
Description *string
// Blurhash of this media; defaults to "".
Blurhash *string
// ID of the scheduled status to which this media is attached; defaults to "".
ScheduledStatusID *string
// Mark this media as in-use as an avatar; defaults to false.
Avatar *bool
// Mark this media as in-use as a header; defaults to false.
Header *bool
// X focus coordinate for this media; defaults to 0.
FocusX *float32
// Y focus coordinate for this media; defaults to 0.
FocusY *float32
}
// parseContentType parses the MIME content type from a file, returning it as a string in the form (eg., "image/jpeg").
// Returns an error if the content type is not something we can process.
func parseContentType(content []byte) (string, error) {