mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-07 04:08:07 -06:00
work on emojis
This commit is contained in:
parent
de9718c566
commit
32629a378d
31 changed files with 605 additions and 67 deletions
|
|
@ -52,9 +52,14 @@ type Converter interface {
|
|||
// fields sanitized so that it can be served to non-authorized accounts without revealing any private information.
|
||||
AppToMastoPublic(application *gtsmodel.Application) (*mastotypes.Application, error)
|
||||
|
||||
// AttachmentToMasto converts a gts model media attacahment into its mastodon representation for serialization on the API.
|
||||
AttachmentToMasto(attachment *gtsmodel.MediaAttachment) (mastotypes.Attachment, error)
|
||||
|
||||
// MentionToMasto converts a gts model mention into its mastodon (frontend) representation for serialization on the API.
|
||||
MentionToMasto(m *gtsmodel.Mention) (mastotypes.Mention, error)
|
||||
|
||||
// EmojiToMasto converts a gts model emoji into its mastodon (frontend) representation for serialization on the API.
|
||||
EmojiToMasto(e *gtsmodel.Emoji) (mastotypes.Emoji, error)
|
||||
}
|
||||
|
||||
type converter struct {
|
||||
|
|
@ -62,6 +67,7 @@ type converter struct {
|
|||
db db.DB
|
||||
}
|
||||
|
||||
// New returns a new Converter
|
||||
func New(config *config.Config, db db.DB) Converter {
|
||||
return &converter{
|
||||
config: config,
|
||||
|
|
@ -290,3 +296,13 @@ func (c *converter) MentionToMasto(m *gtsmodel.Mention) (mastotypes.Mention, err
|
|||
Acct: acct,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *converter) EmojiToMasto(e *gtsmodel.Emoji) (mastotypes.Emoji, error) {
|
||||
return mastotypes.Emoji{
|
||||
Shortcode: e.Shortcode,
|
||||
URL: e.ImageURL,
|
||||
StaticURL: e.ImageStaticURL,
|
||||
VisibleInPicker: e.VisibleInPicker,
|
||||
Category: e.CategoryID,
|
||||
}, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package mastotypes
|
||||
|
||||
import "mime/multipart"
|
||||
|
||||
// Emoji represents a custom emoji. See https://docs.joinmastodon.org/entities/emoji/
|
||||
type Emoji struct {
|
||||
// REQUIRED
|
||||
|
|
@ -36,3 +38,11 @@ type Emoji struct {
|
|||
// Used for sorting custom emoji in the picker.
|
||||
Category string `json:"category,omitempty"`
|
||||
}
|
||||
|
||||
// EmojiCreateRequest represents a request to create a custom emoji made through the admin API.
|
||||
type EmojiCreateRequest struct {
|
||||
// Desired shortcode for the emoji, without surrounding colons. This must be unique for the domain.
|
||||
Shortcode string `form:"shortcode" validation:"required"`
|
||||
// Image file to use for the emoji. Must be png or gif and no larger than 50kb.
|
||||
Image *multipart.FileHeader `form:"image" validation:"required"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue