Support audio attachments

This commit is contained in:
silverpill 2023-03-05 14:08:26 +00:00
parent ba1c694294
commit 452de34780
4 changed files with 6 additions and 0 deletions

View file

@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Added `registration.default_role` configuration option.
- Save emojis attached to actor objects.
- Added `emojis` field to Mastodon API Account entity.
- Support audio attachments.
### Changed

View file

@ -1497,6 +1497,7 @@ components:
- unknown
- image
- video
- audio
url:
description: The location of the original full-size attachment.
type: string

View file

@ -33,6 +33,7 @@ impl Attachment {
AttachmentType::Unknown => "unknown",
AttachmentType::Image => "image",
AttachmentType::Video => "video",
AttachmentType::Audio => "audio",
};
let attachment_url = get_file_url(
base_url,

View file

@ -19,6 +19,7 @@ pub enum AttachmentType {
Unknown,
Image,
Video,
Audio,
}
impl AttachmentType {
@ -29,6 +30,8 @@ impl AttachmentType {
Self::Image
} else if media_type.starts_with("video/") {
Self::Video
} else if media_type.starts_with("audio/") {
Self::Audio
} else {
Self::Unknown
}